From 82b4acee73f16b7279470c651b166f193d420e80 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Tue, 6 Mar 2018 12:25:50 +0100 Subject: [PATCH] Do not fail on EAGAIN A call to avcodec_receive_frame() may return AVERROR(EAGAIN) if more input is required. This is not an error, do not fail. --- app/src/decoder.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/decoder.c b/app/src/decoder.c index 8c912715..da1408de 100644 --- a/app/src/decoder.c +++ b/app/src/decoder.c @@ -100,12 +100,14 @@ static int run_decoder(void *data) { LOGE("Could not send video packet: %d", ret); goto run_quit; } - if ((ret = avcodec_receive_frame(codec_ctx, decoder->frames->decoding_frame)) < 0) { + ret = avcodec_receive_frame(codec_ctx, decoder->frames->decoding_frame); + if (!ret) { + // a frame was received + push_frame(decoder); + } else if (ret != AVERROR(EAGAIN)) { LOGE("Could not receive video frame: %d", ret); goto run_quit; } - - push_frame(decoder); #else while (packet.size > 0) { int got_picture;