summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-01-09 21:41:51 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-01-10 22:32:37 -0800
commitc0cc145069d227e1a6e9726d8a62287bc132724d (patch)
tree679c4fe94c76ce838743ae1bd6ad096b273e666b
parent4a11c28237c4f362d9b54f47076bfa56f21119d8 (diff)
downloadmpv-c0cc145069d227e1a6e9726d8a62287bc132724d.tar.bz2
mpv-c0cc145069d227e1a6e9726d8a62287bc132724d.tar.xz
demux: fight libavformat cover art hack harder
libavformat's cover art hack (aka attached pictures) breaks the ability of the demuxer cache to keep multiple seek ranges. This happens because the cover art packet has neither position nor timestamp, and libavformat gives us the packet even though we intended to drop it. The cover art hack works by adding the cover art packet to the read packet stream once when demuxing starts (or after seeks). mpv treats cover art in a similar way internally, but we have to compensate for libavformat's shortcomings, and add the cover art packet ourselves when we need it. So we don't want libavformat to return the packet. We normally prevent this in demux_lavc.c/select_tracks() and explicitly disable cover art streams. (We add it in dequeue_packet() instead.) But libavformat will actually add the cover art packet even if we disable the cover art stream, because it adds it at initialization time, and does not bother to check again in av_read_frame() (apparently). The packet is actually read, and upsets the demuxer cache logic. In addition, this also means we probably decoded the cover art picture twice in some situations. Fix this by explicitly checking/discarding this in yet another place. (Screw this hack...)
-rw-r--r--demux/demux.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/demux/demux.c b/demux/demux.c
index d904d03fbf..a748a3b5b0 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -1164,7 +1164,7 @@ void demux_add_packet(struct sh_stream *stream, demux_packet_t *dp)
struct demux_queue *queue = ds->queue;
- bool drop = !ds->selected || in->seeking;
+ bool drop = !ds->selected || in->seeking || ds->sh->attached_picture;
if (!drop && ds->refreshing) {
// Resume reading once the old position was reached (i.e. we start
// returning packets where we left off before the refresh).