diff options
author | wm4 <wm4@nowhere> | 2015-01-16 20:21:39 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-01-16 20:22:43 +0100 |
commit | c8052da7decba4cbada6c240f2b21c09e385818c (patch) | |
tree | 7b882feb29a4aa6092942ffd1b4ea8b14c322e09 /demux | |
parent | 280f123f35037e3d9615c1272e96d47d6c164655 (diff) |
demux: return EOF when reading from unselected stream
Normally the player doesn't read from unselected streams, so this should
be a no-op. But unfortunately, some broken files can severely confuse
the player, and assign the same demuxer stream to multiple front-end
tracks. Then selecting one of the tracks would deselect the other track,
with the end result that the demuxer stream for the selected track is
deselected. This could happen with mkv files that use the same track
number (which is of course broken). timeline_set_part() sets the tracks
using demuxer_stream_by_demuxer_id(), using the broken non-unique IDs.
The observable effect was that the player never quit, because
demux_read_packet_async() told the caller to wait some longer for new
packets. Fix by returning EOF instead.
Fixes #1481.
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/demux/demux.c b/demux/demux.c index 70b0c84f36..c099dbac19 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -576,7 +576,7 @@ int demux_read_packet_async(struct sh_stream *sh, struct demux_packet **out_pkt) if (ds->in->threading) { pthread_mutex_lock(&ds->in->lock); *out_pkt = dequeue_packet(ds); - r = *out_pkt ? 1 : (ds->eof ? -1 : 0); + r = *out_pkt ? 1 : ((ds->eof || !ds->selected) ? -1 : 0); ds->active = ds->selected; // enable readahead ds->in->eof = false; // force retry pthread_cond_signal(&ds->in->wakeup); // possibly read more |