Skip to content

Commit

Permalink
Remove support for old getUserMedia video constraints algorithm.
Browse files Browse the repository at this point in the history
This CL removes most code implementing the old algorithm for processing
getUserMedia video constraints.
The new algorithm has been in stable Chrome for a few weeks now and
having the option to switch back to the old algorithm is no longer
necessary.

BUG=706408

Review-Url: https://codereview.chromium.org/2964003002
Cr-Commit-Position: refs/heads/master@{#484202}
  • Loading branch information
guidou authored and Commit Bot committed Jul 5, 2017
1 parent afee587 commit 6beb0ce
Show file tree
Hide file tree
Showing 20 changed files with 45 additions and 2,805 deletions.
42 changes: 4 additions & 38 deletions content/browser/webrtc/webrtc_getusermedia_browsertest.cc
Expand Up @@ -109,9 +109,8 @@ namespace content {
class WebRtcGetUserMediaBrowserTest : public WebRtcContentBrowserTestBase {
public:
WebRtcGetUserMediaBrowserTest() : trace_log_(NULL) {
scoped_feature_list_.InitWithFeatures(
{}, {features::kMediaStreamOldVideoConstraints,
features::kMediaStreamOldAudioConstraints});
scoped_feature_list_.InitAndDisableFeature(
features::kMediaStreamOldAudioConstraints);
// Automatically grant device permission.
AppendUseFakeUIForMediaStreamFlag();
}
Expand Down Expand Up @@ -806,10 +805,8 @@ class WebRtcGetUserMediaOldConstraintsBrowserTest
: public WebRtcContentBrowserTestBase {
public:
WebRtcGetUserMediaOldConstraintsBrowserTest() : trace_log_(NULL) {
scoped_feature_list_.InitWithFeatures(
{features::kMediaStreamOldVideoConstraints,
features::kMediaStreamOldAudioConstraints},
{});
scoped_feature_list_.InitAndEnableFeature(
features::kMediaStreamOldAudioConstraints);
// Automatically grant device permission.
AppendUseFakeUIForMediaStreamFlag();
}
Expand Down Expand Up @@ -1193,37 +1190,6 @@ IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaOldConstraintsBrowserTest,
expected_result);
}

// TODO(guidou): Remove this test. http://crbug.com/706408
IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaOldConstraintsBrowserTest,
TwoGetUserMediaWithSecondVideoCropped) {
std::string constraints1 = "{video: true}";
std::string constraints2 = "{video: {mandatory: {maxHeight: 360}}}";
std::string expected_result = "w=640:h=480-w=640:h=360";
RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2,
expected_result);
}

// Test fails under MSan, http://crbug.com/445745
// TODO(guidou): Remove this test. http://crbug.com/706408
#if defined(MEMORY_SANITIZER)
#define MAYBE_TwoGetUserMediaWithFirstHdSecondVga \
DISABLED_TwoGetUserMediaWithFirstHdSecondVga
#else
#define MAYBE_TwoGetUserMediaWithFirstHdSecondVga \
TwoGetUserMediaWithFirstHdSecondVga
#endif
IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaOldConstraintsBrowserTest,
MAYBE_TwoGetUserMediaWithFirstHdSecondVga) {
std::string constraints1 =
"{video: {mandatory: {maxWidth:1280 , minWidth:1280 , maxHeight: 720, "
"minHeight: 720}}}";
std::string constraints2 =
"{video: {mandatory: {maxWidth:640 , maxHeight: 480}}}";
std::string expected_result = "w=1280:h=720-w=640:h=480";
RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2,
expected_result);
}

