[FFmpeg-devel] [PATCH] lavc/opusenc: add frame_alloc and frame_count check to quit encode

Paul B Mahol onemda at gmail.com
Thu Nov 29 12:36:52 EET 2018


On 11/29/18, Linjie Fu <linjie.fu at intel.com> wrote:
> Add frame_alloc and frame_count check in opus_encode_frame to avoid
> the infinite loop issue.
>
> Fix #7578.
>
> Signed-off-by: Linjie Fu <linjie.fu at intel.com>
> ---
>  libavcodec/opusenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/opusenc.c b/libavcodec/opusenc.c
> index 578785f4b4..7146968fc8 100644
> --- a/libavcodec/opusenc.c
> +++ b/libavcodec/opusenc.c
> @@ -543,7 +543,7 @@ static int opus_encode_frame(AVCodecContext *avctx,
> AVPacket *avpkt,
>          ff_bufqueue_add(avctx, &s->bufqueue, av_frame_clone(frame));
>      } else {
>          ff_opus_psy_signal_eof(&s->psyctx);
> -        if (!s->afq.remaining_samples)
> +        if (!s->afq.remaining_samples || (!s->afq.frame_alloc &&
> !s->afq.frame_count))
>              return 0; /* We've been flushed and there's nothing left to
> encode */

lgtm


More information about the ffmpeg-devel mailing list