Bug 1497390 - Remove support for legacy mozAutoGainControl and mozNoiseSuppression constraints. r=bzbarsky,achronop

Differential Revision: https://phabricator.services.mozilla.com/D8053

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan-Ivar Bruaroey 2018-10-10 07:51:09 +00:00
Родитель f7ffd78b62
Коммит 6793adb6e3
5 изменённых файлов: 4 добавлений и 67 удалений

Просмотреть файл

@ -324,10 +324,6 @@ GeolocationInsecureRequestIsForbidden=A Geolocation request can only be fulfille
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"

Просмотреть файл

@ -2789,14 +2789,6 @@ MediaManager::GetUserMedia(nsPIDOMWindowInner* aWindow,
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);
@ -4732,7 +4724,7 @@ RefPtr<SourceListener::ApplyConstraintsPromise>
SourceListener::ApplyConstraintsToTrack(
nsPIDOMWindowInner* aWindow,
TrackID aTrackID,
const MediaTrackConstraints& aConstraintsPassedIn,
const MediaTrackConstraints& aConstraints,
dom::CallerType aCallerType)
{
MOZ_ASSERT(NS_IsMainThread());
@ -4744,37 +4736,27 @@ SourceListener::ApplyConstraintsToTrack(
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__);

Просмотреть файл

@ -608,33 +608,6 @@ MediaConstraintsHelper::FindBadConstraint(
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)
{

Просмотреть файл

@ -337,14 +337,6 @@ public:
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);
};

Просмотреть файл

@ -71,12 +71,6 @@ dictionary MediaTrackConstraintSet {
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 {