Bug 1314554 - Don't enter dormant when the media is not seekable. draft
authorJW Wang <jwwang@mozilla.com>
Wed, 09 Nov 2016 14:21:16 +0800
changeset 437013 b7620334bb6a79e4807ef167d558dc288a674534
parent 437012 911e8e48728e0a171579d42f0a0c99a75db28962
child 437016 6a156ca2431c6bf80103e5f1d9a5ec472a7a6de4
push id35283
push userjwwang@mozilla.com
push dateThu, 10 Nov 2016 07:19:44 +0000
bugs1314554
milestone52.0a1
Bug 1314554 - Don't enter dormant when the media is not seekable. This change deals with chained ogg files. A decoding error is encountered even without seeking when exiting dormant. For now, we disable dormant for there files that are not seekable to avoid playback looks broken (due to decode error when exiting dormant) on Firefox. MozReview-Commit-ID: 72axKPHwoIi
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -701,16 +701,22 @@ private:
 
   void EnterDormant()
   {
     SetState<DormantState>();
   }
 
   void StartDormantTimer()
   {
+    if (!mMaster->mMediaSeekable) {
+      // Don't enter dormant if the media is not seekable because we need to
+      // seek when exiting dormant.
+      return;
+    }
+
     auto timeout = MediaPrefs::DormantOnPauseTimeout();
     if (timeout < 0) {
       // Disabled when timeout is negative.
       return;
     } else if (timeout == 0) {
       // Enter dormant immediately without scheduling a timer.
       EnterDormant();
       return;