From 683511a70428de8050427f1d26ec5643dde35e2f Mon Sep 17 00:00:00 2001 From: "miu@chromium.org" Date: Tue, 5 Aug 2014 23:35:14 +0000 Subject: Allow MediaStream constraints to specify higher than 30 FPS tab capture. This will allow true 720p/60fps tab/desktop capture, if configured through the constraints (and the system hardware performance supports it). In addition, this will enable tab capture perf tests to run at higher frame rates so that more-subtle regressions are caught. A new hard upper-bound of 120 FPS is enforced with this change. BUG=400631 TBR=yzshen@chromium.org Review URL: https://codereview.chromium.org/442643002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287642 0039d316-1c4b-4281-b951-d872f2087c98 --- content/renderer/media/media_stream_video_source.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'content/renderer/media/media_stream_video_source.cc') diff --git a/content/renderer/media/media_stream_video_source.cc b/content/renderer/media/media_stream_video_source.cc index 42c5b1b..d6f8b8a4 100644 --- a/content/renderer/media/media_stream_video_source.cc +++ b/content/renderer/media/media_stream_video_source.cc @@ -173,9 +173,9 @@ bool UpdateFormatForConstraint( } else if (constraint_name == MediaStreamVideoSource::kMaxHeight) { return value > 0.0; } else if (constraint_name == MediaStreamVideoSource::kMinFrameRate) { - return (value <= format->frame_rate); + return (value > 0.0) && (value <= format->frame_rate); } else if (constraint_name == MediaStreamVideoSource::kMaxFrameRate) { - if (value == 0.0) { + if (value <= 0.0) { // The frame rate is set by constraint. // Don't allow 0 as frame rate if it is a mandatory constraint. // Set the frame rate to 1 if it is not mandatory. @@ -387,10 +387,17 @@ void MediaStreamVideoSource::AddTrack( GetMandatoryConstraintValueAsInteger(constraints, kMaxHeight, &max_requested_height); + double max_requested_frame_rate; + if (!GetConstraintValueAsDouble(constraints, kMaxFrameRate, + &max_requested_frame_rate)) { + max_requested_frame_rate = kDefaultFrameRate; + } + state_ = RETRIEVING_CAPABILITIES; GetCurrentSupportedFormats( max_requested_width, max_requested_height, + max_requested_frame_rate, base::Bind(&MediaStreamVideoSource::OnSupportedFormats, weak_factory_.GetWeakPtr())); -- cgit v1.1