Bug 1250934: Don't allow switching to a clock driver when we already have a switch pending r?padenot
MozReview-Commit-ID: 8Xac0m6eUwq
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -357,22 +357,24 @@ MediaStreamGraphImpl::UpdateStreamOrder(
} else {
for (StreamBuffer::TrackIter tracks(stream->GetStreamBuffer(), MediaSegment::AUDIO);
!tracks.IsEnded(); tracks.Next()) {
audioTrackPresent = true;
}
}
}
// Note that this looks for any audio streams, input or output, and switches to a
- // SystemClockDriver if there are none
+ // SystemClockDriver if there are none. However, if another is already pending, let that
+ // switch happen.
if (!audioTrackPresent && mRealtime &&
CurrentDriver()->AsAudioCallbackDriver()) {
MonitorAutoLock mon(mMonitor);
- if (CurrentDriver()->AsAudioCallbackDriver()->IsStarted()) {
+ if (CurrentDriver()->AsAudioCallbackDriver()->IsStarted() &&
+ !(CurrentDriver()->Switching())) {
if (mLifecycleState == LIFECYCLE_RUNNING) {
SystemClockDriver* driver = new SystemClockDriver(this);
CurrentDriver()->SwitchAtNextIteration(driver);
}
}
}
bool switching = false;