Bug 1531833 - Expose a way to set a global "communication mode" in CubebUtils, to be use by real-time duplex audio users. r=pehrsons

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Paul Adenot 2019-04-16 15:42:33 +00:00
parent 2867cb1c22
commit cd545b34bb
2 changed files with 10 additions and 0 deletions

View File

@ -309,6 +309,12 @@ void ForceSetCubebContext(cubeb* aCubebContext) {
sCubebState = CubebState::Initialized;
}
void SetInCommunication(bool aInCommunication) {
#ifdef MOZ_WIDGET_ANDROID
java::GeckoAppShell::SetCommunicationAudioModeOn(aInCommunication);
#endif
}
bool InitPreferredSampleRate() {
StaticMutexAutoLock lock(sMutex);
if (sPreferredSampleRate != 0) {

View File

@ -45,6 +45,10 @@ bool CubebLatencyPrefSet();
void GetCurrentBackend(nsAString& aBackend);
cubeb_stream_prefs GetDefaultStreamPrefs();
char* GetForcedOutputDevice();
// No-op on all platforms but Android, where it tells the device's AudioManager
// to switch to "communication mode", which might change audio routing,
// bluetooth communication type, etc.
void SetInCommunication(bool aInCommunication);
# ifdef MOZ_WIDGET_ANDROID
uint32_t AndroidGetAudioOutputSampleRate();