mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
demux: fix deadlock on "program" property changes
Tries to recursively lock a non-recursive lock, which usually ends in a deadlock. Must have been broken by some past refactor.
This commit is contained in:
@@ -2945,6 +2945,8 @@ static void thread_demux_control(void *p)
|
|||||||
struct demux_internal *in = demuxer->in;
|
struct demux_internal *in = demuxer->in;
|
||||||
int r = CONTROL_UNKNOWN;
|
int r = CONTROL_UNKNOWN;
|
||||||
|
|
||||||
|
pthread_mutex_unlock(&in->lock);
|
||||||
|
|
||||||
if (cmd == DEMUXER_CTRL_STREAM_CTRL) {
|
if (cmd == DEMUXER_CTRL_STREAM_CTRL) {
|
||||||
struct demux_ctrl_stream_ctrl *c = arg;
|
struct demux_ctrl_stream_ctrl *c = arg;
|
||||||
if (in->threading)
|
if (in->threading)
|
||||||
@@ -2960,6 +2962,8 @@ static void thread_demux_control(void *p)
|
|||||||
r = demuxer->desc->control(demuxer->in->d_thread, cmd, arg);
|
r = demuxer->desc->control(demuxer->in->d_thread, cmd, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pthread_mutex_lock(&in->lock);
|
||||||
|
|
||||||
*args->r = r;
|
*args->r = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2990,7 +2994,9 @@ int demux_control(demuxer_t *demuxer, int cmd, void *arg)
|
|||||||
pthread_cond_wait(&in->wakeup, &in->lock);
|
pthread_cond_wait(&in->wakeup, &in->lock);
|
||||||
pthread_mutex_unlock(&in->lock);
|
pthread_mutex_unlock(&in->lock);
|
||||||
} else {
|
} else {
|
||||||
|
pthread_mutex_lock(&in->lock);
|
||||||
thread_demux_control(&args);
|
thread_demux_control(&args);
|
||||||
|
pthread_mutex_unlock(&in->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
Reference in New Issue
Block a user