Bug 1175768 - Make the logic in MDSM::NotifyDataArrived apply to mObservedDuration. r=jya
☠☠ backed out by 85029878321b ☠ ☠
authorBobby Holley <bobbyholley@gmail.com>
Tue, 16 Jun 2015 16:36:42 -0700
changeset 250025 2d2cefa397dc8e341e5d36f46ba42adac63c8e17
parent 250024 4e06368496d22568512f9c9a1d4fff91565b1735
child 250026 41ffc9a9ac4801348bbb7e5c836b3ecb98186c8a
push id28943
push usercbook@mozilla.com
push dateWed, 24 Jun 2015 14:02:00 +0000
treeherdermozilla-central@4cdc1a95a672 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1175768
milestone41.0a1
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
Bug 1175768 - Make the logic in MDSM::NotifyDataArrived apply to mObservedDuration. r=jya With this change, we don't need to condition this work on infinite streams.
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1641,36 +1641,28 @@ void MediaDecoderStateMachine::Logically
 
 void MediaDecoderStateMachine::NotifyDataArrived(const char* aBuffer,
                                                      uint32_t aLength,
                                                      int64_t aOffset)
 {
   NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
   mReader->NotifyDataArrived(aBuffer, aLength, aOffset);
 
-  // While playing an unseekable stream of unknown duration, mDuration is
-  // updated (in AdvanceFrame()) as we play. But if data is being downloaded
-  // faster than played, mDuration won't reflect the end of playable data
+  // While playing an unseekable stream of unknown duration, mObservedDuration
+  // is updated (in AdvanceFrame()) as we play. But if data is being downloaded
+  // faster than played, mObserved won't reflect the end of playable data
   // since we haven't played the frame at the end of buffered data. So update
-  // mDuration here as new data is downloaded to prevent such a lag.
-  //
-  // Make sure to only do this if we have a start time, otherwise the reader
-  // doesn't know how to compute GetBuffered.
-  if (!mDecoder->IsInfinite() || !HaveStartTime())
-  {
-    return;
-  }
-
+  // mObservedDuration here as new data is downloaded to prevent such a lag.
   media::TimeIntervals buffered{mDecoder->GetBuffered()};
   if (!buffered.IsInvalid()) {
     bool exists;
     media::TimeUnit end{buffered.GetEnd(&exists)};
     if (exists) {
       ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
-      mDuration = Some(std::max<TimeUnit>(Duration(), end));
+      mObservedDuration = std::max(mObservedDuration.Ref(), end);
     }
   }
 }
 
 nsRefPtr<MediaDecoder::SeekPromise>
 MediaDecoderStateMachine::Seek(SeekTarget aTarget)
 {
   MOZ_ASSERT(OnTaskQueue());