Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Side by Side Diff: content/browser/renderer_host/media/service_video_capture_device_launcher.h

Issue 2902203002: [Mojo Video Capture] Hook up connection lost events (Closed)
Patch Set: Fix duplicate member introduced during merging Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_SERVICE_VIDEO_CAPTURE_DEVICE_LAUNCHE R_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_SERVICE_VIDEO_CAPTURE_DEVICE_LAUNCHE R_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_SERVICE_VIDEO_CAPTURE_DEVICE_LAUNCHE R_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_SERVICE_VIDEO_CAPTURE_DEVICE_LAUNCHE R_H_
7 7
8 #include "content/browser/renderer_host/media/video_capture_provider.h" 8 #include "content/browser/renderer_host/media/video_capture_provider.h"
9 #include "content/public/common/media_stream_request.h" 9 #include "content/public/common/media_stream_request.h"
10 #include "services/video_capture/public/interfaces/device_factory.mojom.h" 10 #include "services/video_capture/public/interfaces/device_factory.mojom.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 // Implementation of VideoCaptureDeviceLauncher that uses the "video_capture" 14 // Implementation of VideoCaptureDeviceLauncher that uses the "video_capture"
15 // service. 15 // service.
16 class CONTENT_EXPORT ServiceVideoCaptureDeviceLauncher 16 class CONTENT_EXPORT ServiceVideoCaptureDeviceLauncher
17 : public VideoCaptureDeviceLauncher { 17 : public VideoCaptureDeviceLauncher {
18 public: 18 public:
19 explicit ServiceVideoCaptureDeviceLauncher( 19 explicit ServiceVideoCaptureDeviceLauncher(
20 video_capture::mojom::DeviceFactoryPtr* device_factory); 20 video_capture::mojom::DeviceFactoryPtr* device_factory);
21 ~ServiceVideoCaptureDeviceLauncher() override; 21 ~ServiceVideoCaptureDeviceLauncher() override;
22 22
23 // VideoCaptureDeviceLauncher implementation. 23 // VideoCaptureDeviceLauncher implementation.
24 void LaunchDeviceAsync(const std::string& device_id, 24 void LaunchDeviceAsync(const std::string& device_id,
25 MediaStreamType stream_type, 25 MediaStreamType stream_type,
26 const media::VideoCaptureParams& params, 26 const media::VideoCaptureParams& params,
27 base::WeakPtr<media::VideoFrameReceiver> receiver, 27 base::WeakPtr<media::VideoFrameReceiver> receiver,
28 base::OnceClosure connection_lost_cb,
28 Callbacks* callbacks, 29 Callbacks* callbacks,
29 base::OnceClosure done_cb) override; 30 base::OnceClosure done_cb) override;
30 void AbortLaunch() override; 31 void AbortLaunch() override;
31 32
32 void OnUtilizationReport(int frame_feedback_id, double utilization); 33 void OnUtilizationReport(int frame_feedback_id, double utilization);
33 34
34 private: 35 private:
35 enum class State { 36 enum class State {
36 READY_TO_LAUNCH, 37 READY_TO_LAUNCH,
37 DEVICE_START_IN_PROGRESS, 38 DEVICE_START_IN_PROGRESS,
38 DEVICE_START_ABORTING 39 DEVICE_START_ABORTING
39 }; 40 };
40 41
41 void OnCreateDeviceCallback( 42 void OnCreateDeviceCallback(
42 const media::VideoCaptureParams& params, 43 const media::VideoCaptureParams& params,
43 video_capture::mojom::DevicePtr device, 44 video_capture::mojom::DevicePtr device,
44 base::WeakPtr<media::VideoFrameReceiver> receiver, 45 base::WeakPtr<media::VideoFrameReceiver> receiver,
46 base::OnceClosure connection_lost_cb,
45 video_capture::mojom::DeviceAccessResultCode result_code); 47 video_capture::mojom::DeviceAccessResultCode result_code);
46 48
47 void OnConnectionLostWhileWaitingForCallback(); 49 void OnConnectionLostWhileWaitingForCallback();
48 50
49 video_capture::mojom::DeviceFactoryPtr* const device_factory_; 51 video_capture::mojom::DeviceFactoryPtr* const device_factory_;
50 State state_; 52 State state_;
51 base::SequenceChecker sequence_checker_; 53 base::SequenceChecker sequence_checker_;
52 base::OnceClosure done_cb_; 54 base::OnceClosure done_cb_;
53 Callbacks* callbacks_; 55 Callbacks* callbacks_;
54 }; 56 };
55 57
56 } // namespace content 58 } // namespace content
57 59
58 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_SERVICE_VIDEO_CAPTURE_DEVICE_LAUN CHER_H_ 60 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_SERVICE_VIDEO_CAPTURE_DEVICE_LAUN CHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698