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

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

Issue 15906019: Hook up EncodedVideoSource on the browser side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screencast_cl_6
Patch Set: 516738a8 IPC/struct changes, courtesy hshi@ Created 7 years, 6 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 // Implementation notes: This needs to work on a variety of hardware 5 // Implementation notes: This needs to work on a variety of hardware
6 // configurations where the speed of the CPU and GPU greatly affect overall 6 // configurations where the speed of the CPU and GPU greatly affect overall
7 // performance. Spanning several threads, the process of capturing has been 7 // performance. Spanning several threads, the process of capturing has been
8 // split up into four conceptual stages: 8 // split up into four conceptual stages:
9 // 9 //
10 // 1. Reserve Buffer: Before a frame can be captured, a slot in the consumer's 10 // 1. Reserve Buffer: Before a frame can be captured, a slot in the consumer's
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 VideoCaptureOracle::Event event, 419 VideoCaptureOracle::Event event,
420 base::Time event_time, 420 base::Time event_time,
421 scoped_refptr<media::VideoFrame>* storage, 421 scoped_refptr<media::VideoFrame>* storage,
422 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback* callback) { 422 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback* callback) {
423 base::AutoLock guard(lock_); 423 base::AutoLock guard(lock_);
424 424
425 if (!consumer_ || !is_started_) 425 if (!consumer_ || !is_started_)
426 return false; // Capture is stopped. 426 return false; // Capture is stopped.
427 427
428 scoped_refptr<media::VideoFrame> output_buffer = 428 scoped_refptr<media::VideoFrame> output_buffer =
429 consumer_->ReserveOutputBuffer(); 429 consumer_->ReserveOutputVideoFrame();
430 const bool should_capture = 430 const bool should_capture =
431 oracle_->ObserveEventAndDecideCapture(event, event_time); 431 oracle_->ObserveEventAndDecideCapture(event, event_time);
432 const bool content_is_dirty = 432 const bool content_is_dirty =
433 (event == VideoCaptureOracle::kCompositorUpdate || 433 (event == VideoCaptureOracle::kCompositorUpdate ||
434 event == VideoCaptureOracle::kSoftwarePaint); 434 event == VideoCaptureOracle::kSoftwarePaint);
435 const char* event_name = 435 const char* event_name =
436 (event == VideoCaptureOracle::kTimerPoll ? "poll" : 436 (event == VideoCaptureOracle::kTimerPoll ? "poll" :
437 (event == VideoCaptureOracle::kCompositorUpdate ? "gpu" : 437 (event == VideoCaptureOracle::kCompositorUpdate ? "gpu" :
438 "paint")); 438 "paint"));
439 439
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 media::VideoCaptureDevice::Name name; 1240 media::VideoCaptureDevice::Name name;
1241 base::SStringPrintf(&name.device_name, 1241 base::SStringPrintf(&name.device_name,
1242 "WebContents[%.*s]", 1242 "WebContents[%.*s]",
1243 static_cast<int>(device_id.size()), device_id.data()); 1243 static_cast<int>(device_id.size()), device_id.data());
1244 name.unique_id = device_id; 1244 name.unique_id = device_id;
1245 1245
1246 return new WebContentsVideoCaptureDevice( 1246 return new WebContentsVideoCaptureDevice(
1247 name, render_process_id, render_view_id); 1247 name, render_process_id, render_view_id);
1248 } 1248 }
1249 1249
1250 media::VideoEncodingCapabilities
1251 WebContentsVideoCaptureDevice::GetEncodingCapabilities() {
1252 return media::VideoEncodingCapabilities();
1253 }
1254
1255 void WebContentsVideoCaptureDevice::TryConfigureEncodedBitstream(
1256 const media::RuntimeVideoEncodingParameters& params) {
1257 }
1258
1250 void WebContentsVideoCaptureDevice::Allocate( 1259 void WebContentsVideoCaptureDevice::Allocate(
1251 int width, int height, int frame_rate, 1260 int width, int height, int frame_rate,
1252 VideoCaptureDevice::EventHandler* consumer) { 1261 VideoCaptureDevice::EventHandler* consumer) {
1253 impl_->Allocate(width, height, frame_rate, consumer); 1262 impl_->Allocate(width, height, frame_rate, consumer);
1254 } 1263 }
1255 1264
1256 void WebContentsVideoCaptureDevice::Start() { 1265 void WebContentsVideoCaptureDevice::Start() {
1257 impl_->Start(); 1266 impl_->Start();
1258 } 1267 }
1259 1268
1260 void WebContentsVideoCaptureDevice::Stop() { 1269 void WebContentsVideoCaptureDevice::Stop() {
1261 impl_->Stop(); 1270 impl_->Stop();
1262 } 1271 }
1263 1272
1264 void WebContentsVideoCaptureDevice::DeAllocate() { 1273 void WebContentsVideoCaptureDevice::DeAllocate() {
1265 impl_->DeAllocate(); 1274 impl_->DeAllocate();
1266 } 1275 }
1267 1276
1268 const media::VideoCaptureDevice::Name& 1277 const media::VideoCaptureDevice::Name&
1269 WebContentsVideoCaptureDevice::device_name() { 1278 WebContentsVideoCaptureDevice::device_name() {
1270 return device_name_; 1279 return device_name_;
1271 } 1280 }
1272 1281
1273 } // namespace content 1282 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698