Chromium Code Reviews| Index: content/browser/renderer_host/media/video_capture_controller.cc |
| diff --git a/content/browser/renderer_host/media/video_capture_controller.cc b/content/browser/renderer_host/media/video_capture_controller.cc |
| index fd098e7f96f081441aaabb8111c6675ad13448ff..a06c30d8f9a6d21850c46b13092f41db4a576593 100644 |
| --- a/content/browser/renderer_host/media/video_capture_controller.cc |
| +++ b/content/browser/renderer_host/media/video_capture_controller.cc |
| @@ -28,6 +28,7 @@ |
| using media::VideoCaptureFormat; |
| using media::VideoFrame; |
| +using media::VideoFrameMetadata; |
| namespace content { |
| @@ -234,7 +235,8 @@ void VideoCaptureController::ReturnBuffer( |
| VideoCaptureControllerID id, |
| VideoCaptureControllerEventHandler* event_handler, |
| int buffer_id, |
| - uint32 sync_point) { |
| + uint32 sync_point, |
| + double consumer_resource_utilization) { |
| DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| ControllerClient* client = FindClient(id, event_handler, controller_clients_); |
| @@ -247,7 +249,25 @@ void VideoCaptureController::ReturnBuffer( |
| NOTREACHED(); |
| return; |
| } |
| + |
| + // Set the RESOURCE_UTILIZATION to the maximum of those provided by each |
|
hubbe
2015/06/04 22:08:53
This comment is confusing me a bit as it seems to
miu
2015/06/06 00:29:22
There are! :) Throughout the VideoCaptureControl
|
| + // consumer. A producer of the VideoFrame may check this value to make |
| + // quality versus performance trade-off decisions. |
| scoped_refptr<VideoFrame> frame = iter->second; |
| + if (std::isfinite(consumer_resource_utilization) && |
| + consumer_resource_utilization >= 0.0) { |
| + double resource_utilization = -1.0; |
| + if (frame->metadata()->GetDouble(VideoFrameMetadata::RESOURCE_UTILIZATION, |
| + &resource_utilization)) { |
| + frame->metadata()->SetDouble(VideoFrameMetadata::RESOURCE_UTILIZATION, |
| + std::max(consumer_resource_utilization, |
| + resource_utilization)); |
| + } else { |
| + frame->metadata()->SetDouble(VideoFrameMetadata::RESOURCE_UTILIZATION, |
| + consumer_resource_utilization); |
| + } |
| + } |
| + |
| client->active_buffers.erase(iter); |
| buffer_pool_->RelinquishConsumerHold(buffer_id, 1); |