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.
This commit is contained in:
wm4 2014-07-20 20:12:35 +02:00
parent 61efe87e48
commit 5526603a43
1 changed files with 1 additions and 1 deletions

View File

@ -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;