path: root/demux/demux.c
diff options
authorwm4 <wm4@nowhere>2014-07-20 20:12:35 +0200
committerwm4 <wm4@nowhere>2014-07-20 20:13:08 +0200
commit5526603a4325efe672485a94d9a3cd2f8b8e7b9e (patch)
tree2983a4511948749114f23526dd6531dfaf670f5a /demux/demux.c
parent61efe87e48d3c929b9a88328a63820307d133d04 (diff)
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.
Diffstat (limited to 'demux/demux.c')
1 files changed, 1 insertions, 1 deletions
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;