pcm: dmix: Handle slave PCM xrun and unexpected states properly

Currently, dmix & co plugins ignore the XRUN state of the slave PCM.
It's (supposedly) because dmix deals with the PCM in a free-wheel
mode, which is equivalent with XRUN.  But, this difference (whether
the correct freewheel or XRUN) should be done by the kernel, and we
may have an XRUN state indeed (e.g. via xrun injection).

This patch fixes this lack of behavior, to handle PCM xrun and does
prepare when the slave PCM is in such a state.

Also, the patch consolidates the prepare callback for all dmix, dsnoop
and dshare plugins, and fix/cleanup a bit for dshare/dsnoop codes to
align with dsnoop code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2015-10-30 17:13:50 +01:00
parent 99dc70f023
commit 8985742d91
5 changed files with 42 additions and 44 deletions

View file

@ -224,6 +224,8 @@ struct snd_pcm_direct {
snd1_pcm_direct_mmap
#define snd_pcm_direct_munmap \
snd1_pcm_direct_munmap
#define snd_pcm_direct_prepare \
snd1_pcm_direct_prepare
#define snd_pcm_direct_resume \
snd1_pcm_direct_resume
#define snd_pcm_direct_timer_stop \
@ -304,6 +306,7 @@ int snd_pcm_direct_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params);
int snd_pcm_direct_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info);
int snd_pcm_direct_mmap(snd_pcm_t *pcm);
int snd_pcm_direct_munmap(snd_pcm_t *pcm);
int snd_pcm_direct_prepare(snd_pcm_t *pcm);
int snd_pcm_direct_resume(snd_pcm_t *pcm);
int snd_pcm_direct_timer_stop(snd_pcm_direct_t *dmix);
void snd_pcm_direct_clear_timer_queue(snd_pcm_direct_t *dmix);