void AudioCallbackDriver::DeviceChangedCallback() { MonitorAutoLock mon(mGraphImpl->GetMonitor()); PanOutputIfNeeded(mMicrophoneActive); // On OSX, changing the output device causes the audio thread to no call the // audio callback, so we're unable to process real-time input data, and this // results in latency building up. // 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. if (!GraphImpl()->Running()) { return; } if (mSelfReference) { return; } STREAM_LOG(LogLevel::Error, ("Switching to SystemClockDriver during output switch")); mSelfReference.Take(this); mCallbackReceivedWhileSwitching = 0; mNextDriver = new SystemClockDriver(GraphImpl()); mNextDriver->SetGraphTime(this, mIterationStart, mIterationEnd); mGraphImpl->SetCurrentDriver(mNextDriver); mNextDriver->Start(); #endif }
void AudioStream::DeviceChangedCallback() { MonitorAutoLock mon(mMonitor); PanOutputIfNeeded(mMicrophoneActive); mShouldDropFrames = true; ResetStreamIfNeeded(); }
void AudioCallbackDriver::SetMicrophoneActive(bool aActive) { MonitorAutoLock mon(mGraphImpl->GetMonitor()); mMicrophoneActive = aActive; PanOutputIfNeeded(mMicrophoneActive); }
void AudioStream::SetMicrophoneActive(bool aActive) { MonitorAutoLock mon(mMonitor); mMicrophoneActive = aActive; PanOutputIfNeeded(mMicrophoneActive); }
void AudioStream::StartUnlocked() { mMonitor.AssertCurrentThreadOwns(); if (!mCubebStream) { mNeedsStart = true; return; } if (mState == INITIALIZED) { int r; { MonitorAutoUnlock mon(mMonitor); r = cubeb_stream_start(mCubebStream.get()); PanOutputIfNeeded(mMicrophoneActive); } mState = r == CUBEB_OK ? STARTED : ERRORED; LOG(("AudioStream: started %p, state %s", this, mState == STARTED ? "STARTED" : "ERRORED")); } }
void AudioCallbackDriver::DeviceChangedCallback() { MonitorAutoLock mon(mGraphImpl->GetMonitor()); PanOutputIfNeeded(mMicrophoneActive); }