diff mbox series

[FFmpeg-devel,04/10] avcodec/binkaudio: Use AVCodecInternal.in_pkt for buffer packet

Message ID AM7PR03MB6660BD97B730B9D95D1983EF8FB59@AM7PR03MB6660.eurprd03.prod.outlook.com
State New
Headers show
Series [FFmpeg-devel,01/10] avcodec/binkaudio: Remove AV_CODEC_CAP_DELAY
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 Oct. 11, 2021, 3:36 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/binkaudio.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c
index 59ecab25c6..f808141ba5 100644
--- a/libavcodec/binkaudio.c
+++ b/libavcodec/binkaudio.c
@@ -140,9 +140,7 @@  static av_cold int decode_init(AVCodecContext *avctx)
     if (ret < 0)
         return ret;
 
-    s->pkt = av_packet_alloc();
-    if (!s->pkt)
-        return AVERROR(ENOMEM);
+    s->pkt = avctx->internal->in_pkt;
 
     return 0;
 }
@@ -277,8 +275,6 @@  static av_cold int decode_end(AVCodecContext *avctx)
     else if (CONFIG_BINKAUDIO_DCT_DECODER)
         ff_dct_end(&s->trans.dct);
 
-    av_packet_free(&s->pkt);
-
     return 0;
 }
 
@@ -341,7 +337,8 @@  static void decode_flush(AVCodecContext *avctx)
 {
     BinkAudioContext *const s = avctx->priv_data;
 
-    av_packet_unref(s->pkt);
+    /* s->pkt coincides with avctx->internal->in_pkt
+     * and is unreferenced generically when flushing. */
     s->first = 1;
 }