aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2016-02-29 09:42:54 -0500
committerRonald S. Bultje <rsbultje@gmail.com>2016-03-11 11:19:10 -0500
commit6d8ab358a3c2a8fbdd6ae7f144893b7c88c30557 (patch)
tree23f828365cc3743026aa12a2b9212621608f58f8 /libavformat/utils.c
parent867637caeab58bb9627a4a49637d37cbe885368b (diff)
downloadffmpeg-6d8ab358a3c2a8fbdd6ae7f144893b7c88c30557.tar.gz
lavf: allow BSFs to drop packets.
If pkt->size == 0 && pkt->side_data_elems == 0 after bsf->filter() returns, the packet is considered dropped.
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index f4ae8b4f58..e0aea877ff 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4710,6 +4710,11 @@ int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt,
&new_pkt.data, &new_pkt.size,
pkt->data, pkt->size,
pkt->flags & AV_PKT_FLAG_KEY);
+ if (a == 0 && new_pkt.size == 0 && new_pkt.side_data_elems == 0) {
+ av_packet_unref(pkt);
+ memset(pkt, 0, sizeof(*pkt));
+ return 0;
+ }
if(a == 0 && new_pkt.data != pkt->data) {
uint8_t *t = av_malloc(new_pkt.size + AV_INPUT_BUFFER_PADDING_SIZE); //the new should be a subset of the old so cannot overflow
if (t) {