Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: content/browser/renderer_host/media/video_capture_host.cc

Issue 1849003002: Add video frame refresh to MediaStream and VideoCapture stacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nick's PS3 comments (moving non-observer impl out of MSVideoSink interface). Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 140 }
141 141
142 /////////////////////////////////////////////////////////////////////////////// 142 ///////////////////////////////////////////////////////////////////////////////
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,
151 OnRequestRefreshFrame)
150 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Stop, OnStopCapture) 152 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Stop, OnStopCapture)
151 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_BufferReady, 153 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_BufferReady,
152 OnRendererFinishedWithBuffer) 154 OnRendererFinishedWithBuffer)
153 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_GetDeviceSupportedFormats, 155 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_GetDeviceSupportedFormats,
154 OnGetDeviceSupportedFormats) 156 OnGetDeviceSupportedFormats)
155 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_GetDeviceFormatsInUse, 157 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_GetDeviceFormatsInUse,
156 OnGetDeviceFormatsInUse) 158 OnGetDeviceFormatsInUse)
157 IPC_MESSAGE_UNHANDLED(handled = false) 159 IPC_MESSAGE_UNHANDLED(handled = false)
158 IPC_END_MESSAGE_MAP() 160 IPC_END_MESSAGE_MAP()
159 161
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 EntryMap::iterator it = entries_.find(controller_id); 257 EntryMap::iterator it = entries_.find(controller_id);
256 if (it == entries_.end()) 258 if (it == entries_.end())
257 return; 259 return;
258 260
259 if (it->second) { 261 if (it->second) {
260 media_stream_manager_->video_capture_manager()->ResumeCaptureForClient( 262 media_stream_manager_->video_capture_manager()->ResumeCaptureForClient(
261 session_id, params, it->second.get(), controller_id, this); 263 session_id, params, it->second.get(), controller_id, this);
262 } 264 }
263 } 265 }
264 266
267 void VideoCaptureHost::OnRequestRefreshFrame(int device_id) {
268 DCHECK_CURRENTLY_ON(BrowserThread::IO);
269 DVLOG(1) << "VideoCaptureHost::OnRequestRefreshFrame, device_id "
270 << device_id;
271
272 VideoCaptureControllerID controller_id(device_id);
273 EntryMap::iterator it = entries_.find(controller_id);
274 if (it == entries_.end())
275 return;
276
277 if (VideoCaptureController* controller = it->second.get()) {
278 media_stream_manager_->video_capture_manager()
279 ->RequestRefreshFrameForClient(controller);
280 }
281 }
282
265 void VideoCaptureHost::OnRendererFinishedWithBuffer( 283 void VideoCaptureHost::OnRendererFinishedWithBuffer(
266 int device_id, 284 int device_id,
267 int buffer_id, 285 int buffer_id,
268 const gpu::SyncToken& sync_token, 286 const gpu::SyncToken& sync_token,
269 double consumer_resource_utilization) { 287 double consumer_resource_utilization) {
270 DCHECK_CURRENTLY_ON(BrowserThread::IO); 288 DCHECK_CURRENTLY_ON(BrowserThread::IO);
271 289
272 VideoCaptureControllerID controller_id(device_id); 290 VideoCaptureControllerID controller_id(device_id);
273 EntryMap::iterator it = entries_.find(controller_id); 291 EntryMap::iterator it = entries_.find(controller_id);
274 if (it != entries_.end()) { 292 if (it != entries_.end()) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 return; 341 return;
324 342
325 if (it->second) { 343 if (it->second) {
326 media_stream_manager_->video_capture_manager()->StopCaptureForClient( 344 media_stream_manager_->video_capture_manager()->StopCaptureForClient(
327 it->second.get(), controller_id, this, on_error); 345 it->second.get(), controller_id, this, on_error);
328 } 346 }
329 entries_.erase(it); 347 entries_.erase(it);
330 } 348 }
331 349
332 } // namespace content 350 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/video_capture_host.h ('k') | content/browser/renderer_host/media/video_capture_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698