[FFmpeg-devel,1/6] avcodec/dca_core: move the reference in the bsf internal buffer

Submitted by James Almer on March 11, 2018, 5:58 p.m.

Details

Message ID 20180311175854.10096-1-jamrial@gmail.com
State Accepted
Headers show

Commit Message

James Almer March 11, 2018, 5:58 p.m.
There's no need to allocate a new packet for it.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/dca_core_bsf.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavcodec/dca_core_bsf.c b/libavcodec/dca_core_bsf.c
index 9edc0cfd61..cd3bc6fe99 100644
--- a/libavcodec/dca_core_bsf.c
+++ b/libavcodec/dca_core_bsf.c
@@ -26,16 +26,15 @@ 
 
 static int dca_core_filter(AVBSFContext *ctx, AVPacket *out)
 {
-    AVPacket *in;
     GetByteContext gb;
     uint32_t syncword;
     int core_size = 0, ret;
 
-    ret = ff_bsf_get_packet(ctx, &in);
+    ret = ff_bsf_get_packet_ref(ctx, out);
     if (ret < 0)
         return ret;
 
-    bytestream2_init(&gb, in->data, in->size);
+    bytestream2_init(&gb, out->data, out->size);
     syncword = bytestream2_get_be32(&gb);
     bytestream2_skip(&gb, 1);
 
@@ -45,9 +44,6 @@  static int dca_core_filter(AVBSFContext *ctx, AVPacket *out)
         break;
     }
 
-    av_packet_move_ref(out, in);
-    av_packet_free(&in);
-
     if (core_size > 0 && core_size <= out->size) {
         out->size = core_size;
     }