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

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

Issue 2753073006: [Mojo Video Capture] Add support to BuildableVideoCaptureDevice for aborting the device start. (Closed)
Patch Set: Incorporate suggestions from Patch Set 1 Created 3 years, 9 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_BUILDABLE_VIDEO_CAPTURE_DEVICE_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_BUILDABLE_VIDEO_CAPTURE_DEVICE_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_BUILDABLE_VIDEO_CAPTURE_DEVICE_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_BUILDABLE_VIDEO_CAPTURE_DEVICE_H_
7 7
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "content/public/common/media_stream_request.h" 10 #include "content/public/common/media_stream_request.h"
11 #include "media/capture/video/video_capture_device.h" 11 #include "media/capture/video/video_capture_device.h"
12 #include "media/capture/video_capture_types.h" 12 #include "media/capture/video_capture_types.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 class VideoCaptureController; 16 class VideoCaptureController;
17 17
18 class CONTENT_EXPORT BuildableDeviceCallbacks { 18 class CONTENT_EXPORT BuildableDeviceCallbacks {
19 public: 19 public:
20 virtual ~BuildableDeviceCallbacks() {} 20 virtual ~BuildableDeviceCallbacks() {}
21 // Returns false if no descriptor was found. 21 // Returns false if no descriptor was found.
22 virtual const media::VideoCaptureDeviceDescriptor* LookupDeviceDescriptor( 22 virtual const media::VideoCaptureDeviceDescriptor* LookupDeviceDescriptor(
23 const std::string& id) = 0; 23 const std::string& id) = 0;
24 virtual void WillStartDevice(media::VideoFacingMode facing_mode) = 0; 24 virtual void WillStartDevice(media::VideoFacingMode facing_mode) = 0;
25 virtual void DidStartDevice(VideoCaptureController* controller) = 0; 25 virtual void DidStartDevice(VideoCaptureController* controller) = 0;
26 virtual void OnDeviceStartFailed(VideoCaptureController* controller) = 0; 26 virtual void OnDeviceStartFailed(VideoCaptureController* controller) = 0;
27 virtual void OnDeviceStartAborted() = 0;
27 }; 28 };
28 29
29 // Abstraction for a video capture device that must be "built" before it can be 30 // Abstraction for a video capture device that must be "built" before it can be
30 // operated and must be "stopped", before it can be released. Typical operation 31 // operated and must be "stopped", before it can be released. Typical operation
31 // is that a newly created instance initially reports IsDeviceAlive() == false. 32 // is that a newly created instance initially reports IsDeviceAlive() == false.
32 // Clients call CreateAndStartDeviceAsync(), which kicks off the asynchronous 33 // Clients call CreateAndStartDeviceAsync(), which kicks off the asynchronous
33 // building of the device. The outcome of the device building is typically 34 // building of the device. The outcome of the device building is typically
34 // reported to an instance of BuildableDeviceCallbacks (see above). Once the 35 // reported to an instance of BuildableDeviceCallbacks (see above). Once the
35 // device has been built successfully, the "Device operation methods", are 36 // device has been built successfully, the "Device operation methods", are
36 // allowed to be called. ReleaseDeviceAsync() must be called in order to 37 // allowed to be called. ReleaseDeviceAsync() must be called in order to
37 // release the device if it has before been built successfully. After calling 38 // release the device if it has before been built successfully.
38 // ReleaseDeviceAsync(), it is legal to call CreateAndStartDeviceAsync() to 39 // Clients may call ReleaseDeviceAsync() before a preceding call to
39 // rebuild and start the device again. 40 // CreateAndStartDeviceAsync() has resulted in a callback to OnDeviceStarted()
41 // or OnDeviceStartFailed(). Doing so requests the device startup to be aborted,
42 // and the BuildableVideoCaptureDevice will call OnDeviceStartAborted() to
43 // indicate when the abort is completed.
44 // After calling ReleaseDeviceAsync(), it is legal to call
45 // CreateAndStartDeviceAsync() to rebuild and start the device again.
40 class BuildableVideoCaptureDevice { 46 class BuildableVideoCaptureDevice {
41 public: 47 public:
42 virtual ~BuildableVideoCaptureDevice() {} 48 virtual ~BuildableVideoCaptureDevice() {}
43 49
44 // Device management methods. 50 // Device management methods.
45 virtual void CreateAndStartDeviceAsync( 51 virtual void CreateAndStartDeviceAsync(
46 VideoCaptureController* controller, 52 VideoCaptureController* controller,
47 const media::VideoCaptureParams& params, 53 const media::VideoCaptureParams& params,
48 BuildableDeviceCallbacks* callbacks, 54 BuildableDeviceCallbacks* callbacks,
49 base::OnceClosure done_cb) = 0; 55 base::OnceClosure done_cb) = 0;
(...skipping 15 matching lines...) Expand all
65 virtual void RequestRefreshFrame() = 0; 71 virtual void RequestRefreshFrame() = 0;
66 72
67 // Methods for specific types of devices. 73 // Methods for specific types of devices.
68 virtual void SetDesktopCaptureWindowIdAsync(gfx::NativeViewId window_id, 74 virtual void SetDesktopCaptureWindowIdAsync(gfx::NativeViewId window_id,
69 base::OnceClosure done_cb) = 0; 75 base::OnceClosure done_cb) = 0;
70 }; 76 };
71 77
72 } // namespace content 78 } // namespace content
73 79
74 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_BUILDABLE_VIDEO_CAPTURE_DEVICE_H_ 80 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_BUILDABLE_VIDEO_CAPTURE_DEVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698