From 72e80153f25bd48e60adfad3b53c8c13fce5e2bf Mon Sep 17 00:00:00 2001 From: Cosmin Sabou Date: Mon, 11 May 2020 21:38:54 +0300 Subject: [PATCH] Backed out 3 changesets (bug 1626081) for causing build bustages. CLOSED TREE Backed out changeset 82cae35b52eb (bug 1626081) Backed out changeset 42135f164217 (bug 1626081) Backed out changeset 2676f31077bc (bug 1626081) --- dom/media/CubebUtils.cpp | 11 ------- dom/media/CubebUtils.h | 4 --- dom/media/GraphDriver.cpp | 7 +---- dom/media/MediaManager.cpp | 10 ++----- dom/media/MediaTrackGraph.cpp | 19 ------------ dom/media/webrtc/MediaEnginePrefs.h | 2 -- dom/media/webrtc/MediaEngineWebRTCAudio.cpp | 32 +++++++-------------- dom/media/webrtc/MediaEngineWebRTCAudio.h | 6 ++-- media/libcubeb/moz.yaml | 2 +- media/libcubeb/src/cubeb_opensl.c | 16 +++++------ modules/libpref/init/all.js | 3 -- 11 files changed, 25 insertions(+), 87 deletions(-) diff --git a/dom/media/CubebUtils.cpp b/dom/media/CubebUtils.cpp index 509eab885346..36d7680e415e 100644 --- a/dom/media/CubebUtils.cpp +++ b/dom/media/CubebUtils.cpp @@ -52,7 +52,6 @@ #define PREF_CUBEB_LOGGING_LEVEL "media.cubeb.logging_level" // Hidden pref used by tests to force failure to obtain cubeb context #define PREF_CUBEB_FORCE_NULL_CONTEXT "media.cubeb.force_null_context" -#define PREF_CUBEB_OUTPUT_VOICE_ROUTING "media.cubeb.output_voice_routing" // Hidden pref to disable BMO 1427011 experiment; can be removed once proven. #define PREF_CUBEB_DISABLE_DEVICE_SWITCHING \ "media.cubeb.disable_device_switching" @@ -101,7 +100,6 @@ bool sCubebMTGLatencyPrefSet = false; bool sAudioStreamInitEverSucceeded = false; bool sCubebForceNullContext = false; bool sCubebDisableDeviceSwitching = true; -bool sRouteOutputAsVoice = false; #ifdef MOZ_CUBEB_REMOTING bool sCubebSandbox = false; size_t sAudioIPCPoolSize; @@ -269,13 +267,6 @@ void PrefChanged(const char* aPref, void* aClosure) { AUDIOIPC_STACK_SIZE_DEFAULT); } #endif - else if (strcmp(aPref, PREF_CUBEB_OUTPUT_VOICE_ROUTING) == 0) { - StaticMutexAutoLock lock(sMutex); - sRouteOutputAsVoice = Preferences::GetBool(aPref); - MOZ_LOG(gCubebLog, LogLevel::Verbose, - ("%s: %s", PREF_CUBEB_OUTPUT_VOICE_ROUTING, - sRouteOutputAsVoice ? "true" : "false")); - } } bool GetFirstStream() { @@ -685,8 +676,6 @@ cubeb_stream_prefs GetDefaultStreamPrefs() { return CUBEB_STREAM_PREF_NONE; } -bool RouteOutputAsVoice() { return sRouteOutputAsVoice; } - #ifdef MOZ_WIDGET_ANDROID uint32_t AndroidGetAudioOutputSampleRate() { int32_t sample_rate = java::GeckoAppShell::GetAudioOutputSampleRate(); diff --git a/dom/media/CubebUtils.h b/dom/media/CubebUtils.h index fd0de084ea1b..1affdc7f96a3 100644 --- a/dom/media/CubebUtils.h +++ b/dom/media/CubebUtils.h @@ -51,10 +51,6 @@ char* GetForcedOutputDevice(); // to switch to "communication mode", which might change audio routing, // bluetooth communication type, etc. void SetInCommunication(bool aInCommunication); -// Returns true if the output streams should be routed like a stream containing -// voice data, and not generic audio. This can influence audio processing and -// device selection. -bool RouteOutputAsVoice(); # ifdef MOZ_WIDGET_ANDROID uint32_t AndroidGetAudioOutputSampleRate(); diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp index 07d2a6ddcaa6..a7cfb2744f32 100644 --- a/dom/media/GraphDriver.cpp +++ b/dom/media/GraphDriver.cpp @@ -642,8 +642,7 @@ void AudioCallbackDriver::Init() { output.layout = static_cast(channelMap); output.prefs = CubebUtils::GetDefaultStreamPrefs(); #if !defined(XP_WIN) - if (mInputDevicePreference == CUBEB_DEVICE_PREF_VOICE && - CubebUtils::RouteOutputAsVoice()) { + if (mInputDevicePreference == CUBEB_DEVICE_PREF_VOICE) { output.prefs |= static_cast(CUBEB_STREAM_PREF_VOICE); } #endif @@ -672,10 +671,6 @@ void AudioCallbackDriver::Init() { input = output; input.channels = mInputChannelCount; input.layout = CUBEB_LAYOUT_UNDEFINED; - input.prefs = CubebUtils::GetDefaultStreamPrefs(); - if (mInputDevicePreference == CUBEB_DEVICE_PREF_VOICE) { - input.prefs |= static_cast(CUBEB_STREAM_PREF_VOICE); - } cubeb_stream* stream = nullptr; bool inputWanted = mInputChannelCount > 0; diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index 65930ebb1304..70ea42b64c7a 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -1909,12 +1909,10 @@ MediaManager::MediaManager(UniquePtr aMediaThread) webrtc::EchoCancellation::SuppressionLevel::kModerateSuppression; mPrefs.mAgc = webrtc::GainControl::Mode::kAdaptiveDigital; mPrefs.mNoise = webrtc::NoiseSuppression::Level::kModerate; - mPrefs.mRoutingMode = webrtc::EchoControlMobile::RoutingMode::kSpeakerphone; #else mPrefs.mAec = 0; mPrefs.mAgc = 0; mPrefs.mNoise = 0; - mPrefs.mRoutingMode = 0; #endif mPrefs.mFullDuplex = false; mPrefs.mChannels = 0; // max channels default @@ -1929,14 +1927,14 @@ MediaManager::MediaManager(UniquePtr aMediaThread) } LOG("%s: default prefs: %dx%d @%dfps, %dHz test tones, aec: %s," "agc: %s, hpf: %s, noise: %s, aec level: %d, agc level: %d, noise level: " - "%d, aec mobile routing mode: %d," + "%d," "%sfull_duplex, extended aec %s, delay_agnostic %s " "channels %d", __FUNCTION__, mPrefs.mWidth, mPrefs.mHeight, mPrefs.mFPS, mPrefs.mFreq, mPrefs.mAecOn ? "on" : "off", mPrefs.mAgcOn ? "on" : "off", mPrefs.mHPFOn ? "on" : "off", mPrefs.mNoiseOn ? "on" : "off", mPrefs.mAec, - mPrefs.mAgc, mPrefs.mNoise, mPrefs.mRoutingMode, - mPrefs.mFullDuplex ? "" : "not ", mPrefs.mExtendedFilter ? "on" : "off", + mPrefs.mAgc, mPrefs.mNoise, mPrefs.mFullDuplex ? "" : "not ", + mPrefs.mExtendedFilter ? "on" : "off", mPrefs.mDelayAgnostic ? "on" : "off", mPrefs.mChannels); } @@ -3489,8 +3487,6 @@ void MediaManager::GetPrefs(nsIPrefBranch* aBranch, const char* aData) { GetPref(aBranch, "media.getusermedia.aec", aData, &mPrefs.mAec); GetPref(aBranch, "media.getusermedia.agc", aData, &mPrefs.mAgc); GetPref(aBranch, "media.getusermedia.noise", aData, &mPrefs.mNoise); - GetPref(aBranch, "media.getusermedia.aecm_output_routing", aData, - &mPrefs.mRoutingMode); GetPrefBool(aBranch, "media.getusermedia.aec_extended_filter", aData, &mPrefs.mExtendedFilter); GetPrefBool(aBranch, "media.getusermedia.aec_aec_delay_agnostic", aData, diff --git a/dom/media/MediaTrackGraph.cpp b/dom/media/MediaTrackGraph.cpp index 3e51dd550565..cea0a1160914 100644 --- a/dom/media/MediaTrackGraph.cpp +++ b/dom/media/MediaTrackGraph.cpp @@ -3659,25 +3659,6 @@ double MediaTrackGraphImpl::AudioOutputLatency() { return mAudioOutputLatency; } -double MediaTrackGraphImpl::AudioInputLatency() { - MOZ_ASSERT(NS_IsMainThread()); - if (mAudioInputLatency != 0.0) { - return mAudioInputLatency; - } - MonitorAutoLock lock(mMonitor); - if (CurrentDriver()->AsAudioCallbackDriver()) { - mAudioInputLatency = CurrentDriver() - ->AsAudioCallbackDriver() - ->AudioInputLatency() - .ToSeconds(); - } else { - // Failure mode: return 0.0 if running on a normal thread. - mAudioInputLatency = 0.0; - } - - return mAudioInputLatency; -} - bool MediaTrackGraph::IsNonRealtime() const { return !static_cast(this)->mRealtime; } diff --git a/dom/media/webrtc/MediaEnginePrefs.h b/dom/media/webrtc/MediaEnginePrefs.h index ebd33fb73070..1aa076ab72d7 100644 --- a/dom/media/webrtc/MediaEnginePrefs.h +++ b/dom/media/webrtc/MediaEnginePrefs.h @@ -32,7 +32,6 @@ class MediaEnginePrefs { mNoiseOn(false), mAec(0), mAgc(0), - mRoutingMode(0), mNoise(0), mFullDuplex(false), mExtendedFilter(false), @@ -51,7 +50,6 @@ class MediaEnginePrefs { bool mNoiseOn; int32_t mAec; int32_t mAgc; - int32_t mRoutingMode; int32_t mNoise; bool mFullDuplex; bool mExtendedFilter; diff --git a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp index 98d5ba08dd4d..101d2bbf229d 100644 --- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp +++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp @@ -164,29 +164,25 @@ nsresult MediaEngineWebRTCMicrophoneSource::Reconfigure( } void MediaEngineWebRTCMicrophoneSource::UpdateAECSettings( - bool aEnable, bool aUseAecMobile, EchoCancellation::SuppressionLevel aLevel, - EchoControlMobile::RoutingMode aRoutingMode) { + bool aEnable, bool aUseAecMobile, + EchoCancellation::SuppressionLevel aLevel) { AssertIsOnOwningThread(); RefPtr that = this; NS_DispatchToMainThread(NS_NewRunnableFunction( - __func__, - [that, track = mTrack, aEnable, aUseAecMobile, aLevel, aRoutingMode] { + __func__, [that, track = mTrack, aEnable, aUseAecMobile, aLevel] { class Message : public ControlMessage { public: Message(AudioInputProcessing* aInputProcessing, bool aEnable, - bool aUseAecMobile, EchoCancellation::SuppressionLevel aLevel, - EchoControlMobile::RoutingMode aRoutingMode) + bool aUseAecMobile, EchoCancellation::SuppressionLevel aLevel) : ControlMessage(nullptr), mInputProcessing(aInputProcessing), mEnable(aEnable), mUseAecMobile(aUseAecMobile), - mLevel(aLevel), - mRoutingMode(aRoutingMode) {} + mLevel(aLevel) {} void Run() override { - mInputProcessing->UpdateAECSettings(mEnable, mUseAecMobile, mLevel, - mRoutingMode); + mInputProcessing->UpdateAECSettings(mEnable, mUseAecMobile, mLevel); } protected: @@ -194,16 +190,14 @@ void MediaEngineWebRTCMicrophoneSource::UpdateAECSettings( bool mEnable; bool mUseAecMobile; EchoCancellation::SuppressionLevel mLevel; - EchoControlMobile::RoutingMode mRoutingMode; }; if (track->IsDestroyed()) { return; } - track->GraphImpl()->AppendMessage( - MakeUnique(that->mInputProcessing, aEnable, aUseAecMobile, - aLevel, aRoutingMode)); + track->GraphImpl()->AppendMessage(MakeUnique( + that->mInputProcessing, aEnable, aUseAecMobile, aLevel)); })); } @@ -358,9 +352,7 @@ void MediaEngineWebRTCMicrophoneSource::ApplySettings( static_cast(aPrefs.mNoise)); UpdateAECSettings( aPrefs.mAecOn, aPrefs.mUseAecMobile, - static_cast(aPrefs.mAec), - static_cast( - aPrefs.mRoutingMode)); + static_cast(aPrefs.mAec)); UpdateHPFSettings(aPrefs.mHPFOn); UpdateAPMExtraOptions(mExtendedFilter, mDelayAgnostic); @@ -685,12 +677,10 @@ void AudioInputProcessing::SetRequestedInputChannelCount( } while (0); void AudioInputProcessing::UpdateAECSettings( - bool aEnable, bool aUseAecMobile, EchoCancellation::SuppressionLevel aLevel, - EchoControlMobile::RoutingMode aRoutingMode) { + bool aEnable, bool aUseAecMobile, + EchoCancellation::SuppressionLevel aLevel) { if (aUseAecMobile) { HANDLE_APM_ERROR(mAudioProcessing->echo_control_mobile()->Enable(aEnable)); - HANDLE_APM_ERROR(mAudioProcessing->echo_control_mobile()->set_routing_mode( - aRoutingMode)); HANDLE_APM_ERROR(mAudioProcessing->echo_cancellation()->Enable(false)); } else { if (aLevel != EchoCancellation::SuppressionLevel::kLowSuppression && diff --git a/dom/media/webrtc/MediaEngineWebRTCAudio.h b/dom/media/webrtc/MediaEngineWebRTCAudio.h index 991faab4a3fc..161166dd1029 100644 --- a/dom/media/webrtc/MediaEngineWebRTCAudio.h +++ b/dom/media/webrtc/MediaEngineWebRTCAudio.h @@ -93,8 +93,7 @@ class MediaEngineWebRTCMicrophoneSource : public MediaEngineSource { * Sent the AudioProcessingModule parameter for a given processing algorithm. */ void UpdateAECSettings(bool aEnable, bool aUseAecMobile, - webrtc::EchoCancellation::SuppressionLevel aLevel, - webrtc::EchoControlMobile::RoutingMode aRoutingMode); + webrtc::EchoCancellation::SuppressionLevel aLevel); void UpdateAGCSettings(bool aEnable, webrtc::GainControl::Mode aMode); void UpdateHPFSettings(bool aEnable); void UpdateNSSettings(bool aEnable, webrtc::NoiseSuppression::Level aLevel); @@ -191,8 +190,7 @@ class AudioInputProcessing : public AudioDataListener { // This allow changing the APM options, enabling or disabling processing // steps. void UpdateAECSettings(bool aEnable, bool aUseAecMobile, - webrtc::EchoCancellation::SuppressionLevel aLevel, - webrtc::EchoControlMobile::RoutingMode aRoutingMode); + webrtc::EchoCancellation::SuppressionLevel aLevel); void UpdateAGCSettings(bool aEnable, webrtc::GainControl::Mode aMode); void UpdateHPFSettings(bool aEnable); void UpdateNSSettings(bool aEnable, webrtc::NoiseSuppression::Level aLevel); diff --git a/media/libcubeb/moz.yaml b/media/libcubeb/moz.yaml index 7eac15736a81..a0ba057efe99 100644 --- a/media/libcubeb/moz.yaml +++ b/media/libcubeb/moz.yaml @@ -19,5 +19,5 @@ origin: license: "ISC" # update.sh will update this value - release: "80c3d838d2929c2783065ef1eb686dda98e05df4 (2020-05-07 17:49:36 +0200)" + release: "2f313a6977c293fdc0af9897b251d2b77b539654-dirty (2020-04-30 15:54:04 +0200)" diff --git a/media/libcubeb/src/cubeb_opensl.c b/media/libcubeb/src/cubeb_opensl.c index 65520cf3fe8e..59cecfef4f68 100644 --- a/media/libcubeb/src/cubeb_opensl.c +++ b/media/libcubeb/src/cubeb_opensl.c @@ -168,8 +168,7 @@ struct cubeb_stream { int64_t lastPosition; int64_t lastPositionTimeStamp; int64_t lastCompensativePosition; - int voice_input; - int voice_output; + int voice; }; /* Forward declaration. */ @@ -960,8 +959,8 @@ opensl_configure_capture(cubeb_stream * stm, cubeb_stream_params * params) // Voice recognition is the lowest latency, according to the docs. Camcorder // uses a microphone that is in the same direction as the camera. - SLint32 streamType = stm->voice_input ? SL_ANDROID_RECORDING_PRESET_VOICE_RECOGNITION - : SL_ANDROID_RECORDING_PRESET_CAMCORDER; + SLint32 streamType = stm->voice ? SL_ANDROID_RECORDING_PRESET_VOICE_RECOGNITION + : SL_ANDROID_RECORDING_PRESET_CAMCORDER; res = (*recorderConfig) ->SetConfiguration(recorderConfig, SL_ANDROID_KEY_RECORDING_PRESET, @@ -1186,7 +1185,7 @@ opensl_configure_playback(cubeb_stream * stm, cubeb_stream_params * params) { } SLint32 streamType = SL_ANDROID_STREAM_MEDIA; - if (stm->voice_output) { + if (stm->voice) { streamType = SL_ANDROID_STREAM_VOICE; } res = (*playerConfig)->SetConfiguration(playerConfig, @@ -1386,11 +1385,10 @@ opensl_stream_init(cubeb * ctx, cubeb_stream ** stream, char const * stream_name stm->input_enabled = (input_stream_params) ? 1 : 0; stm->output_enabled = (output_stream_params) ? 1 : 0; stm->shutdown = 1; - stm->voice_input = has_pref_set(input_stream_params, NULL, CUBEB_STREAM_PREF_VOICE); - stm->voice_output = has_pref_set(NULL, output_stream_params, CUBEB_STREAM_PREF_VOICE); + stm->voice = has_pref_set(input_stream_params, output_stream_params, CUBEB_STREAM_PREF_VOICE); + + LOG("cubeb stream prefs: voice: %s", stm->voice ? "true" : "false"); - LOG("cubeb stream prefs: voice_input: %s voice_output: %s", stm->voice_input ? "true" : "false", - stm->voice_output ? "true" : "false"); #ifdef DEBUG pthread_mutexattr_t attr; diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index cd34d77d16c5..215733e0dc47 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -533,7 +533,6 @@ pref("media.videocontrols.picture-in-picture.video-toggle.min-video-secs", 45); pref("media.getusermedia.agc_enabled", true); pref("media.getusermedia.agc", 1); // kAdaptiveDigital pref("media.getusermedia.hpf_enabled", true); - pref("media.getusermedia.aecm_output_routing", 3); // kSpeakerphone // full_duplex: enable cubeb full-duplex capture/playback pref("media.navigator.audio.full_duplex", true); #endif // MOZ_WEBRTC @@ -583,8 +582,6 @@ pref("media.cubeb.logging_level", ""); pref("media.cubeb.backend", "audiounit-rust"); #endif -pref("media.cubeb.output_voice_routing", true); - // GraphRunner (fixed MediaTrackGraph thread) control pref("media.audiograph.single_thread.enabled", true);