[FFmpeg-devel] [PATCH 5/6] avcodec/chomp: move the reference in the bsf internal buffer

James Almer jamrial at gmail.com
Sun Mar 11 19:58:53 EET 2018


There's no need to allocate a new packet for it.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/chomp_bsf.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/libavcodec/chomp_bsf.c b/libavcodec/chomp_bsf.c
index cc94380535..0d29a9a1d9 100644
--- a/libavcodec/chomp_bsf.c
+++ b/libavcodec/chomp_bsf.c
@@ -25,18 +25,14 @@
 
 static int chomp_filter(AVBSFContext *ctx, AVPacket *out)
 {
-    AVPacket *in;
     int ret;
 
-    ret = ff_bsf_get_packet(ctx, &in);
+    ret = ff_bsf_get_packet_ref(ctx, out);
     if (ret < 0)
         return ret;
 
-    while (in->size > 0 && !in->data[in->size - 1])
-        in->size--;
-
-    av_packet_move_ref(out, in);
-    av_packet_free(&in);
+    while (out->size > 0 && !out->data[out->size - 1])
+        out->size--;
 
     return 0;
 }
-- 
2.16.2



More information about the ffmpeg-devel mailing list