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

Unified Diff: media/capture/content/thread_safe_capture_oracle.cc

Issue 2518143004: [Mojo Video Capture] Replace RESOURCE_UTILIZATION with interface ReceiverLoadObserver (Closed)
Patch Set: Fix for android-only code Created 4 years 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
« no previous file with comments | « media/capture/content/thread_safe_capture_oracle.h ('k') | media/capture/content/video_capture_oracle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/capture/content/thread_safe_capture_oracle.cc
diff --git a/media/capture/content/thread_safe_capture_oracle.cc b/media/capture/content/thread_safe_capture_oracle.cc
index c406396eea8e57d70ce35ccab6d4e8e379a08490..9fc8f93b0f7e283eeee40ef89b188cd05d846b82 100644
--- a/media/capture/content/thread_safe_capture_oracle.cc
+++ b/media/capture/content/thread_safe_capture_oracle.cc
@@ -81,6 +81,7 @@ bool ThreadSafeCaptureOracle::ObserveEventAndDecideCapture(
return false;
}
+ frame_number = oracle_.next_frame_number();
visible_size = oracle_.capture_size();
// TODO(miu): Clients should request exact padding, instead of this
// memory-wasting hack to make frames that are compatible with all HW
@@ -91,7 +92,7 @@ bool ThreadSafeCaptureOracle::ObserveEventAndDecideCapture(
if (event == VideoCaptureOracle::kPassiveRefreshRequest) {
output_buffer = client_->ResurrectLastOutputBuffer(
coded_size, params_.requested_format.pixel_format,
- params_.requested_format.pixel_storage);
+ params_.requested_format.pixel_storage, frame_number);
if (!output_buffer) {
TRACE_EVENT_INSTANT0("gpu.capture", "ResurrectionFailed",
TRACE_EVENT_SCOPE_THREAD);
@@ -100,7 +101,7 @@ bool ThreadSafeCaptureOracle::ObserveEventAndDecideCapture(
} else {
output_buffer = client_->ReserveOutputBuffer(
coded_size, params_.requested_format.pixel_format,
- params_.requested_format.pixel_storage);
+ params_.requested_format.pixel_storage, frame_number);
}
// Get the current buffer pool utilization and attenuate it: The utilization
@@ -118,7 +119,7 @@ bool ThreadSafeCaptureOracle::ObserveEventAndDecideCapture(
return false;
}
- frame_number = oracle_.RecordCapture(attenuated_utilization);
+ oracle_.RecordCapture(attenuated_utilization);
estimated_frame_duration = oracle_.estimated_frame_duration();
} // End of critical section.
@@ -228,25 +229,15 @@ void ThreadSafeCaptureOracle::DidCaptureFrame(
frame->metadata()->SetTimeTicks(VideoFrameMetadata::REFERENCE_TIME,
reference_time);
- frame->AddDestructionObserver(
- base::Bind(&ThreadSafeCaptureOracle::DidConsumeFrame, this,
- frame_number, frame->metadata()));
-
client_->OnIncomingCapturedVideoFrame(std::move(buffer), std::move(frame));
}
}
-void ThreadSafeCaptureOracle::DidConsumeFrame(
+void ThreadSafeCaptureOracle::OnConsumerReportingUtilization(
int frame_number,
- const media::VideoFrameMetadata* metadata) {
- // Note: This function may be called on any thread by the VideoFrame
- // destructor. |metadata| is still valid for read-access at this point.
- double utilization = -1.0;
- if (metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION,
- &utilization)) {
- base::AutoLock guard(lock_);
- oracle_.RecordConsumerFeedback(frame_number, utilization);
- }
+ double utilization) {
+ base::AutoLock guard(lock_);
+ oracle_.RecordConsumerFeedback(frame_number, utilization);
}
} // namespace media
« no previous file with comments | « media/capture/content/thread_safe_capture_oracle.h ('k') | media/capture/content/video_capture_oracle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698