mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-17 20:17:55 +02:00
avcodec/mediacodecdec: try to receive a frame after signaling EOF to the codec
Avoids returning EAGAIN after signaling EOF to the codec in ff_mediacodec_dec_send() so we can try to receive a frame before returning in mediacodec_receive_frame(). This helps avoiding an extra round-trip between avcodec_send_frame() and avcodec_receive_frame() while draining the remaining frames.
This commit is contained in:
parent
caabe1b495
commit
d83985ce11
@ -461,6 +461,7 @@ static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
|
||||
ret = ff_mediacodec_dec_send(avctx, s->ctx, &null_pkt, true);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
return ff_mediacodec_dec_receive(avctx, s->ctx, frame, true);
|
||||
} else if (ret == AVERROR(EAGAIN) && s->ctx->current_input_buffer < 0) {
|
||||
return ff_mediacodec_dec_receive(avctx, s->ctx, frame, true);
|
||||
} else if (ret < 0) {
|
||||
|
@ -631,7 +631,7 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s,
|
||||
"Queued input buffer %zd size=%zd ts=%"PRIi64"\n", index, size, pts);
|
||||
|
||||
s->draining = 1;
|
||||
break;
|
||||
return 0;
|
||||
} else {
|
||||
size = FFMIN(pkt->size - offset, size);
|
||||
memcpy(data, pkt->data + offset, size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user