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

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: 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/browser/renderer_host/media/ownership.h" 10 #include "content/browser/renderer_host/media/ownership.h"
11 #include "content/public/common/media_stream_request.h" 11 #include "content/public/common/media_stream_request.h"
12 #include "media/capture/video/video_capture_device.h" 12 #include "media/capture/video/video_capture_device.h"
13 #include "media/capture/video_capture_types.h" 13 #include "media/capture/video_capture_types.h"
14 14
15 namespace content { 15 namespace content {
16 16
17 class VideoCaptureController; 17 class VideoCaptureController;
18 18
19 class CONTENT_EXPORT BuildableDeviceCallbacks { 19 class CONTENT_EXPORT BuildableDeviceCallbacks {
20 public: 20 public:
21 virtual ~BuildableDeviceCallbacks() {} 21 virtual ~BuildableDeviceCallbacks() {}
22 // Returns false if no descriptor was found. 22 // Returns false if no descriptor was found.
23 virtual const media::VideoCaptureDeviceDescriptor* LookupDeviceDescriptor( 23 virtual const media::VideoCaptureDeviceDescriptor* LookupDeviceDescriptor(
24 const std::string& id) = 0; 24 const std::string& id) = 0;
25 virtual void WillStartDevice(media::VideoFacingMode facing_mode) = 0; 25 virtual void WillStartDevice(media::VideoFacingMode facing_mode) = 0;
26 virtual void DidStartDevice(VideoCaptureController* entry) = 0; 26 virtual void DidStartDevice(VideoCaptureController* entry) = 0;
27 virtual void OnDeviceStartFailed(VideoCaptureController* entry) = 0; 27 virtual void OnDeviceStartFailed(VideoCaptureController* entry) = 0;
28 virtual void OnDeviceStartAborted() = 0;
28 }; 29 };
29 30
30 // Abstraction for a video capture device that must be "built" before it can be 31 // Abstraction for a video capture device that must be "built" before it can be
31 // operated and must be "stopped", before it can be released. Typical operation 32 // operated and must be "stopped", before it can be released. Typical operation
32 // is that a newly created instance initially reports IsDeviceAlive() == false. 33 // is that a newly created instance initially reports IsDeviceAlive() == false.
33 // Clients call CreateAndStartDeviceAsync(), which kicks off the asynchronous 34 // Clients call CreateAndStartDeviceAsync(), which kicks off the asynchronous
34 // building of the device. The outcome of the device building is typically 35 // building of the device. The outcome of the device building is typically
35 // reported to an instance of BuildableDeviceCallbacks (see above). Once the 36 // reported to an instance of BuildableDeviceCallbacks (see above). Once the
36 // device has been built successfully, the "Device operation methods", are 37 // device has been built successfully, the "Device operation methods", are
37 // allowed to be called. ReleaseDeviceAsync() must be called in order to 38 // allowed to be called. ReleaseDeviceAsync() must be called in order to
38 // release the device if it has before been built successfully. After calling 39 // release the device if it has before been built successfully.
39 // ReleaseDeviceAsync(), it is legal to call CreateAndStartDeviceAsync() to 40 // Clients may call ReleaseDeviceAsync() before a preceding call to
40 // rebuild and start the device again. 41 // CreateAndStartDeviceAsync() has resulted in a callback to OnDeviceStarted()
42 // or OnDeviceStartFailed(). Doing so requests the device startup to be aborted,
43 // and the BuildableVideoCaptureDevice will call OnDeviceStartAborted() to
44 // indicate when the abort is completed.
45 // After calling ReleaseDeviceAsync(), it is legal to call
46 // CreateAndStartDeviceAsync() to rebuild and start the device again.
41 class BuildableVideoCaptureDevice { 47 class BuildableVideoCaptureDevice {
42 public: 48 public:
43 virtual ~BuildableVideoCaptureDevice() {} 49 virtual ~BuildableVideoCaptureDevice() {}
44 50
45 // Device management methods. 51 // Device management methods.
46 // The passed-in |context_reference| must guarantee that the context relevant 52 // The passed-in |context_reference| must guarantee that the context relevant
47 // during the asynchronous processing stays alive. 53 // during the asynchronous processing stays alive.
48 virtual void CreateAndStartDeviceAsync( 54 virtual void CreateAndStartDeviceAsync(
49 VideoCaptureController* controller, 55 VideoCaptureController* controller,
50 const media::VideoCaptureParams& params, 56 const media::VideoCaptureParams& params,
(...skipping 23 matching lines...) Expand all
74 // The passed-in |context_reference| must guarantee that the context relevant 80 // The passed-in |context_reference| must guarantee that the context relevant
75 // during the asynchronous processing stays alive. 81 // during the asynchronous processing stays alive.
76 virtual void SetDesktopCaptureWindowIdAsync( 82 virtual void SetDesktopCaptureWindowIdAsync(
77 gfx::NativeViewId window_id, 83 gfx::NativeViewId window_id,
78 std::unique_ptr<Ownership> context_reference) = 0; 84 std::unique_ptr<Ownership> context_reference) = 0;
79 }; 85 };
80 86
81 } // namespace content 87 } // namespace content
82 88
83 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_BUILDABLE_VIDEO_CAPTURE_DEVICE_H_ 89 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_BUILDABLE_VIDEO_CAPTURE_DEVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698