Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
|
tommi (sloooow) - chröme
2013/03/21 14:48:05
2012
| |
| 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 "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "content/browser/browser_main_loop.h" | 10 #include "content/browser/browser_main_loop.h" |
| 11 #include "content/browser/renderer_host/media/media_stream_manager.h" | 11 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 12 #include "content/browser/renderer_host/media/video_capture_manager.h" | 12 #include "content/browser/renderer_host/media/video_capture_manager.h" |
| 13 #include "content/common/media/encoded_video_source_messages.h" | |
| 13 #include "content/common/media/video_capture_messages.h" | 14 #include "content/common/media/video_capture_messages.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 | 17 |
| 17 struct VideoCaptureHost::Entry { | 18 struct VideoCaptureHost::Entry { |
| 18 Entry(VideoCaptureController* controller) | 19 Entry(VideoCaptureController* controller) |
| 19 : controller(controller) {} | 20 : controller(controller) {} |
| 20 | 21 |
| 21 ~Entry() {} | 22 ~Entry() {} |
| 22 | 23 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 /////////////////////////////////////////////////////////////////////////////// | 165 /////////////////////////////////////////////////////////////////////////////// |
| 165 // IPC Messages handler. | 166 // IPC Messages handler. |
| 166 bool VideoCaptureHost::OnMessageReceived(const IPC::Message& message, | 167 bool VideoCaptureHost::OnMessageReceived(const IPC::Message& message, |
| 167 bool* message_was_ok) { | 168 bool* message_was_ok) { |
| 168 bool handled = true; | 169 bool handled = true; |
| 169 IPC_BEGIN_MESSAGE_MAP_EX(VideoCaptureHost, message, *message_was_ok) | 170 IPC_BEGIN_MESSAGE_MAP_EX(VideoCaptureHost, message, *message_was_ok) |
| 170 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Start, OnStartCapture) | 171 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Start, OnStartCapture) |
| 171 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Pause, OnPauseCapture) | 172 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Pause, OnPauseCapture) |
| 172 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Stop, OnStopCapture) | 173 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Stop, OnStopCapture) |
| 173 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_BufferReady, OnReceiveEmptyBuffer) | 174 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_BufferReady, OnReceiveEmptyBuffer) |
| 175 // Messages for encoding support | |
| 176 IPC_MESSAGE_HANDLER(EncodedVideoSourceHostMsg_CreateBitstream, | |
| 177 OnCreateBitstream) | |
| 178 IPC_MESSAGE_HANDLER(EncodedVideoSourceHostMsg_BitstreamBufferConsumed, | |
| 179 OnBitstreamBufferConsumed) | |
| 180 IPC_MESSAGE_HANDLER(EncodedVideoSourceHostMsg_DestroyBitstream, | |
| 181 OnDestroyBitstream) | |
| 182 IPC_MESSAGE_HANDLER(EncodedVideoSourceHostMsg_TryConfigureBitstream, | |
| 183 OnTryConfigureBitstream) | |
| 184 IPC_MESSAGE_HANDLER(EncodedVideoSourceHostMsg_RequestSpecialFrame, | |
| 185 OnRequestSpecialFrame) | |
| 174 IPC_MESSAGE_UNHANDLED(handled = false) | 186 IPC_MESSAGE_UNHANDLED(handled = false) |
| 175 IPC_END_MESSAGE_MAP_EX() | 187 IPC_END_MESSAGE_MAP_EX() |
| 176 | 188 |
| 177 return handled; | 189 return handled; |
| 178 } | 190 } |
| 179 | 191 |
| 180 void VideoCaptureHost::OnStartCapture(int device_id, | 192 void VideoCaptureHost::OnStartCapture(int device_id, |
| 181 const media::VideoCaptureParams& params) { | 193 const media::VideoCaptureParams& params) { |
| 182 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 194 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 183 DVLOG(1) << "VideoCaptureHost::OnStartCapture, device_id " << device_id | 195 DVLOG(1) << "VideoCaptureHost::OnStartCapture, device_id " << device_id |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 } | 284 } |
| 273 delete it->second; | 285 delete it->second; |
| 274 entries_.erase(controller_id); | 286 entries_.erase(controller_id); |
| 275 } | 287 } |
| 276 | 288 |
| 277 VideoCaptureManager* VideoCaptureHost::GetVideoCaptureManager() { | 289 VideoCaptureManager* VideoCaptureHost::GetVideoCaptureManager() { |
| 278 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 290 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 279 return BrowserMainLoop::GetMediaStreamManager()->video_capture_manager(); | 291 return BrowserMainLoop::GetMediaStreamManager()->video_capture_manager(); |
| 280 } | 292 } |
| 281 | 293 |
| 294 void VideoCaptureHost::OnCreateBitstream( | |
| 295 int device_id, int stream_id, media::VideoEncodingParameters params) { | |
| 296 // TODO(vmr): Implementation and security review. | |
| 297 } | |
| 298 | |
| 299 void VideoCaptureHost::OnBitstreamBufferConsumed(int device_id, | |
| 300 int stream_id, | |
| 301 int buffer_id) { | |
| 302 // TODO(vmr): Implementation and security review. | |
| 303 } | |
| 304 | |
| 305 void VideoCaptureHost::OnDestroyBitstream(int device_id, int stream_id) { | |
| 306 // TODO(vmr): Implementation and security review. | |
| 307 } | |
| 308 | |
| 309 void VideoCaptureHost::OnTryConfigureBitstream( | |
| 310 int device_id, | |
| 311 int stream_id, | |
| 312 media::RuntimeVideoEncodingParameters params) { | |
| 313 // TODO(vmr): Implementation and security review. | |
| 314 } | |
| 315 | |
| 316 void VideoCaptureHost::OnRequestSpecialFrame(int device_id, | |
| 317 int stream_id, | |
| 318 int flags) { | |
| 319 // TODO(vmr): Implementation and security review. | |
| 320 } | |
| 321 | |
| 282 } // namespace content | 322 } // namespace content |
| OLD | NEW |