| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // VideoCaptureManager is used to open/close, start/stop, enumerate available | 5 // VideoCaptureManager is used to open/close, start/stop, enumerate available |
| 6 // video capture devices, and manage VideoCaptureController's. | 6 // video capture devices, and manage VideoCaptureController's. |
| 7 // All functions are expected to be called from Browser::IO thread. Some helper | 7 // All functions are expected to be called from Browser::IO thread. Some helper |
| 8 // functions (*OnDeviceThread) will dispatch operations to the device thread. | 8 // functions (*OnDeviceThread) will dispatch operations to the device thread. |
| 9 // VideoCaptureManager will open OS dependent instances of VideoCaptureDevice. | 9 // VideoCaptureManager will open OS dependent instances of VideoCaptureDevice. |
| 10 // A device can only be opened once. | 10 // A device can only be opened once. |
| 11 | 11 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 // VideoCaptureManager opens/closes and start/stops video capture devices. | 44 // VideoCaptureManager opens/closes and start/stops video capture devices. |
| 45 class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { | 45 class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
| 46 public: | 46 public: |
| 47 using VideoCaptureDevice = media::VideoCaptureDevice; | 47 using VideoCaptureDevice = media::VideoCaptureDevice; |
| 48 | 48 |
| 49 // Callback used to signal the completion of a controller lookup. | 49 // Callback used to signal the completion of a controller lookup. |
| 50 using DoneCB = | 50 using DoneCB = |
| 51 base::Callback<void(const base::WeakPtr<VideoCaptureController>&)>; | 51 base::Callback<void(const base::WeakPtr<VideoCaptureController>&)>; |
| 52 | 52 |
| 53 explicit VideoCaptureManager( | 53 VideoCaptureManager( |
| 54 std::unique_ptr<media::VideoCaptureDeviceFactory> factory); | 54 std::unique_ptr<media::VideoCaptureDeviceFactory> factory, |
| 55 | 55 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner); |
| 56 void Unregister(); | |
| 57 | 56 |
| 58 // Implements MediaStreamProvider. | 57 // Implements MediaStreamProvider. |
| 59 void Register(MediaStreamProviderListener* listener, | 58 void RegisterListener(MediaStreamProviderListener* listener) override; |
| 60 const scoped_refptr<base::SingleThreadTaskRunner>& | 59 void UnregisterListener() override; |
| 61 device_task_runner) override; | |
| 62 int Open(const StreamDeviceInfo& device) override; | 60 int Open(const StreamDeviceInfo& device) override; |
| 63 void Close(int capture_session_id) override; | 61 void Close(int capture_session_id) override; |
| 64 | 62 |
| 65 // Called by VideoCaptureHost to locate a capture device for |capture_params|, | 63 // Called by VideoCaptureHost to locate a capture device for |capture_params|, |
| 66 // adding the Host as a client of the device's controller if successful. The | 64 // adding the Host as a client of the device's controller if successful. The |
| 67 // value of |session_id| controls which device is selected; | 65 // value of |session_id| controls which device is selected; |
| 68 // this value should be a session id previously returned by Open(). | 66 // this value should be a session id previously returned by Open(). |
| 69 // | 67 // |
| 70 // If the device is not already started (i.e., no other client is currently | 68 // If the device is not already started (i.e., no other client is currently |
| 71 // capturing from this device), this call will cause a VideoCaptureController | 69 // capturing from this device), this call will cause a VideoCaptureController |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 // Map used by DesktopCapture. | 353 // Map used by DesktopCapture. |
| 356 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> | 354 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> |
| 357 notification_window_ids_; | 355 notification_window_ids_; |
| 358 | 356 |
| 359 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); | 357 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); |
| 360 }; | 358 }; |
| 361 | 359 |
| 362 } // namespace content | 360 } // namespace content |
| 363 | 361 |
| 364 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ | 362 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ |
| OLD | NEW |