mirror of https://github.com/mpv-player/mpv
audio: do not wake up core during EOF
When we're draining, don't wakeup the core on every buffer fill, since unlike during normal playback, we won't actually get more data. The wakeup here conceptually works like wakeups with condition variables, so redundant wakeups do not hurt, so this is just a minor change and nothing of consequence. (Final EOF also requires waking up the core, but there is separate code to send this notification.) Also dump the p->still_playing field in trace logging.
This commit is contained in:
parent
3d844cddf8
commit
972ea9ca59
|
@ -292,11 +292,12 @@ static void ao_play_data(struct ao *ao)
|
||||||
// If we just filled the AO completely (r == space), don't refill for a
|
// If we just filled the AO completely (r == space), don't refill for a
|
||||||
// while. Prevents wakeup feedback with byte-granular AOs.
|
// while. Prevents wakeup feedback with byte-granular AOs.
|
||||||
int needed = unlocked_get_space(ao);
|
int needed = unlocked_get_space(ao);
|
||||||
bool more = needed >= (r == space ? ao->device_buffer / 4 : 1) && !stuck;
|
bool more = needed >= (r == space ? ao->device_buffer / 4 : 1) && !stuck &&
|
||||||
|
!(flags & AOPLAY_FINAL_CHUNK);
|
||||||
if (more)
|
if (more)
|
||||||
mp_input_wakeup(ao->input_ctx); // request more data
|
mp_input_wakeup(ao->input_ctx); // request more data
|
||||||
MP_TRACE(ao, "in=%d flags=%d space=%d r=%d wa=%d needed=%d more=%d\n",
|
MP_TRACE(ao, "in=%d flags=%d space=%d r=%d wa/pl=%d/%d needed=%d more=%d\n",
|
||||||
max, flags, space, r, p->wait_on_ao, needed, more);
|
max, flags, space, r, p->wait_on_ao, p->still_playing, needed, more);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *playthread(void *arg)
|
static void *playthread(void *arg)
|
||||||
|
|
Loading…
Reference in New Issue