Bug 1487792 - Do not drain the FFmpeg parsers. r=bryce

In FFmpeg 4.0 and later, draining the parser will cause later decoding error as the decoder expects to only be fed a null packet.
It was also unnecessary for earlier version of FFmpeg

Differential Revision: https://phabricator.services.mozilla.com/D5056

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jean-Yves Avenard 2018-09-06 11:18:28 +00:00
Родитель 79c7b523f8
Коммит 43c1f52a3b
1 изменённых файлов: 4 добавлений и 4 удалений

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

@ -155,11 +155,11 @@ FFmpegDataDecoder<LIBAV_VER>::DoDecode(MediaRawData* aSample, bool* aGotFrame,
mLastInputDts = aSample->mTimecode;
if (mCodecParser) {
if (inputData && mCodecParser) { // inputData is null when draining.
if (aGotFrame) {
*aGotFrame = false;
}
do {
while (inputSize) {
uint8_t* data = inputData;
int size = inputSize;
int len = mLib->av_parser_parse2(
@ -169,7 +169,7 @@ FFmpegDataDecoder<LIBAV_VER>::DoDecode(MediaRawData* aSample, bool* aGotFrame,
if (size_t(len) > inputSize) {
return NS_ERROR_DOM_MEDIA_DECODE_ERR;
}
if (size || !inputSize) {
if (size) {
bool gotFrame = false;
MediaResult rv = DoDecode(aSample, data, size, &gotFrame, aResults);
if (NS_FAILED(rv)) {
@ -181,7 +181,7 @@ FFmpegDataDecoder<LIBAV_VER>::DoDecode(MediaRawData* aSample, bool* aGotFrame,
}
inputData += len;
inputSize -= len;
} while (inputSize > 0);
}
return NS_OK;
}
return DoDecode(aSample, inputData, inputSize, aGotFrame, aResults);