From e1fd229178f5df7c31144aaae3fa73da8d8d7c6f Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Mon, 23 May 2016 15:37:34 +1000 Subject: [PATCH] Bug 1270323: [ffmpeg] P3. Use the dts of the last sample input, not the dts of the last decoded sample. r=cpearce Amendment to bug 1244410. If no frames had been output yet, last dts would have been INT64_MIN. MozReview-Commit-ID: LOdWLpyuLYm --HG-- extra : rebase_source : f842d2214b1e82f3b069e843157b95d87e62fa01 --- dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp | 5 +++-- dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp index e2d48c0c5c66..15136a9baa3f 100644 --- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp +++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp @@ -108,6 +108,7 @@ FFmpegVideoDecoder::FFmpegVideoDecoder(FFmpegLibWrapper* aLib, , mImageContainer(aImageContainer) , mInfo(aConfig) , mCodecParser(nullptr) + , mLastInputDts(INT64_MIN) { MOZ_COUNT_CTOR(FFmpegVideoDecoder); // Use a new MediaByteBuffer as the object will be modified during initialization. @@ -210,7 +211,7 @@ FFmpegVideoDecoder::DoDecode(MediaRawData* aSample, packet.data = aData; packet.size = aSize; - packet.dts = aSample->mTimecode; + packet.dts = mLastInputDts = aSample->mTimecode; packet.pts = aSample->mTime; packet.flags = aSample->mKeyframe ? AV_PKT_FLAG_KEY : 0; packet.pos = aSample->mOffset; @@ -312,7 +313,7 @@ void FFmpegVideoDecoder::ProcessDrain() { RefPtr empty(new MediaRawData()); - empty->mTimecode = mPtsContext.LastDts(); + empty->mTimecode = mLastInputDts; while (DoDecode(empty) == DecodeResult::DECODE_FRAME) { } mCallback->DrainComplete(); diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h index edb2657b8b05..ce045899ecca 100644 --- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h +++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h @@ -82,6 +82,7 @@ private: }; PtsCorrectionContext mPtsContext; + int64_t mLastInputDts; class DurationMap { public: