Bug 1079174 - allow video playback when AudioStream init fails. r=kinetik
authorJW Wang <jwwang@mozilla.com>
Tue, 07 Oct 2014 15:55:00 +0200
changeset 209280 1d9f0405f64d133bfd196112905cc51f62ffe177
parent 209279 55b7368ee7f86ad27df12138c14b8a8468accc4e
child 209281 d25bc2a722d9b54829a57b4a0cdbb27e9ac83115
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerskinetik
bugs1079174
milestone35.0a1
Bug 1079174 - allow video playback when AudioStream init fails. r=kinetik
content/media/MediaDecoderStateMachine.cpp
--- a/content/media/MediaDecoderStateMachine.cpp
+++ b/content/media/MediaDecoderStateMachine.cpp
@@ -3138,17 +3138,23 @@ void MediaDecoderStateMachine::OnAudioSi
   AssertCurrentThreadInMonitor();
   // AudioSink not used with captured streams, so ignore errors in this case.
   if (mAudioCaptured) {
     return;
   }
 
   mAudioCompleted = true;
 
-  // Notify media decoder/element about this error.
+  // Make the best effort to continue playback when there is video.
+  if (HasVideo()) {
+    return;
+  }
+
+  // Otherwise notify media decoder/element about this error for it makes
+  // no sense to play an audio-only file without sound output.
   RefPtr<nsIRunnable> task(
     NS_NewRunnableMethod(this, &MediaDecoderStateMachine::OnDecodeError));
   nsresult rv = mDecodeTaskQueue->Dispatch(task);
   if (NS_FAILED(rv)) {
     DECODER_WARN("Failed to dispatch OnDecodeError");
   }
 }