summaryrefslogtreecommitdiff
path: root/libavcodec/chomp_bsf.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-03-11 13:53:04 -0300
committerJames Almer <jamrial@gmail.com>2018-03-11 15:38:24 -0300
commit27d4249fadbada099ece60fc6d7ddc3603c10df6 (patch)
tree57be80f39f35aac10d78d929fd0988242f88f4a9 /libavcodec/chomp_bsf.c
parent8fb0e51bd198c996b8932735e8002f0952ef1d06 (diff)
downloadffmpeg-27d4249fadbada099ece60fc6d7ddc3603c10df6.tar.gz
avcodec/chomp: move the reference in the bsf internal buffer
There's no need to allocate a new packet for it. Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/chomp_bsf.c')
-rw-r--r--libavcodec/chomp_bsf.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/libavcodec/chomp_bsf.c b/libavcodec/chomp_bsf.c
index cc94380535..3ba45f3e06 100644
--- a/libavcodec/chomp_bsf.c
+++ b/libavcodec/chomp_bsf.c
@@ -23,20 +23,16 @@
#include "bsf.h"
#include "internal.h"
-static int chomp_filter(AVBSFContext *ctx, AVPacket *out)
+static int chomp_filter(AVBSFContext *ctx, AVPacket *pkt)
{
- AVPacket *in;
int ret;
- ret = ff_bsf_get_packet(ctx, &in);
+ ret = ff_bsf_get_packet_ref(ctx, pkt);
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 (pkt->size > 0 && !pkt->data[pkt->size - 1])
+ pkt->size--;
return 0;
}