core, alsa: Better drain reporting

Previously, a drain request was acknowledged up to two hw buffers
too late, causing unnecessary delays.

This implements a new chain of events called process_underrun
which triggers exactly when the sink input has finished playing,
so the drain can be acknowledged quicker.

It could later be improved to give better underrun reporting to
clients too.

Tested-by: Dmitri Paduchikh <dpaduchikh@gmail.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
David Henningsson 2013-03-01 11:51:54 +01:00
parent ada92732f0
commit e87eb85474
6 changed files with 139 additions and 33 deletions

View file

@ -492,6 +492,8 @@ void pa_sink_update_volume_and_mute(pa_sink *s);
pa_bool_t pa_sink_volume_change_apply(pa_sink *s, pa_usec_t *usec_to_next);
size_t pa_sink_process_input_underruns(pa_sink *s, size_t left_to_play);
/*** To be called exclusively by sink input drivers, from IO context */
void pa_sink_request_rewind(pa_sink*s, size_t nbytes);