Bug 1428682 - set MediaData::mOffset properly in OggDemuxer. draft
authorJW Wang <jwwang@mozilla.com>
Mon, 08 Jan 2018 10:21:59 +0800
changeset 717148 eb8e018202fb24752f64737fcd53db98fd1dfc51
parent 717038 ce4e4baea6d769c5fb1d1b6f00324026e476ed14
child 745161 776064793345ebda49d1a6e263eb5dc55b89fc33
push id94572
push userjwwang@mozilla.com
push dateMon, 08 Jan 2018 09:16:55 +0000
bugs1428682, 1427527
milestone59.0a1
Bug 1428682 - set MediaData::mOffset properly in OggDemuxer. mOffset is important for MediaCache to evaluate the playback rate in bytes for a live stream. Failing to set this field (initially 0) will cause MediaCache to assume very low playback rate (in bytes) and not to download enough bytes for decoder to consume without underflow. This issue is manifested by bug 1427527 where a live ogg stream is played. MozReview-Commit-ID: JiaXtpWCl09
dom/media/ogg/OggDemuxer.cpp
--- a/dom/media/ogg/OggDemuxer.cpp
+++ b/dom/media/ogg/OggDemuxer.cpp
@@ -1359,16 +1359,17 @@ OggTrackDemuxer::NextSample()
   // mDecodedAudioDuration gets adjusted during ReadOggChain().
   TimeUnit totalDuration = mParent->mDecodedAudioDuration;
   if (eos) {
     // We've encountered an end of bitstream packet; check for a chained
     // bitstream following this one.
     // This will also update mSharedAudioTrackInfo.
     mParent->ReadOggChain(data->GetEndTime());
   }
+  data->mOffset = mParent->Resource(mType)->Tell();
   // We adjust the start time of the sample to account for the potential ogg chaining.
   data->mTime += totalDuration;
   return data;
 }
 
 RefPtr<OggTrackDemuxer::SamplesPromise>
 OggTrackDemuxer::GetSamples(int32_t aNumSamples)
 {