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 #include "content/browser/renderer_host/media/video_capture_host.h" | 5 #include "content/browser/renderer_host/media/video_capture_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "content/browser/browser_main_loop.h" | 9 #include "content/browser/browser_main_loop.h" |
10 #include "content/browser/renderer_host/media/media_stream_manager.h" | 10 #include "content/browser/renderer_host/media/media_stream_manager.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 if (entries_.find(controller_id) == entries_.end()) | 187 if (entries_.find(controller_id) == entries_.end()) |
188 return; | 188 return; |
189 | 189 |
190 Send(new VideoCaptureMsg_StateChanged(controller_id.device_id, | 190 Send(new VideoCaptureMsg_StateChanged(controller_id.device_id, |
191 VIDEO_CAPTURE_STATE_ENDED)); | 191 VIDEO_CAPTURE_STATE_ENDED)); |
192 DeleteVideoCaptureControllerOnIOThread(controller_id, false); | 192 DeleteVideoCaptureControllerOnIOThread(controller_id, false); |
193 } | 193 } |
194 | 194 |
195 /////////////////////////////////////////////////////////////////////////////// | 195 /////////////////////////////////////////////////////////////////////////////// |
196 // IPC Messages handler. | 196 // IPC Messages handler. |
197 bool VideoCaptureHost::OnMessageReceived(const IPC::Message& message, | 197 bool VideoCaptureHost::OnMessageReceived(const IPC::Message& message) { |
198 bool* message_was_ok) { | |
199 bool handled = true; | 198 bool handled = true; |
200 IPC_BEGIN_MESSAGE_MAP_EX(VideoCaptureHost, message, *message_was_ok) | 199 IPC_BEGIN_MESSAGE_MAP(VideoCaptureHost, message) |
201 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Start, OnStartCapture) | 200 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Start, OnStartCapture) |
202 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Pause, OnPauseCapture) | 201 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Pause, OnPauseCapture) |
203 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Stop, OnStopCapture) | 202 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Stop, OnStopCapture) |
204 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_BufferReady, OnReceiveEmptyBuffer) | 203 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_BufferReady, OnReceiveEmptyBuffer) |
205 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_GetDeviceSupportedFormats, | 204 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_GetDeviceSupportedFormats, |
206 OnGetDeviceSupportedFormats) | 205 OnGetDeviceSupportedFormats) |
207 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_GetDeviceFormatsInUse, | 206 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_GetDeviceFormatsInUse, |
208 OnGetDeviceFormatsInUse) | 207 OnGetDeviceFormatsInUse) |
209 IPC_MESSAGE_UNHANDLED(handled = false) | 208 IPC_MESSAGE_UNHANDLED(handled = false) |
210 IPC_END_MESSAGE_MAP_EX() | 209 IPC_END_MESSAGE_MAP() |
211 | 210 |
212 return handled; | 211 return handled; |
213 } | 212 } |
214 | 213 |
215 void VideoCaptureHost::OnStartCapture(int device_id, | 214 void VideoCaptureHost::OnStartCapture(int device_id, |
216 media::VideoCaptureSessionId session_id, | 215 media::VideoCaptureSessionId session_id, |
217 const media::VideoCaptureParams& params) { | 216 const media::VideoCaptureParams& params) { |
218 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 217 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
219 DVLOG(1) << "VideoCaptureHost::OnStartCapture:" | 218 DVLOG(1) << "VideoCaptureHost::OnStartCapture:" |
220 << " session_id=" << session_id | 219 << " session_id=" << session_id |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 return; | 352 return; |
354 | 353 |
355 if (it->second) { | 354 if (it->second) { |
356 media_stream_manager_->video_capture_manager()->StopCaptureForClient( | 355 media_stream_manager_->video_capture_manager()->StopCaptureForClient( |
357 it->second.get(), controller_id, this, on_error); | 356 it->second.get(), controller_id, this, on_error); |
358 } | 357 } |
359 entries_.erase(it); | 358 entries_.erase(it); |
360 } | 359 } |
361 | 360 |
362 } // namespace content | 361 } // namespace content |
OLD | NEW |