You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
opusenc: fix infinite loop if flushing encoder upon init
The issue is that the afq still has samples as on init it counts the overlap used as a delay to adjust the PTS it generates, hence we can't rely on it right after init. So just check to see if any frames have been encoded. frame_number can't be anything but 0 right after init and can only be set by lavc. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
This commit is contained in:
@@ -543,7 +543,7 @@ static int opus_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
|||||||
ff_bufqueue_add(avctx, &s->bufqueue, av_frame_clone(frame));
|
ff_bufqueue_add(avctx, &s->bufqueue, av_frame_clone(frame));
|
||||||
} else {
|
} else {
|
||||||
ff_opus_psy_signal_eof(&s->psyctx);
|
ff_opus_psy_signal_eof(&s->psyctx);
|
||||||
if (!s->afq.remaining_samples)
|
if (!s->afq.remaining_samples || !avctx->frame_number)
|
||||||
return 0; /* We've been flushed and there's nothing left to encode */
|
return 0; /* We've been flushed and there's nothing left to encode */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user