summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-07 00:34:14 +0200
committerwm4 <wm4@nowhere>2014-08-07 00:34:14 +0200
commit1483fd443a70150204bea3067749a94358f32c22 (patch)
tree115e600b0d5620fd539dae8033bae7ed50326853
parentaf57444bcbd001a2de8a3798c84e6c4556416b62 (diff)
downloadmpv-1483fd443a70150204bea3067749a94358f32c22.tar.bz2
mpv-1483fd443a70150204bea3067749a94358f32c22.tar.xz
demux: fix playback abort if --demuxer-thread is not used
Switching tracks caused cached_demux_control() to catch the command to switch tracks, even if no thread was running. Thus, the tracks were never really switched, and EOF happened immediately on playback start. Fix it by not using the cache at all if the demuxer thread is disabled. The cache code still has to be called somewhere, though, because it handles stream metadata update. Regression from today.
-rw-r--r--demux/demux.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/demux/demux.c b/demux/demux.c
index 6af7976759..61fcb0d47b 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -373,7 +373,7 @@ static bool read_packet(struct demux_internal *in)
ds->eof = true;
ds->active = false;
}
- // If we had EOF previously, then donn't wakeup (avoids wakeup loop)
+ // If we had EOF previously, then don't wakeup (avoids wakeup loop)
if (!in->last_eof) {
if (in->wakeup_cb)
in->wakeup_cb(in->wakeup_cb_ctx);
@@ -763,6 +763,8 @@ void demux_update(demuxer_t *demuxer)
struct demux_internal *in = demuxer->in;
pthread_mutex_lock(&in->lock);
+ if (!in->threading)
+ update_cache(in);
demux_copy(demuxer, in->d_buffer);
if (in->stream_metadata && (demuxer->events & DEMUX_EVENT_METADATA))
mp_tags_merge(demuxer->metadata, in->stream_metadata);
@@ -1157,16 +1159,14 @@ int demux_control(demuxer_t *demuxer, int cmd, void *arg)
{
struct demux_internal *in = demuxer->in;
- pthread_mutex_lock(&in->lock);
- if (!in->threading)
- update_cache(in);
- pthread_cond_signal(&in->wakeup);
- int cr = cached_demux_control(in, cmd, arg);
- if (cr != DEMUXER_CTRL_DONTKNOW) {
+ if (in->threading) {
+ pthread_mutex_lock(&in->lock);
+ pthread_cond_signal(&in->wakeup);
+ int cr = cached_demux_control(in, cmd, arg);
pthread_mutex_unlock(&in->lock);
- return cr;
+ if (cr != DEMUXER_CTRL_DONTKNOW)
+ return cr;
}
- pthread_mutex_unlock(&in->lock);
int r = DEMUXER_CTRL_NOTIMPL;
demux_pause(demuxer);