From fe73b14eb1e8ccfc49dc73e1dbeb6510ed1e9452 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 26 Nov 2013 01:07:14 +0100 Subject: player: move code for skipping 0-sized video packets to demuxer These packets have to be explicitly dropped, because usually libavcodec uses 0-sized packets to flush delayed frames, meaning just passing through these packets would have bad consequences. Normally, libavformat doesn't output 0-sized packets anyway. But I don't want to take any chances, so don't delete it, and just move it out of the way to demux.c. --- demux/demux.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'demux/demux.c') diff --git a/demux/demux.c b/demux/demux.c index 467b016699..bfa999ab15 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -318,6 +318,14 @@ int demuxer_add_packet(demuxer_t *demuxer, struct sh_stream *stream, return 0; } + if (stream->type == STREAM_VIDEO && !dp->len) { + /* Video packets with size 0 are assumed to not correspond to frames, + * but to indicate the absence of a frame in formats like AVI + * that must have packets at fixed timestamp intervals. */ + talloc_free(dp); + return 1; + } + dp->stream = stream->index; dp->next = NULL; -- cgit v1.2.3