diff mbox series

[FFmpeg-devel,4/5] avcodec/decode: Remove unnecessary av_packet_unref()

Message ID AM7PR03MB66603B1F76DE25A785D254CB8FD29@AM7PR03MB6660.eurprd03.prod.outlook.com
State New
Headers show
Series [FFmpeg-devel,1/5] configure: Remove null_bsf dependency
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 6, 2021, 8:29 p.m. UTC
The buffer_pkt is always unreferenced after being used and
is therefore always blank when avcodec_send_packet() is called.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/decode.c | 1 -
 1 file changed, 1 deletion(-)

Comments

James Almer Sept. 6, 2021, 9:10 p.m. UTC | #1
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@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)
>
diff mbox series

Patch

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)