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 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_ |
6 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_ | 6 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
17 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 19 #include "content/common/media/media_stream_options.h" |
19 #include "content/common/media/video_capture.h" | 20 #include "content/common/media/video_capture.h" |
20 #include "content/public/renderer/media_stream_video_sink.h" | 21 #include "content/public/renderer/media_stream_video_sink.h" |
21 #include "media/capture/video_capture_types.h" | 22 #include "media/capture/video_capture_types.h" |
22 | 23 |
23 namespace content { | 24 namespace content { |
24 | 25 |
25 class VideoCaptureImpl; | 26 class VideoCaptureImpl; |
26 | 27 |
27 // TODO(hclam): This class should be renamed to VideoCaptureService. | 28 // TODO(hclam): This class should be renamed to VideoCaptureService. |
28 | 29 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // Get supported formats supported by the device for the given session | 84 // Get supported formats supported by the device for the given session |
84 // ID. |callback| will be called on the IO thread. | 85 // ID. |callback| will be called on the IO thread. |
85 void GetDeviceSupportedFormats(media::VideoCaptureSessionId id, | 86 void GetDeviceSupportedFormats(media::VideoCaptureSessionId id, |
86 const VideoCaptureDeviceFormatsCB& callback); | 87 const VideoCaptureDeviceFormatsCB& callback); |
87 | 88 |
88 // Get supported formats currently in use for the given session ID. | 89 // Get supported formats currently in use for the given session ID. |
89 // |callback| will be called on the IO thread. | 90 // |callback| will be called on the IO thread. |
90 void GetDeviceFormatsInUse(media::VideoCaptureSessionId id, | 91 void GetDeviceFormatsInUse(media::VideoCaptureSessionId id, |
91 const VideoCaptureDeviceFormatsCB& callback); | 92 const VideoCaptureDeviceFormatsCB& callback); |
92 | 93 |
93 // Make all existing VideoCaptureImpl instances stop/resume delivering | 94 // Make all VideoCaptureImpl instances in the input |video_device_array| |
94 // video frames to their clients, depends on flag |suspend|. This is called in | 95 // stop/resume delivering video frames to their clients, depends on flag |
95 // response to a RenderView-wide PageHidden/Shown() event. To suspend/resume | 96 // |suspend|. This is called in response to a RenderView-wide |
96 // an individual session, please call Suspend(id) or Resume(id). | 97 // PageHidden/Shown() event. |
97 void SuspendDevices(bool suspend); | 98 // To suspend/resume an individual session, please call Suspend(id) or |
| 99 // Resume(id). |
| 100 void SuspendDevices(const StreamDeviceInfoArray& video_device_array, |
| 101 bool suspend); |
98 | 102 |
99 virtual std::unique_ptr<VideoCaptureImpl> CreateVideoCaptureImplForTesting( | 103 virtual std::unique_ptr<VideoCaptureImpl> CreateVideoCaptureImplForTesting( |
100 media::VideoCaptureSessionId session_id) const; | 104 media::VideoCaptureSessionId session_id) const; |
101 | 105 |
102 private: | 106 private: |
103 // Holds bookkeeping info for each VideoCaptureImpl shared by clients. | 107 // Holds bookkeeping info for each VideoCaptureImpl shared by clients. |
104 struct DeviceEntry; | 108 struct DeviceEntry; |
105 | 109 |
106 void StopCapture(int client_id, media::VideoCaptureSessionId id); | 110 void StopCapture(int client_id, media::VideoCaptureSessionId id); |
107 void UnrefDevice(media::VideoCaptureSessionId id); | 111 void UnrefDevice(media::VideoCaptureSessionId id); |
(...skipping 17 matching lines...) Expand all Loading... |
125 // Bound to the render thread. | 129 // Bound to the render thread. |
126 // NOTE: Weak pointers must be invalidated before all other member variables. | 130 // NOTE: Weak pointers must be invalidated before all other member variables. |
127 base::WeakPtrFactory<VideoCaptureImplManager> weak_factory_; | 131 base::WeakPtrFactory<VideoCaptureImplManager> weak_factory_; |
128 | 132 |
129 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImplManager); | 133 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImplManager); |
130 }; | 134 }; |
131 | 135 |
132 } // namespace content | 136 } // namespace content |
133 | 137 |
134 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_ | 138 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_ |
OLD | NEW |