зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1264195: Re-add SetMicrophoneActive() calls into the GraphDriver r=padenot
This commit is contained in:
Родитель
83416e4345
Коммит
68a3156330
|
@ -660,6 +660,13 @@ AudioCallbackDriver::Init()
|
|||
return;
|
||||
}
|
||||
}
|
||||
#ifdef XP_MACOSX
|
||||
// Currently, only mac cares about this
|
||||
bool aec;
|
||||
Unused << mGraphImpl->AudioTrackPresent(aec);
|
||||
SetMicrophoneActive(aec);
|
||||
#endif
|
||||
|
||||
cubeb_stream_register_device_changed_callback(mAudioStream,
|
||||
AudioCallbackDriver::DeviceChangedCallback_s);
|
||||
|
||||
|
@ -1063,6 +1070,7 @@ void AudioCallbackDriver::PanOutputIfNeeded(bool aMicrophoneActive)
|
|||
|
||||
void
|
||||
AudioCallbackDriver::DeviceChangedCallback() {
|
||||
#ifdef XP_MACOSX
|
||||
MonitorAutoLock mon(mGraphImpl->GetMonitor());
|
||||
PanOutputIfNeeded(mMicrophoneActive);
|
||||
// On OSX, changing the output device causes the audio thread to no call the
|
||||
|
@ -1071,7 +1079,7 @@ AudioCallbackDriver::DeviceChangedCallback() {
|
|||
// We switch to a system driver until audio callbacks are called again, so we
|
||||
// still pull from the input stream, so that everything works apart from the
|
||||
// audio output.
|
||||
#ifdef XP_MACOSX
|
||||
|
||||
// Don't bother doing the device switching dance if the graph is not RUNNING
|
||||
// (starting up, shutting down), because we haven't started pulling from the
|
||||
// SourceMediaStream.
|
||||
|
@ -1096,11 +1104,13 @@ AudioCallbackDriver::DeviceChangedCallback() {
|
|||
void
|
||||
AudioCallbackDriver::SetMicrophoneActive(bool aActive)
|
||||
{
|
||||
#ifdef XP_MACOSX
|
||||
MonitorAutoLock mon(mGraphImpl->GetMonitor());
|
||||
|
||||
mMicrophoneActive = aActive;
|
||||
|
||||
PanOutputIfNeeded(mMicrophoneActive);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
|
|
@ -420,6 +420,8 @@ namespace {
|
|||
bool
|
||||
MediaStreamGraphImpl::AudioTrackPresent(bool& aNeedsAEC)
|
||||
{
|
||||
AssertOnGraphThreadOrNotRunning();
|
||||
|
||||
bool audioTrackPresent = false;
|
||||
for (uint32_t i = 0; i < mStreams.Length() && audioTrackPresent == false; ++i) {
|
||||
MediaStream* stream = mStreams[i];
|
||||
|
@ -501,13 +503,21 @@ MediaStreamGraphImpl::UpdateStreamOrder()
|
|||
}
|
||||
|
||||
#ifdef MOZ_WEBRTC
|
||||
// Whenever we change AEC state, notify the current driver, which also
|
||||
// will sample the state when the driver inits
|
||||
if (shouldAEC && !mFarendObserverRef && gFarendObserver) {
|
||||
mFarendObserverRef = gFarendObserver;
|
||||
mMixer.AddCallback(mFarendObserverRef);
|
||||
if (CurrentDriver()->AsAudioCallbackDriver()) {
|
||||
CurrentDriver()->AsAudioCallbackDriver()->SetMicrophoneActive(true);
|
||||
}
|
||||
} else if (!shouldAEC && mFarendObserverRef){
|
||||
if (mMixer.FindCallback(mFarendObserverRef)) {
|
||||
mMixer.RemoveCallback(mFarendObserverRef);
|
||||
mFarendObserverRef = nullptr;
|
||||
if (CurrentDriver()->AsAudioCallbackDriver()) {
|
||||
CurrentDriver()->AsAudioCallbackDriver()->SetMicrophoneActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче