mirror of
https://github.com/mpv-player/mpv
synced 2024-10-02 16:25:33 +02:00
audio: don't lock ao_control for pull mode drivers
The pull mode APIs were previously required to have thread-safe
ao_controls. However, locks were added in b83bdd1
for parity with push
mode. This introduced deadlocks in ao_wasapi.
Instead, only lock ao_control for the push mode APIs.
fixes #7787
See also #7832, #7811. We'll wait for feedback to see if those should
also be closed.
This commit is contained in:
parent
b16d8865b7
commit
5e323333cf
@ -288,9 +288,14 @@ int ao_control(struct ao *ao, enum aocontrol cmd, void *arg)
|
|||||||
struct buffer_state *p = ao->buffer_state;
|
struct buffer_state *p = ao->buffer_state;
|
||||||
int r = CONTROL_UNKNOWN;
|
int r = CONTROL_UNKNOWN;
|
||||||
if (ao->driver->control) {
|
if (ao->driver->control) {
|
||||||
pthread_mutex_lock(&p->lock);
|
// Only need to lock in push mode.
|
||||||
|
if (ao->driver->write)
|
||||||
|
pthread_mutex_lock(&p->lock);
|
||||||
|
|
||||||
r = ao->driver->control(ao, cmd, arg);
|
r = ao->driver->control(ao, cmd, arg);
|
||||||
pthread_mutex_unlock(&p->lock);
|
|
||||||
|
if (ao->driver->write)
|
||||||
|
pthread_mutex_unlock(&p->lock);
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user