summaryrefslogtreecommitdiff
path: root/libavcodec/dca_core_bsf.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-03-11 13:29:19 -0300
committerJames Almer <jamrial@gmail.com>2018-03-11 15:38:58 -0300
commitaba437a6d0a7e0d9bafc6a2170ddd31d19d6c4d5 (patch)
tree5a5f970300bb8b70547f9118854a798ecf923afe /libavcodec/dca_core_bsf.c
parent27d4249fadbada099ece60fc6d7ddc3603c10df6 (diff)
avcodec/dca_core: 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/dca_core_bsf.c')
-rw-r--r--libavcodec/dca_core_bsf.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/libavcodec/dca_core_bsf.c b/libavcodec/dca_core_bsf.c
index 9edc0cfd61..8565796951 100644
--- a/libavcodec/dca_core_bsf.c
+++ b/libavcodec/dca_core_bsf.c
@@ -24,18 +24,17 @@
#include "dca_syncwords.h"
#include "libavutil/mem.h"
-static int dca_core_filter(AVBSFContext *ctx, AVPacket *out)
+static int dca_core_filter(AVBSFContext *ctx, AVPacket *pkt)
{
- 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, pkt);
if (ret < 0)
return ret;
- bytestream2_init(&gb, in->data, in->size);
+ bytestream2_init(&gb, pkt->data, pkt->size);
syncword = bytestream2_get_be32(&gb);
bytestream2_skip(&gb, 1);
@@ -45,11 +44,8 @@ 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;
+ if (core_size > 0 && core_size <= pkt->size) {
+ pkt->size = core_size;
}
return 0;