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

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

Issue 2810723002: Refactor VideoCaptureManager::GetDeviceFormatsInUse() (Closed)
Patch Set: Addressed review comments Created 3 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 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 db89a056f264e658b43d9084de2864d0723f371d..22578ac132b94239d72b7126b8f6338d2a1f8343 100644
--- a/content/browser/renderer_host/media/video_capture_controller.cc
+++ b/content/browser/renderer_host/media/video_capture_controller.cc
@@ -371,8 +371,8 @@ void VideoCaptureController::ReturnBuffer(
consumer_resource_utilization);
}
-const media::VideoCaptureFormat& VideoCaptureController::GetVideoCaptureFormat()
- const {
+const base::Optional<media::VideoCaptureFormat>
+VideoCaptureController::GetVideoCaptureFormat() const {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
return video_capture_format_;
}
@@ -449,10 +449,12 @@ void VideoCaptureController::OnFrameReadyInBuffer(
frame_info->coded_size.width(),
frame_info->coded_size.height());
double frame_rate = 0.0f;
- media::VideoFrameMetadata metadata;
- metadata.MergeInternalValuesFrom(*frame_info->metadata);
- if (!metadata.GetDouble(VideoFrameMetadata::FRAME_RATE, &frame_rate)) {
- frame_rate = video_capture_format_.frame_rate;
+ if (video_capture_format_) {
+ media::VideoFrameMetadata metadata;
+ metadata.MergeInternalValuesFrom(*frame_info->metadata);
+ if (!metadata.GetDouble(VideoFrameMetadata::FRAME_RATE, &frame_rate)) {
+ frame_rate = video_capture_format_->frame_rate;
+ }
}
UMA_HISTOGRAM_COUNTS("Media.VideoCapture.FrameRate", frame_rate);
has_received_frames_ = true;

Powered by Google App Engine
This is Rietveld 408576698