Bug 1250934: Don't allow switching to a clock driver when we already have a switch pending r?padenot draft
authorRandell Jesup <rjesup@jesup.org>
Fri, 26 Feb 2016 00:36:24 -0500
changeset 334841 f0783430a5a474a59c32a272799a421926a42a75
parent 334840 3b9317a33f9d888401c07e9ad9fc89a4fc186710
child 334842 ce159423bcfee9cba4db0b813adbe66e6a9e1ba2
push id11645
push userrjesup@wgate.com
push dateFri, 26 Feb 2016 05:38:04 +0000
reviewerspadenot
bugs1250934
milestone47.0a1
Bug 1250934: Don't allow switching to a clock driver when we already have a switch pending r?padenot MozReview-Commit-ID: 8Xac0m6eUwq
dom/media/MediaStreamGraph.cpp
--- 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;