summaryrefslogtreecommitdiffstats
path: root/content/renderer/media/media_stream_video_source.cc
diff options
context:
space:
mode:
authormiu <miu@chromium.org>2015-05-09 15:17:15 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-09 22:17:45 +0000
commitf79202747a089a00f653e5827409c779395bda70 (patch)
treed2818030a1838573579d94e5727cb29786855b88 /content/renderer/media/media_stream_video_source.cc
parent238eaa368547ea4a87f5ea605c927e9013d3da92 (diff)
downloadchromium_src-f79202747a089a00f653e5827409c779395bda70.zip
chromium_src-f79202747a089a00f653e5827409c779395bda70.tar.gz
chromium_src-f79202747a089a00f653e5827409c779395bda70.tar.bz2
New resolution change policies for desktop and tab capture.
This change replaces the "fixed" versus "variable" resolution change policies with a 3-tier set: fixed, variable with fixed aspect ratio, and variable at any aspect ratio. This allows users of the desktop and tab capture APIs to specify minimum and maximum resolutions, and from those, a resolution change policy is determined. The policy is used by the desktop and tab capture implementation to activate or disable sender-side letterboxing of screen-capture content. BUG=473336 NOPRESUBMIT=true NOTRY=true Review URL: https://codereview.chromium.org/1124263004 Cr-Commit-Position: refs/heads/master@{#329056}
Diffstat (limited to 'content/renderer/media/media_stream_video_source.cc')
-rw-r--r--content/renderer/media/media_stream_video_source.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/content/renderer/media/media_stream_video_source.cc b/content/renderer/media/media_stream_video_source.cc
index 6e50121..c4b0c22 100644
--- a/content/renderer/media/media_stream_video_source.cc
+++ b/content/renderer/media/media_stream_video_source.cc
@@ -464,8 +464,10 @@ void MediaStreamVideoSource::OnSupportedFormats(
DCHECK_EQ(RETRIEVING_CAPABILITIES, state_);
supported_formats_ = formats;
+ blink::WebMediaConstraints fulfilled_constraints;
if (!FindBestFormatWithConstraints(supported_formats_,
- &current_format_)) {
+ &current_format_,
+ &fulfilled_constraints)) {
SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded);
// This object can be deleted after calling FinalizeAddTrack. See comment
// in the header file.
@@ -478,12 +480,14 @@ void MediaStreamVideoSource::OnSupportedFormats(
StartSourceImpl(
current_format_,
+ fulfilled_constraints,
base::Bind(&VideoTrackAdapter::DeliverFrameOnIO, track_adapter_));
}
bool MediaStreamVideoSource::FindBestFormatWithConstraints(
const media::VideoCaptureFormats& formats,
- media::VideoCaptureFormat* best_format) {
+ media::VideoCaptureFormat* best_format,
+ blink::WebMediaConstraints* fulfilled_constraints) {
DCHECK(CalledOnValidThread());
// Find the first constraints that we can fulfill.
for (const auto& request : requested_constraints_) {
@@ -494,6 +498,7 @@ bool MediaStreamVideoSource::FindBestFormatWithConstraints(
// no mandatory constraints have been specified. That just means that
// we will start with whatever format is native to the source.
if (formats.empty() && !HasMandatoryConstraints(requested_constraints)) {
+ *fulfilled_constraints = requested_constraints;
*best_format = media::VideoCaptureFormat();
return true;
}
@@ -502,6 +507,7 @@ bool MediaStreamVideoSource::FindBestFormatWithConstraints(
FilterFormats(requested_constraints, formats, &unsatisfied_constraint);
if (filtered_formats.size() > 0) {
// A request with constraints that can be fulfilled.
+ *fulfilled_constraints = requested_constraints;
GetBestCaptureFormat(filtered_formats,
requested_constraints,
best_format);