[FFmpeg-devel] [PATCH 1/2] lavc/libmp3lame: send encoder delay/padding in packet side data

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Sat Oct 15 12:54:58 EEST 2016


On 05.10.2016 21:37, Jon Toohill wrote:
> ---
>  libavcodec/libmp3lame.c | 26 +++++++++++++++++++++++++-
>  1 file changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c
> index 5642264..b3ba0d8 100644
> --- a/libavcodec/libmp3lame.c
> +++ b/libavcodec/libmp3lame.c
[...]
> @@ -269,6 +270,29 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
>          ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts,
>                             &avpkt->duration);
>  
> +        discard_padding = avctx->frame_size - avpkt->duration;
> +        // Check if subtraction resulted in an overflow
> +        if ((discard_padding < avctx->frame_size) != (avpkt->duration > 0)) {
> +            av_packet_unref(avpkt);
> +            av_free(avpkt);

It would be nice to have an av_log here reporting the problem.
Otherwise patch LGTM.

Best regards,
Andreas


More information about the ffmpeg-devel mailing list