// Timing out on Windows 7 bot: http://crbug.com/443294
// Flaky: http://crbug.com/660656; possible the test is too perf sensitive.
IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaOldConstraintsBrowserTest,
Expand Down
4 changes: 0 additions & 4 deletions content/public/common/content_features.cc
Expand Up @@ -146,10 +146,6 @@ const base::Feature kMediaDocumentDownloadButton{
const base::Feature kMediaStreamOldAudioConstraints{
"MediaStreamOldAudioConstraints", base::FEATURE_DISABLED_BY_DEFAULT};

// Enables the old algorithm for processing video constraints in getUserMedia().
const base::Feature kMediaStreamOldVideoConstraints{
"MediaStreamOldVideoConstraints", base::FEATURE_DISABLED_BY_DEFAULT};

// Enables the memory coordinator.
// WARNING:
// The memory coordinator is not ready for use and enabling this may cause
Expand Down
1 change: 0 additions & 1 deletion content/public/common/content_features.h
Expand Up @@ -45,7 +45,6 @@ CONTENT_EXPORT extern const base::Feature kLazyParseCSS;
CONTENT_EXPORT extern const base::Feature kLoadingWithMojo;
CONTENT_EXPORT extern const base::Feature kMediaDocumentDownloadButton;
CONTENT_EXPORT extern const base::Feature kMediaStreamOldAudioConstraints;
CONTENT_EXPORT extern const base::Feature kMediaStreamOldVideoConstraints;
CONTENT_EXPORT extern const base::Feature kMemoryCoordinator;
CONTENT_EXPORT extern const base::Feature kNotificationContentImage;
CONTENT_EXPORT extern const base::Feature kMainThreadBusyScrollIntervention;
Expand Down
50 changes: 11 additions & 39 deletions content/renderer/media/media_stream_center.cc
Expand Up @@ -68,23 +68,9 @@ void CreateNativeVideoMediaStreamTrack(blink::WebMediaStreamTrack track) {
MediaStreamVideoSource* native_source =
MediaStreamVideoSource::GetVideoSource(source);
DCHECK(native_source);
if (IsOldVideoConstraints()) {
// TODO(perkj): The constraints to use here should be passed from blink when
// a new track is created. For cloning, it should be the constraints of the
// cloned track and not the originating source.
// Also - source.constraints() returns an uninitialized constraint if the
// source is coming from a remote video track. See http://crbug/287805.
blink::WebMediaConstraints constraints = source.Constraints();
if (constraints.IsNull())
constraints.Initialize();
track.SetTrackData(new MediaStreamVideoTrack(
native_source, constraints,
MediaStreamVideoSource::ConstraintsCallback(), track.IsEnabled()));
} else {
track.SetTrackData(new MediaStreamVideoTrack(
native_source, MediaStreamVideoSource::ConstraintsCallback(),
track.IsEnabled()));
}
track.SetTrackData(new MediaStreamVideoTrack(
native_source, MediaStreamVideoSource::ConstraintsCallback(),
track.IsEnabled()));
}

void CloneNativeVideoMediaStreamTrack(
Expand All @@ -96,28 +82,14 @@ void CloneNativeVideoMediaStreamTrack(
MediaStreamVideoSource* native_source =
MediaStreamVideoSource::GetVideoSource(source);
DCHECK(native_source);
if (IsOldVideoConstraints()) {
// TODO(perkj): The constraints to use here should be passed from blink when
// a new track is created. For cloning, it should be the constraints of the
// cloned track and not the originating source.
// Also - source.constraints() returns an uninitialized constraint if the
// source is coming from a remote video track. See http://crbug/287805.
blink::WebMediaConstraints constraints = source.Constraints();
if (constraints.IsNull())
constraints.Initialize();
clone.SetTrackData(new MediaStreamVideoTrack(
native_source, constraints,
MediaStreamVideoSource::ConstraintsCallback(), clone.IsEnabled()));
} else {
MediaStreamVideoTrack* original_track =
MediaStreamVideoTrack::GetVideoTrack(original);
DCHECK(original_track);
clone.SetTrackData(new MediaStreamVideoTrack(
native_source, original_track->adapter_settings(),
original_track->noise_reduction(), original_track->is_screencast(),
original_track->min_frame_rate(),
MediaStreamVideoSource::ConstraintsCallback(), clone.IsEnabled()));
}
MediaStreamVideoTrack* original_track =
MediaStreamVideoTrack::GetVideoTrack(original);
DCHECK(original_track);
clone.SetTrackData(new MediaStreamVideoTrack(
native_source, original_track->adapter_settings(),
original_track->noise_reduction(), original_track->is_screencast(),
original_track->min_frame_rate(),
MediaStreamVideoSource::ConstraintsCallback(), clone.IsEnabled()));
}

} // namespace
Expand Down

0 comments on commit 6beb0ce

Please sign in to comment.