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
This commit is contained in:
Jean-Yves Avenard 2016-05-23 15:37:34 +10:00
parent 1a18fcce6e
commit e1fd229178
2 changed files with 4 additions and 2 deletions

View File

@ -108,6 +108,7 @@ FFmpegVideoDecoder<LIBAV_VER>::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<LIBAV_VER>::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<LIBAV_VER>::ProcessDrain()
{
RefPtr<MediaRawData> empty(new MediaRawData());
empty->mTimecode = mPtsContext.LastDts();
empty->mTimecode = mLastInputDts;
while (DoDecode(empty) == DecodeResult::DECODE_FRAME) {
}
mCallback->DrainComplete();

View File

@ -82,6 +82,7 @@ private:
};
PtsCorrectionContext mPtsContext;
int64_t mLastInputDts;
class DurationMap {
public: