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
Родитель 1a18fcce6e
Коммит e1fd229178
2 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -108,6 +108,7 @@ FFmpegVideoDecoder<LIBAV_VER>::FFmpegVideoDecoder(FFmpegLibWrapper* aLib,
, mImageContainer(aImageContainer) , mImageContainer(aImageContainer)
, mInfo(aConfig) , mInfo(aConfig)
, mCodecParser(nullptr) , mCodecParser(nullptr)
, mLastInputDts(INT64_MIN)
{ {
MOZ_COUNT_CTOR(FFmpegVideoDecoder); MOZ_COUNT_CTOR(FFmpegVideoDecoder);
// Use a new MediaByteBuffer as the object will be modified during initialization. // 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.data = aData;
packet.size = aSize; packet.size = aSize;
packet.dts = aSample->mTimecode; packet.dts = mLastInputDts = aSample->mTimecode;
packet.pts = aSample->mTime; packet.pts = aSample->mTime;
packet.flags = aSample->mKeyframe ? AV_PKT_FLAG_KEY : 0; packet.flags = aSample->mKeyframe ? AV_PKT_FLAG_KEY : 0;
packet.pos = aSample->mOffset; packet.pos = aSample->mOffset;
@ -312,7 +313,7 @@ void
FFmpegVideoDecoder<LIBAV_VER>::ProcessDrain() FFmpegVideoDecoder<LIBAV_VER>::ProcessDrain()
{ {
RefPtr<MediaRawData> empty(new MediaRawData()); RefPtr<MediaRawData> empty(new MediaRawData());
empty->mTimecode = mPtsContext.LastDts(); empty->mTimecode = mLastInputDts;
while (DoDecode(empty) == DecodeResult::DECODE_FRAME) { while (DoDecode(empty) == DecodeResult::DECODE_FRAME) {
} }
mCallback->DrainComplete(); mCallback->DrainComplete();

Просмотреть файл

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