From 5526603a4325efe672485a94d9a3cd2f8b8e7b9e Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 20 Jul 2014 20:12:35 +0200 Subject: demux: don't start reading if no packets were requested yet Instead of starting to fill the packet queue if at least 1 stream is selected, wait until there is at least 1 stream had new packets requested. In theory this is cleaner, because it allows you to e.g. do a seek and then reselect streams without losing packets. Seeking marks all streams as inactive, and without this new logic, the thread would read new packets anyway right after seek. --- demux/demux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demux/demux.c') diff --git a/demux/demux.c b/demux/demux.c index b9dc232a79..f5553eaa64 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -320,7 +320,7 @@ static bool read_packet(struct demux_internal *in) size_t packs = 0, bytes = 0; for (int n = 0; n < in->d_buffer->num_streams; n++) { struct demux_stream *ds = in->d_buffer->streams[n]->ds; - active |= ds->selected; + active |= ds->selected && ds->active; read_more |= ds->active && !ds->head; packs += ds->packs; bytes += ds->bytes; -- cgit v1.2.3