summaryrefslogtreecommitdiffstats
path: root/demux/demux.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-02-24 22:04:18 +0100
committerwm4 <wm4@nowhere>2016-02-24 22:04:18 +0100
commitb654aaea0abe907f60408534af6c7af23307028d (patch)
treed0b85da2ed480554bb65597e5eddc5b17c2c78ff /demux/demux.c
parent503c6f7fd6c3c542667c93c75db260671c4ba982 (diff)
downloadmpv-b654aaea0abe907f60408534af6c7af23307028d.tar.bz2
mpv-b654aaea0abe907f60408534af6c7af23307028d.tar.xz
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.)
Diffstat (limited to 'demux/demux.c')
-rw-r--r--demux/demux.c7
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;