Bug 1427932. P2 - fix the calculation of |endTime|. draft
authorJW Wang <jwwang@mozilla.com>
Thu, 04 Jan 2018 11:10:19 +0800
changeset 715550 49211ab256d7742cf83b16e6a2fa6ed3d53f1b46
parent 715549 ab0dab8a566c0090dd900a9fbcdd97cc7b622cbc
child 715551 8e0d9ccc85f28e14174511c0d6fb331e546568bb
push id94182
push userjwwang@mozilla.com
push dateThu, 04 Jan 2018 03:51:57 +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);