Skip to content
Snippets Groups Projects
Commit 064c4bc1 authored by Philippe Gorley's avatar Philippe Gorley
Browse files

media: don't return failure code if EAGAIN

FFmpeg docs state that if avcodec_send_packet returns EAGAIN,
avcodec_receive_frame must be called; it is not an error.

Change-Id: I5e84a8a0103fe868056915b9c4ea2fc8d090f7ee
parent 1353a641
Branches
Tags
No related merge requests found
......@@ -272,7 +272,7 @@ MediaDecoder::decode(VideoFrame& result)
auto frame = result.pointer();
int frameFinished = 0;
ret = avcodec_send_packet(decoderCtx_, &inpacket);
if (ret < 0) {
if (ret < 0 && ret != AVERROR(EAGAIN)) {
return ret == AVERROR_EOF ? Status::Success : Status::DecodeError;
}
ret = avcodec_receive_frame(decoderCtx_, frame);
......@@ -343,7 +343,7 @@ MediaDecoder::decode(const AudioFrame& decodedFrame)
int frameFinished = 0;
ret = avcodec_send_packet(decoderCtx_, &inpacket);
if (ret < 0)
if (ret < 0 && ret != AVERROR(EAGAIN))
return ret == AVERROR_EOF ? Status::Success : Status::DecodeError;
ret = avcodec_receive_frame(decoderCtx_, frame);
......@@ -393,7 +393,7 @@ MediaDecoder::flush(VideoFrame& result)
int frameFinished = 0;
int ret = 0;
ret = avcodec_send_packet(decoderCtx_, &inpacket);
if (ret < 0)
if (ret < 0 && ret != AVERROR(EAGAIN))
return ret == AVERROR_EOF ? Status::Success : Status::DecodeError;
ret = avcodec_receive_frame(decoderCtx_, result.pointer());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment