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>
pull/282/head
James Almer 7 years ago
parent 8fb0e51bd1
commit 27d4249fad
  1. 12
      libavcodec/chomp_bsf.c

@ -23,20 +23,16 @@
#include "bsf.h" #include "bsf.h"
#include "internal.h" #include "internal.h"
static int chomp_filter(AVBSFContext *ctx, AVPacket *out) static int chomp_filter(AVBSFContext *ctx, AVPacket *pkt)
{ {
AVPacket *in;
int ret; int ret;
ret = ff_bsf_get_packet(ctx, &in); ret = ff_bsf_get_packet_ref(ctx, pkt);
if (ret < 0) if (ret < 0)
return ret; return ret;
while (in->size > 0 && !in->data[in->size - 1]) while (pkt->size > 0 && !pkt->data[pkt->size - 1])
in->size--; pkt->size--;
av_packet_move_ref(out, in);
av_packet_free(&in);
return 0; return 0;
} }

Loading…
Cancel
Save