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

Unified Diff: content/browser/renderer_host/media/video_capture_controller.cc

Issue 1157193002: RESOURCE_UTILIZATION in VideoFrameMetadata, a consumer feedback signal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@video_frame_done_callback
Patch Set: Addressed hubbe's round 2 comments, and REBASE. Created 5 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 side-by-side diff with in-line comments
Download patch
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..bd7b05b472b949976209c3fecf0aa06ebd00d739 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,27 @@ void VideoCaptureController::ReturnBuffer(
NOTREACHED();
return;
}
+
+ // Set the RESOURCE_UTILIZATION to the maximum of those provided by each
+ // consumer (via separate calls to this method that refer to the same
+ // VideoFrame). The producer of this VideoFrame may check this value, after
+ // all consumer holds are relinquished, 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);

Powered by Google App Engine
This is Rietveld 408576698