Bug 1417300 - adjust sample time before calculating the total decoded duration. r=jya a=gchang
authorAlastor Wu <alwu@mozilla.com>
Fri, 01 Dec 2017 10:54:13 +0800
changeset 445200 41aed9dafb970c76f7e39d2f9e2ab81468c48cc8
parent 445199 9f5941f54c78c6f8c3077623ff6e961a08318192
child 445201 997725a940f38cab23feed2f616a22fc1573e076
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya, gchang
bugs1417300
milestone58.0
Bug 1417300 - adjust sample time before calculating the total decoded duration. r=jya a=gchang We do not want to perform the adjustment of the timestamp after reading the ogg chain but before. Otherwise the parent's mDecodedAudioDuration would be adjusted causing the sample's time to be twice the value it should be. MozReview-Commit-ID: 50VrOCzrwFg
dom/media/ogg/OggDemuxer.cpp
--- a/dom/media/ogg/OggDemuxer.cpp
+++ b/dom/media/ogg/OggDemuxer.cpp
@@ -1343,23 +1343,27 @@ OggTrackDemuxer::NextSample()
   OggCodecState* state = mParent->GetTrackCodecState(mType);
   RefPtr<MediaRawData> data = state->PacketOutAsMediaRawData();
   if (!data) {
     return nullptr;
   }
   if (mType == TrackInfo::kAudioTrack) {
     data->mTrackInfo = mParent->mSharedAudioTrackInfo;
   }
+  // We do not want to perform the adjustment of the timestamp after reading
+  // the ogg chain but before. Otherwise the parent's mDecodedAudioDuration
+  // would be adjusted causing the sample's time to be twice the value it
+  // should be.
+  data->mTime += 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->mTime += mParent->mDecodedAudioDuration;
   return data;
 }
 
 RefPtr<OggTrackDemuxer::SamplesPromise>
 OggTrackDemuxer::GetSamples(int32_t aNumSamples)
 {
   RefPtr<SamplesHolder> samples = new SamplesHolder;
   if (!aNumSamples) {