Bug 1497390 - Remove support for legacy mozAutoGainControl and mozNoiseSuppression constraints. r=bzbarsky,achronop
authorJan-Ivar Bruaroey <jib@mozilla.com>
Thu, 11 Oct 2018 02:02:32 +0000
changeset 499115 419218259bc1a6f5f1cd527225f1f200fbf55126
parent 499114 57de113fc71266c6a8afc5a5faacb74fece75702
child 499116 336da65f35ea1237d94c4a8e6d67b8f2bd794496
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky, achronop
bugs1497390
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1497390 - Remove support for legacy mozAutoGainControl and mozNoiseSuppression constraints. r=bzbarsky,achronop Differential Revision: https://phabricator.services.mozilla.com/D8053
dom/locales/en-US/chrome/dom/dom.properties
dom/media/MediaManager.cpp
dom/media/webrtc/MediaTrackConstraints.cpp
dom/media/webrtc/MediaTrackConstraints.h
dom/webidl/MediaStreamTrack.webidl
--- a/dom/locales/en-US/chrome/dom/dom.properties
+++ b/dom/locales/en-US/chrome/dom/dom.properties
@@ -319,20 +319,16 @@ LargeAllocationNonGetRequest=A Large-All
 LargeAllocationNotOnlyToplevelInTabGroup=A Large-Allocation header was ignored due to the presence of windows which have a reference to this browsing context through the frame hierarchy or window.opener.
 # LOCALIZATION NOTE: Do not translate "Large-Allocation", as it is a literal header name
 LargeAllocationNonE10S=A Large-Allocation header was ignored due to the document not being loaded out of process.
 GeolocationInsecureRequestIsForbidden=A Geolocation request can only be fulfilled in a secure context.
 # LOCALIZATION NOTE: Do not translate "Large-Allocation", as it is a literal header name.
 LargeAllocationNonWin32=This page would be loaded in a new process due to a Large-Allocation header, however Large-Allocation process creation is disabled on non-Win32 platforms.
 # LOCALIZATION NOTE: Do not translate URL.createObjectURL(MediaStream).
 URLCreateObjectURL_MediaStreamWarning=URL.createObjectURL(MediaStream) is deprecated and will be removed soon.
