[FFmpeg-devel] [PATCH 4/5] avcodec/decode: Remove unnecessary av_packet_unref()
James Almer
jamrial at gmail.com
Tue Sep 7 00:10:34 EEST 2021
On 9/6/2021 5:29 PM, Andreas Rheinhardt wrote:
> The buffer_pkt is always unreferenced after being used and
> is therefore always blank when avcodec_send_packet() is called.
It currently is always unreferenced after being used, but to prevent
someone mistakenly breaking that assumption, an av_assert could be added
in place of the unref call.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> ---
> libavcodec/decode.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index 643f9d6a30..4def801516 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -587,7 +587,6 @@ int attribute_align_arg avcodec_send_packet(AVCodecContext *avctx, const AVPacke
> if (avpkt && !avpkt->size && avpkt->data)
> return AVERROR(EINVAL);
>
> - av_packet_unref(avci->buffer_pkt);
> if (avpkt && (avpkt->data || avpkt->side_data_elems)) {
> ret = av_packet_ref(avci->buffer_pkt, avpkt);
> if (ret < 0)
>
More information about the ffmpeg-devel
mailing list