Bug 1386478 - don't cap the return value of GetEndTime(). draft
authorJW Wang <jwwang@mozilla.com>
Wed, 02 Aug 2017 10:45:48 +0800
changeset 619463 9d780d33bb82436f80b0918120c9845fc44ff06e
parent 619442 fec8d72590053c3ad72cd3492d389213dfabc2ff
child 640402 b211830e871c9b7cbc225952c4013d472e40c2f2
push id71684
push userjwwang@mozilla.com
push dateWed, 02 Aug 2017 02:46:31 +0000
bugs1386478
milestone56.0a1
Bug 1386478 - don't cap the return value of GetEndTime(). A chained ogg file contains multiple streams and timestamps will not monolithically increase. The current code will cap AudioEndTime() to the end time of the 1st stream and currentTime won't be updated correctly when playback position reaches the 2nd stream or later ones. http://searchfox.org/mozilla-central/rev/bbc1c59e460a27b20929b56489e2e55438de81fa/dom/media/MediaDecoderStateMachine.cpp#3636-3637 MozReview-Commit-ID: DbIspYmEjVv
dom/media/mediasink/AudioSink.cpp
--- a/dom/media/mediasink/AudioSink.cpp
+++ b/dom/media/mediasink/AudioSink.cpp
@@ -228,19 +228,17 @@ AudioSink::GetEndTime() const
     MonitorAutoLock mon(mMonitor);
     written = mWritten;
   }
   TimeUnit played = FramesToTimeUnit(written, mOutputRate) + mStartTime;
   if (!played.IsValid()) {
     NS_WARNING("Int overflow calculating audio end time");
     return TimeUnit::Zero();
   }
-  // As we may be resampling, rounding errors may occur. Ensure we never get
-  // past the original end time.
-  return std::min(mLastEndTime, played);
+  return played;
 }
 
 UniquePtr<AudioStream::Chunk>
 AudioSink::PopFrames(uint32_t aFrames)
 {
   class Chunk : public AudioStream::Chunk {
   public:
     Chunk(AudioData* aBuffer, uint32_t aFrames, AudioDataValue* aData)