mirror of
https://github.com/mpv-player/mpv
synced 2025-02-04 22:22:16 +00:00
audio/out/push: limit fallback sleep time to reasonable limits
This commit is contained in:
parent
0d4e245de7
commit
6431e09fb3
@ -165,8 +165,10 @@ static void drain(struct ao *ao)
|
|||||||
pthread_cond_wait(&p->wakeup_drain, &p->lock);
|
pthread_cond_wait(&p->wakeup_drain, &p->lock);
|
||||||
pthread_mutex_unlock(&p->lock);
|
pthread_mutex_unlock(&p->lock);
|
||||||
|
|
||||||
if (!ao->driver->drain)
|
if (!ao->driver->drain) {
|
||||||
mp_sleep_us(get_delay(ao) * 1000000);
|
double time = get_delay(ao);
|
||||||
|
mp_sleep_us(MPMIN(time, ao->buffer / (double)ao->samplerate + 1) * 1e6);
|
||||||
|
}
|
||||||
reset(ao);
|
reset(ao);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user