[FFmpeg-devel] [PATCH] avcodec/mediacodecdec: Skip dequeue buffer in draining state

Matthieu Bouron matthieu.bouron at gmail.com
Sat Aug 24 17:11:40 EEST 2024


On Fri, Aug 23, 2024 at 7:20 PM Zhao Zhili <quinkblack at foxmail.com> wrote:
>
> From: Zhao Zhili <zhilizhao at tencent.com>
>
> There is no more buffer to queue in draining state

nit: There is no more input buffer to dequeue in draining state.

>
> Signed-off-by: Zhao Zhili <zhilizhao at tencent.com>
> ---
>  libavcodec/mediacodecdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
> index 6d8dc600fe..0da5fe6729 100644
> --- a/libavcodec/mediacodecdec.c
> +++ b/libavcodec/mediacodecdec.c
> @@ -462,7 +462,7 @@ static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
>
>      /* feed decoder */
>      while (1) {
> -        if (s->ctx->current_input_buffer < 0) {
> +        if (s->ctx->current_input_buffer < 0 && !s->ctx->draining) {
>              /* poll for input space */
>              index = ff_AMediaCodec_dequeueInputBuffer(s->ctx->codec, 0);
>              if (index < 0) {

Other than my remark on the commit desc, LGTM.


More information about the ffmpeg-devel mailing list