Backed out changeset 71b9d48efac6 (bug 1286041) for failing wpt mediasource-seek-beyond-duration.html on Linux. r=backout on a CLOSED TREE
authorSebastian Hengst <archaeopteryx@coole-files.de>
Tue, 06 Sep 2016 19:08:20 +0200
changeset 312841 83c6065c6f646825990b0779b9820d2da0213bd0
parent 312840 6a8fbd7e5e9fe94384a05da1a49d5a008f1133af
child 312842 3ba67e3bb588f782b07af82139980800b348f1e8
child 312898 c27d9a2bc26136de943b9a114aa326db414cf6fb
push id30661
push userkwierso@gmail.com
push dateWed, 07 Sep 2016 00:28:11 +0000
treeherdermozilla-central@3ba67e3bb588 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1286041
milestone51.0a1
backs out71b9d48efac6b0034ee7a653eb73f99ebb077055
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 71b9d48efac6 (bug 1286041) for failing wpt mediasource-seek-beyond-duration.html on Linux. r=backout on a CLOSED TREE
dom/media/AudioStream.cpp
--- a/dom/media/AudioStream.cpp
+++ b/dom/media/AudioStream.cpp
@@ -395,22 +395,19 @@ AudioStream::SetVolume(double aVolume)
   }
 }
 
 void
 AudioStream::Start()
 {
   MonitorAutoLock mon(mMonitor);
   MOZ_ASSERT(mState == INITIALIZED);
-  mState = STARTED;
   auto r = InvokeCubeb(cubeb_stream_start);
-  if (r != CUBEB_OK) {
-    mState = ERRORED;
-  }
-  LOG("started, state %s", mState == STARTED ? "STARTED" : mState == DRAINED ? "DRAINED" : "ERRORED");
+  mState = r == CUBEB_OK ? STARTED : ERRORED;
+  LOG("started, state %s", mState == STARTED ? "STARTED" : "ERRORED");
 }
 
 void
 AudioStream::Pause()
 {
   MonitorAutoLock mon(mMonitor);
   MOZ_ASSERT(mState != INITIALIZED, "Must be Start()ed.");
   MOZ_ASSERT(mState != STOPPED, "Already Pause()ed.");
@@ -591,17 +588,23 @@ long
 AudioStream::DataCallback(void* aBuffer, long aFrames)
 {
   MonitorAutoLock mon(mMonitor);
   MOZ_ASSERT(mState != SHUTDOWN, "No data callback after shutdown");
 
   auto writer = AudioBufferWriter(
     reinterpret_cast<AudioDataValue*>(aBuffer), mOutChannels, aFrames);
 
-  MOZ_ASSERT(mState != INITIALIZED);
+  // FIXME: cubeb_pulse sometimes calls us before cubeb_stream_start() is called.
+  // We don't want to consume audio data until Start() is called by the client.
+  if (mState == INITIALIZED) {
+    NS_WARNING("data callback fires before cubeb_stream_start() is called");
+    mAudioClock.UpdateFrameHistory(0, aFrames);
+    return writer.WriteZeros(aFrames);
+  }
 
   // NOTE: wasapi (others?) can call us back *after* stop()/Shutdown() (mState == SHUTDOWN)
   // Bug 996162
 
   if (mAudioClock.GetInputRate() == mAudioClock.GetOutputRate()) {
     GetUnprocessed(writer);
   } else {
     GetTimeStretched(writer);