mirror of
https://github.com/mpv-player/mpv
synced 2024-11-14 22:48:35 +01:00
audio: don't block on lock in ao_read_data
ao_read_data() is used by pull AOs potentially from threads managed by external libraries. These threads can be sensitive to blocking. For example the pipewire ao is using a realtime thread for the callbacks.
This commit is contained in:
parent
dd13412986
commit
ae908a70ce
@ -184,7 +184,8 @@ int ao_read_data(struct ao *ao, void **data, int samples, int64_t out_time_ns)
|
||||
struct buffer_state *p = ao->buffer_state;
|
||||
assert(!ao->driver->write);
|
||||
|
||||
pthread_mutex_lock(&p->lock);
|
||||
if (pthread_mutex_trylock(&p->lock))
|
||||
return 0;
|
||||
|
||||
int pos = read_buffer(ao, data, samples, &(bool){0});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user