From 9a7a6958cac2174e1e9e9d61db6d8e295086aae2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 19 Sep 2019 17:38:35 +0200 Subject: Revert "demux/packet: fix demux_packet_shorten" This reverts commit 95636c65e73c1d0d8cba43d8c230291d99962e88. This change shouldn't be needed, and in fact it's wrong. The FFmpeg API function could do anything it wants with the packet, including changing the packet data pointer. Likewise, it's not guaranteed that the referenced packet's fields mirror the current state of the mpv packet struct (the AVPacket is only kept for the AVBuffer and the side data stuff). --- demux/packet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/demux/packet.c b/demux/packet.c index b456df4ab2..fba9232c19 100644 --- a/demux/packet.c +++ b/demux/packet.c @@ -124,8 +124,8 @@ struct demux_packet *new_demux_packet(size_t len) void demux_packet_shorten(struct demux_packet *dp, size_t len) { assert(len <= dp->len); - av_shrink_packet(dp->avpacket, len); - dp->len = dp->avpacket->size; + dp->len = len; + memset(dp->buffer + dp->len, 0, AV_INPUT_BUFFER_PADDING_SIZE); } void free_demux_packet(struct demux_packet *dp) -- cgit v1.2.3