Bug 1427932. P2 - fix the calculation of |endTime|. draft
authorJW Wang <jwwang@mozilla.com>
Thu, 04 Jan 2018 11:10:19 +0800
changeset 718313 350ff5e69f0db686e42f45439776e1e7f2f1e94a
parent 718312 09029796dc3e7788c3031485db7133a343d3a637
child 718379 767bdfc87e403853708cb2702c38ec814ef3519f
child 718414 0fb4ee1633a58145a74ce1c2e1e1bf2e1dd3842a
push id94873
push userjwwang@mozilla.com
push dateWed, 10 Jan 2018 02:07:25 +0000
bugs1427932
milestone59.0a1
Bug 1427932. P2 - fix the calculation of |endTime|. MozReview-Commit-ID: 2a8FxMdgM8e
dom/media/ogg/OggDemuxer.cpp
--- a/dom/media/ogg/OggDemuxer.cpp
+++ b/dom/media/ogg/OggDemuxer.cpp
@@ -1049,17 +1049,17 @@ OggDemuxer::FindStartTime(TrackInfo::Tra
 nsresult
 OggDemuxer::SeekInternal(TrackInfo::TrackType aType, const TimeUnit& aTarget)
 {
   int64_t target = aTarget.ToMicroseconds();
   OGG_DEBUG("About to seek to %" PRId64, target);
   nsresult res;
   int64_t adjustedTarget = target;
   int64_t startTime = StartTime(aType);
-  int64_t endTime = mInfo.mMetadataDuration->ToMicroseconds();
+  int64_t endTime = mInfo.mMetadataDuration->ToMicroseconds() + startTime;
   if (aType == TrackInfo::kAudioTrack && mOpusState){
     adjustedTarget = std::max(startTime, target - OGG_SEEK_OPUS_PREROLL);
   }
 
   if (!HaveStartTime(aType) || adjustedTarget == startTime) {
     // We've seeked to the media start or we can't seek.
     // Just seek to the offset of the first content page.
     res = Resource(aType)->Seek(nsISeekableStream::NS_SEEK_SET, 0);