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 // VideoCaptureHost serves video capture related messages from | 5 // VideoCaptureHost serves video capture related messages from |
6 // VideoCaptureMessageFilter which lives inside the render process. | 6 // VideoCaptureMessageFilter which lives inside the render process. |
7 // | 7 // |
8 // This class is owned by RenderProcessHostImpl, and instantiated on UI | 8 // This class is owned by RenderProcessHostImpl, and instantiated on UI |
9 // thread, but all other operations and method calls happen on IO thread. | 9 // thread, but all other operations and method calls happen on IO thread. |
10 // | 10 // |
11 // Here's an example of a typical IPC dialog for video capture: | 11 // Here's an example of a typical IPC dialog for video capture: |
12 // | 12 // |
13 // Renderer VideoCaptureHost | 13 // Renderer VideoCaptureHost |
14 // | | | 14 // | | |
15 // | VideoCaptureHostMsg_Start > | | 15 // | --------- StartCapture --------> | |
16 // | < VideoCaptureMsg_StateChanged | | 16 // | < VideoCaptureMsg_StateChanged | |
17 // | (VIDEO_CAPTURE_STATE_STARTED) | | 17 // | (VIDEO_CAPTURE_STATE_STARTED) | |
18 // | < VideoCaptureMsg_NewBuffer(1) | | 18 // | < VideoCaptureMsg_NewBuffer(1) | |
19 // | < VideoCaptureMsg_NewBuffer(2) | | 19 // | < VideoCaptureMsg_NewBuffer(2) | |
20 // | < VideoCaptureMsg_NewBuffer(3) | | 20 // | < VideoCaptureMsg_NewBuffer(3) | |
21 // | | | 21 // | | |
22 // | < VideoCaptureMsg_BufferReady(1) | | 22 // | < VideoCaptureMsg_BufferReady(1) | |
23 // | < VideoCaptureMsg_BufferReady(2) | | 23 // | < VideoCaptureMsg_BufferReady(2) | |
24 // | VideoCaptureHostMsg_BufferReady(1) > | | 24 // | VideoCaptureHostMsg_BufferReady(1) > | |
25 // | < VideoCaptureMsg_BufferReady(3) | | 25 // | < VideoCaptureMsg_BufferReady(3) | |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 friend class base::DeleteHelper<VideoCaptureHost>; | 103 friend class base::DeleteHelper<VideoCaptureHost>; |
104 friend class MockVideoCaptureHost; | 104 friend class MockVideoCaptureHost; |
105 friend class VideoCaptureHostTest; | 105 friend class VideoCaptureHostTest; |
106 | 106 |
107 void DoError(VideoCaptureControllerID id); | 107 void DoError(VideoCaptureControllerID id); |
108 void DoEnded(VideoCaptureControllerID id); | 108 void DoEnded(VideoCaptureControllerID id); |
109 | 109 |
110 ~VideoCaptureHost() override; | 110 ~VideoCaptureHost() override; |
111 | 111 |
112 // IPC message handlers. | 112 // IPC message handlers. |
113 void OnStartCapture(int device_id, | |
114 media::VideoCaptureSessionId session_id, | |
115 const media::VideoCaptureParams& params); | |
116 void OnResumeCapture(int device_id, | |
117 media::VideoCaptureSessionId session_id, | |
118 const media::VideoCaptureParams& params); | |
119 void OnRendererFinishedWithBuffer(int device_id, | 113 void OnRendererFinishedWithBuffer(int device_id, |
120 int buffer_id, | 114 int buffer_id, |
121 const gpu::SyncToken& sync_token, | 115 const gpu::SyncToken& sync_token, |
122 double consumer_resource_utilization); | 116 double consumer_resource_utilization); |
123 void OnGetDeviceSupportedFormats( | 117 void OnGetDeviceSupportedFormats( |
124 int device_id, | 118 int device_id, |
125 media::VideoCaptureSessionId capture_session_id); | 119 media::VideoCaptureSessionId capture_session_id); |
126 void OnGetDeviceFormatsInUse(int device_id, | 120 void OnGetDeviceFormatsInUse(int device_id, |
127 media::VideoCaptureSessionId capture_session_id); | 121 media::VideoCaptureSessionId capture_session_id); |
128 | 122 |
129 // mojom::VideoCaptureHost implementation | 123 // mojom::VideoCaptureHost implementation |
| 124 void Start(int32_t device_id, |
| 125 int32_t session_id, |
| 126 const media::VideoCaptureParams& params) override; |
130 void Stop(int32_t device_id) override; | 127 void Stop(int32_t device_id) override; |
131 void Pause(int32_t device_id) override; | 128 void Pause(int32_t device_id) override; |
| 129 void Resume(int32_t device_id, |
| 130 int32_t session_id, |
| 131 const media::VideoCaptureParams& params) override; |
132 void RequestRefreshFrame(int32_t device_id) override; | 132 void RequestRefreshFrame(int32_t device_id) override; |
133 | 133 |
134 void OnControllerAdded( | 134 void OnControllerAdded( |
135 int device_id, | 135 int device_id, |
136 const base::WeakPtr<VideoCaptureController>& controller); | 136 const base::WeakPtr<VideoCaptureController>& controller); |
137 | 137 |
138 // Deletes the controller and notifies the VideoCaptureManager. |on_error| is | 138 // Deletes the controller and notifies the VideoCaptureManager. |on_error| is |
139 // true if this is triggered by VideoCaptureControllerEventHandler::OnError. | 139 // true if this is triggered by VideoCaptureControllerEventHandler::OnError. |
140 void DeleteVideoCaptureController(VideoCaptureControllerID controller_id, | 140 void DeleteVideoCaptureController(VideoCaptureControllerID controller_id, |
141 bool on_error); | 141 bool on_error); |
142 | 142 |
143 MediaStreamManager* const media_stream_manager_; | 143 MediaStreamManager* const media_stream_manager_; |
144 | 144 |
145 // A map of VideoCaptureControllerID to the VideoCaptureController to which it | 145 // A map of VideoCaptureControllerID to the VideoCaptureController to which it |
146 // is connected. An entry in this map holds a null controller while it is in | 146 // is connected. An entry in this map holds a null controller while it is in |
147 // the process of starting. | 147 // the process of starting. |
148 std::map<VideoCaptureControllerID, base::WeakPtr<VideoCaptureController>> | 148 std::map<VideoCaptureControllerID, base::WeakPtr<VideoCaptureController>> |
149 controllers_; | 149 controllers_; |
150 | 150 |
151 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); | 151 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); |
152 }; | 152 }; |
153 | 153 |
154 } // namespace content | 154 } // namespace content |
155 | 155 |
156 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ | 156 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ |
OLD | NEW |