| 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/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "content/browser/browser_main_loop.h" | 10 #include "content/browser/browser_main_loop.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 // IPC Messages handler. | 143 // IPC Messages handler. |
| 144 bool VideoCaptureHost::OnMessageReceived(const IPC::Message& message) { | 144 bool VideoCaptureHost::OnMessageReceived(const IPC::Message& message) { |
| 145 bool handled = true; | 145 bool handled = true; |
| 146 IPC_BEGIN_MESSAGE_MAP(VideoCaptureHost, message) | 146 IPC_BEGIN_MESSAGE_MAP(VideoCaptureHost, message) |
| 147 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Start, OnStartCapture) | 147 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Start, OnStartCapture) |
| 148 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Pause, OnPauseCapture) | 148 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Pause, OnPauseCapture) |
| 149 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Resume, OnResumeCapture) | 149 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Resume, OnResumeCapture) |
| 150 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_RequestRefreshFrame, | 150 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_RequestRefreshFrame, |
| 151 OnRequestRefreshFrame) | 151 OnRequestRefreshFrame) |
| 152 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Stop, OnStopCapture) | 152 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Stop, OnStopCapture) |
| 153 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_SetCapturingLinkSecured, |
| 154 OnSetCapturingLinkSecured) |
| 153 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_BufferReady, | 155 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_BufferReady, |
| 154 OnRendererFinishedWithBuffer) | 156 OnRendererFinishedWithBuffer) |
| 155 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_GetDeviceSupportedFormats, | 157 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_GetDeviceSupportedFormats, |
| 156 OnGetDeviceSupportedFormats) | 158 OnGetDeviceSupportedFormats) |
| 157 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_GetDeviceFormatsInUse, | 159 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_GetDeviceFormatsInUse, |
| 158 OnGetDeviceFormatsInUse) | 160 OnGetDeviceFormatsInUse) |
| 159 IPC_MESSAGE_UNHANDLED(handled = false) | 161 IPC_MESSAGE_UNHANDLED(handled = false) |
| 160 IPC_END_MESSAGE_MAP() | 162 IPC_END_MESSAGE_MAP() |
| 161 | 163 |
| 162 return handled; | 164 return handled; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 EntryMap::iterator it = entries_.find(controller_id); | 275 EntryMap::iterator it = entries_.find(controller_id); |
| 274 if (it == entries_.end()) | 276 if (it == entries_.end()) |
| 275 return; | 277 return; |
| 276 | 278 |
| 277 if (VideoCaptureController* controller = it->second.get()) { | 279 if (VideoCaptureController* controller = it->second.get()) { |
| 278 media_stream_manager_->video_capture_manager() | 280 media_stream_manager_->video_capture_manager() |
| 279 ->RequestRefreshFrameForClient(controller); | 281 ->RequestRefreshFrameForClient(controller); |
| 280 } | 282 } |
| 281 } | 283 } |
| 282 | 284 |
| 285 void VideoCaptureHost::OnSetCapturingLinkSecured(int device_id, |
| 286 bool is_secure) { |
| 287 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 288 VideoCaptureControllerID controller_id(device_id); |
| 289 EntryMap::iterator it = entries_.find(controller_id); |
| 290 if (it == entries_.end()) |
| 291 return; |
| 292 |
| 293 media_stream_manager_->SetCapturingLinkSecured(is_secure); |
| 294 } |
| 295 |
| 283 void VideoCaptureHost::OnRendererFinishedWithBuffer( | 296 void VideoCaptureHost::OnRendererFinishedWithBuffer( |
| 284 int device_id, | 297 int device_id, |
| 285 int buffer_id, | 298 int buffer_id, |
| 286 const gpu::SyncToken& sync_token, | 299 const gpu::SyncToken& sync_token, |
| 287 double consumer_resource_utilization) { | 300 double consumer_resource_utilization) { |
| 288 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 301 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 289 | 302 |
| 290 VideoCaptureControllerID controller_id(device_id); | 303 VideoCaptureControllerID controller_id(device_id); |
| 291 EntryMap::iterator it = entries_.find(controller_id); | 304 EntryMap::iterator it = entries_.find(controller_id); |
| 292 if (it != entries_.end()) { | 305 if (it != entries_.end()) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 return; | 354 return; |
| 342 | 355 |
| 343 if (it->second) { | 356 if (it->second) { |
| 344 media_stream_manager_->video_capture_manager()->StopCaptureForClient( | 357 media_stream_manager_->video_capture_manager()->StopCaptureForClient( |
| 345 it->second.get(), controller_id, this, on_error); | 358 it->second.get(), controller_id, this, on_error); |
| 346 } | 359 } |
| 347 entries_.erase(it); | 360 entries_.erase(it); |
| 348 } | 361 } |
| 349 | 362 |
| 350 } // namespace content | 363 } // namespace content |
| OLD | NEW |