-# LOCALIZATION NOTE: Do not translate MozAutoGainControl or autoGainControl.
-MozAutoGainControlWarning=mozAutoGainControl is deprecated. Use autoGainControl instead.
-# LOCALIZATION NOTE: Do not translate mozNoiseSuppression or noiseSuppression.
-MozNoiseSuppressionWarning=mozNoiseSuppression is deprecated. Use noiseSuppression instead.
 # LOCALIZATION NOTE: Do not translate xml:base.
 XMLBaseAttributeWarning=Use of xml:base attribute is deprecated and will be removed soon. Please remove any use of it.
 # LOCALIZATION NOTE: Do not translate "content", "Window", and "window.top"
 WindowContentUntrustedWarning=The ‘content’ attribute of Window objects is deprecated.  Please use ‘window.top’ instead.
 # LOCALIZATION NOTE: The first %S is the tag name of the element that starts the loop, the second %S is the element's ID.
 SVGRefLoopWarning=The SVG <%S> with ID “%S” has a reference loop.
 # LOCALIZATION NOTE: The first %S is the tag name of the element in the chain where the chain was broken, the second %S is the element's ID.
 SVGRefChainLengthExceededWarning=An SVG <%S> reference chain which is too long was abandoned at the element with ID “%S”.
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -2790,24 +2790,16 @@ MediaManager::GetUserMedia(nsPIDOMWindow
   } else if (IsOn(c.mVideo)) {
     videoType = MediaSourceEnum::Camera;
     Telemetry::Accumulate(Telemetry::WEBRTC_GET_USER_MEDIA_TYPE,
                           (uint32_t) videoType);
   }
 
   if (c.mAudio.IsMediaTrackConstraints()) {
     auto& ac = c.mAudio.GetAsMediaTrackConstraints();
-    MediaConstraintsHelper::ConvertOldWithWarning(ac.mMozAutoGainControl,
-                                                  ac.mAutoGainControl,
-                                                  "MozAutoGainControlWarning",
-                                                  aWindow);
-    MediaConstraintsHelper::ConvertOldWithWarning(ac.mMozNoiseSuppression,
-                                                  ac.mNoiseSuppression,
-                                                  "MozNoiseSuppressionWarning",
-                                                  aWindow);
     audioType = StringToEnum(dom::MediaSourceEnumValues::strings,
                              ac.mMediaSource,
                              MediaSourceEnum::Other);
     // Work around WebIDL default since spec uses same dictionary w/audio & video.
     if (audioType == MediaSourceEnum::Camera) {
       audioType = MediaSourceEnum::Microphone;
       ac.mMediaSource.AssignASCII(EnumToASCII(dom::MediaSourceEnumValues::strings,
                                               audioType));
@@ -4766,59 +4758,49 @@ SourceListener::CapturingSource(MediaSou
 
   return CaptureState::Disabled;
 }
 
 RefPtr<SourceListener::ApplyConstraintsPromise>
 SourceListener::ApplyConstraintsToTrack(
     nsPIDOMWindowInner* aWindow,
     TrackID aTrackID,
-    const MediaTrackConstraints& aConstraintsPassedIn,
+    const MediaTrackConstraints& aConstraints,
     dom::CallerType aCallerType)
 {
   MOZ_ASSERT(NS_IsMainThread());
   DeviceState& state = GetDeviceStateFor(aTrackID);
 
   if (mStopped || state.mStopped) {
     LOG(("gUM %s track %d applyConstraints, but source is stopped",
          aTrackID == kAudioTrack ? "audio" : "video", aTrackID));
     return ApplyConstraintsPromise::CreateAndResolve(false, __func__);
   }
 
-  MediaTrackConstraints c(aConstraintsPassedIn); // use a modifiable copy
-  MediaConstraintsHelper::ConvertOldWithWarning(c.mMozAutoGainControl,
-                                                c.mAutoGainControl,
-                                                "MozAutoGainControlWarning",
-                                                aWindow);
-  MediaConstraintsHelper::ConvertOldWithWarning(c.mMozNoiseSuppression,
-                                                c.mNoiseSuppression,
-                                                "MozNoiseSuppressionWarning",
-                                                aWindow);
-
   MediaManager* mgr = MediaManager::GetIfExists();
   if (!mgr) {
     return ApplyConstraintsPromise::CreateAndResolve(false, __func__);
   }
 
   return MediaManager::PostTask<ApplyConstraintsPromise>(__func__,
-      [device = state.mDevice, c,
+      [device = state.mDevice, aConstraints,
        isChrome = aCallerType == dom::CallerType::System]
       (MozPromiseHolder<ApplyConstraintsPromise>& aHolder) mutable {
     MOZ_ASSERT(MediaManager::IsInMediaThread());
     MediaManager* mgr = MediaManager::GetIfExists();
     MOZ_RELEASE_ASSERT(mgr); // Must exist while media thread is alive
     const char* badConstraint = nullptr;
-    nsresult rv = device->Reconfigure(c, mgr->mPrefs, &badConstraint);
+    nsresult rv = device->Reconfigure(aConstraints, mgr->mPrefs, &badConstraint);
     if (rv == NS_ERROR_INVALID_ARG) {
       // Reconfigure failed due to constraints
       if (!badConstraint) {
         nsTArray<RefPtr<MediaDevice>> devices;
         devices.AppendElement(device);
         badConstraint = MediaConstraintsHelper::SelectSettings(
-            NormalizedConstraints(c), devices, isChrome);
+            NormalizedConstraints(aConstraints), devices, isChrome);
       }
 
       aHolder.Reject(Some(NS_ConvertASCIItoUTF16(badConstraint)), __func__);
       return;
     }
 
     if (NS_FAILED(rv)) {
       // Reconfigure failed unexpectedly
--- a/dom/media/webrtc/MediaTrackConstraints.cpp
+++ b/dom/media/webrtc/MediaTrackConstraints.cpp
@@ -603,43 +603,16 @@ MediaConstraintsHelper::FindBadConstrain
 {
   AutoTArray<RefPtr<MediaDevice>, 1> devices;
   devices.AppendElement(MakeRefPtr<MediaDevice>(aMediaEngineSource,
                                                 aMediaEngineSource->GetName(),
                                                 aDeviceId));
   return FindBadConstraint(aConstraints, devices);
 }
 
-/* static */ void
-MediaConstraintsHelper::ConvertOldWithWarning(
-    const dom::OwningBooleanOrConstrainBooleanParameters& old,
-    dom::OwningBooleanOrConstrainBooleanParameters& to,
-    const char* aMessageName,
-    nsPIDOMWindowInner* aWindow) {
-  if ((old.IsBoolean() ||
-       old.GetAsConstrainBooleanParameters().mExact.WasPassed() ||
-       old.GetAsConstrainBooleanParameters().mIdeal.WasPassed()) &&
-      !(to.IsBoolean() ||
-        to.GetAsConstrainBooleanParameters().mExact.WasPassed() ||
-        to.GetAsConstrainBooleanParameters().mIdeal.WasPassed())) {
-    nsCOMPtr<nsIDocument> doc = aWindow->GetDoc();
-    if (doc) {
-      nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
-                                      NS_LITERAL_CSTRING("DOM"), doc,
-                                      nsContentUtils::eDOM_PROPERTIES,
-                                      aMessageName);
-    }
-    if (old.IsBoolean()) {
-      to.SetAsBoolean() = old.GetAsBoolean();
-    } else {
-      to.SetAsConstrainBooleanParameters() = old.GetAsConstrainBooleanParameters();
-    }
-  }
-}
-
 static void
 LogConstraintStringRange(const NormalizedConstraintSet::StringRange& aRange)
 {
   if (aRange.mExact.size() <= 1 && aRange.mIdeal.size() <= 1) {
     LOG("  %s: { exact: [%s], ideal: [%s] }",
         aRange.mName,
         (aRange.mExact.size()? NS_ConvertUTF16toUTF8(*aRange.mExact.begin()).get() : ""),
         (aRange.mIdeal.size()? NS_ConvertUTF16toUTF8(*aRange.mIdeal.begin()).get() : ""));
--- a/dom/media/webrtc/MediaTrackConstraints.h
+++ b/dom/media/webrtc/MediaTrackConstraints.h
@@ -332,22 +332,14 @@ public:
   FindBadConstraint(const NormalizedConstraints& aConstraints,
                     const nsTArray<RefPtr<MediaDevice>>& aDevices);
 
   static const char*
   FindBadConstraint(const NormalizedConstraints& aConstraints,
                     const RefPtr<MediaEngineSource>& aMediaEngineSource,
                     const nsString& aDeviceId);
 
-  // Warn on and convert use of deprecated constraints to new ones
-  static void
-  ConvertOldWithWarning(
-      const dom::OwningBooleanOrConstrainBooleanParameters& old,
-      dom::OwningBooleanOrConstrainBooleanParameters& to,
-      const char* aMessageName,
-      nsPIDOMWindowInner* aWindow);
-
   static void LogConstraints(const NormalizedConstraintSet& aConstraints);
 };
 
 } // namespace mozilla
 
 #endif /* MEDIATRACKCONSTRAINTS_H_ */
--- a/dom/webidl/MediaStreamTrack.webidl
+++ b/dom/webidl/MediaStreamTrack.webidl
@@ -66,22 +66,16 @@ dictionary MediaTrackConstraintSet {
     // FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
     ConstrainBoolean echoCancellation = null;
     // FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
     ConstrainBoolean noiseSuppression = null;
     // FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
     ConstrainBoolean autoGainControl = null;
     // FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
     ConstrainLong channelCount = null;
-
-    // Deprecated with warnings:
-    // FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
-    ConstrainBoolean mozNoiseSuppression = null;
-    // FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
-    ConstrainBoolean mozAutoGainControl = null;
 };
 
 dictionary MediaTrackConstraints : MediaTrackConstraintSet {
     sequence<MediaTrackConstraintSet> advanced;
 };
 
 enum MediaStreamTrackState {
     "live",