diff options
author | wm4 <wm4@nowhere> | 2016-02-24 22:04:18 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-02-24 22:04:18 +0100 |
commit | b654aaea0abe907f60408534af6c7af23307028d (patch) | |
tree | d0b85da2ed480554bb65597e5eddc5b17c2c78ff | |
parent | 503c6f7fd6c3c542667c93c75db260671c4ba982 (diff) |
demux: avoid lost wakeup on queue overflow
If a stream is marked as EOF (due to no packets found in reach), then we
need to wakeup the decoder. This is important especially if no packets
are found at the start of the file, so the A/V sync logic actually
starts playback, instead of waiting for packets that will never come.
(It would randomly start playback when running the playback loop due to
arbitrary external events like user input.)
-rw-r--r-- | demux/demux.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/demux/demux.c b/demux/demux.c index 6388ca3732..fe72d3ef4c 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -490,7 +490,12 @@ static bool read_packet(struct demux_internal *in) } for (int n = 0; n < in->num_streams; n++) { struct demux_stream *ds = in->streams[n]->ds; - ds->eof |= !ds->head; + bool eof = !ds->head; + if (eof && !ds->eof) { + if (in->wakeup_cb) + in->wakeup_cb(in->wakeup_cb_ctx); + } + ds->eof |= eof; } pthread_cond_signal(&in->wakeup); return false; |