Skip to content
Snippets Groups Projects
Commit 709d5236 authored by Jean-Yves Avenard's avatar Jean-Yves Avenard
Browse files

Bug 1406503 - P3. Also drain av_parser when draining. r=jwwang

Per FFmpeg documentation: to signal EOF to the av_parser, input length should be 0 (so that the last frame can be output).

MozReview-Commit-ID: F22RcRnT3HS

--HG--
extra : rebase_source : f704e33526347244d38d1ab0b7fa1e5a0cda84cb
parent 58d8f58f
No related branches found
No related tags found
No related merge requests found
......@@ -140,8 +140,11 @@ FFmpegDataDecoder<LIBAV_VER>::DoDecode(MediaRawData* aSample, bool* aGotFrame,
mLastInputDts = aSample->mTimecode;
if (inputSize && mCodecParser) {
while (inputSize) {
if (mCodecParser) {
if (aGotFrame) {
*aGotFrame = false;
}
do {
uint8_t* data = inputData;
int size = inputSize;
int len = mLib->av_parser_parse2(
......@@ -151,9 +154,7 @@ FFmpegDataDecoder<LIBAV_VER>::DoDecode(MediaRawData* aSample, bool* aGotFrame,
if (size_t(len) > inputSize) {
return NS_ERROR_DOM_MEDIA_DECODE_ERR;
}
inputData += len;
inputSize -= len;
if (size) {
if (size || !inputSize) {
bool gotFrame = false;
MediaResult rv = DoDecode(aSample, data, size, &gotFrame, aResults);
if (NS_FAILED(rv)) {
......@@ -163,7 +164,9 @@ FFmpegDataDecoder<LIBAV_VER>::DoDecode(MediaRawData* aSample, bool* aGotFrame,
*aGotFrame = true;
}
}
}
inputData += len;
inputSize -= len;
} while (inputSize > 0);
return NS_OK;
}
return DoDecode(aSample, inputData, inputSize, aGotFrame, aResults);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment