mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
pcm: hw: add a helper function to issue avail_min without side-effects
At present, applications can change avail_min parameter of PCM substream by two ways; via mapped control data, and by executing ioctl(2) with SNDRV_PCM_IOCTL_SYNC_PTR. The former is available in a case that the applications map the data successfully. When utilizing alsa-lib API, the above is done by a call of 'snd_pcm_sw_params()' to hw PCM plugin. In current implementation, this call has an side-effect to issue appl_ptr unexpectedly. This commit adds a helper function to issue avail_min without the side-effect. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
de9fe69e40
commit
cea81cbdc2
1 changed files with 10 additions and 1 deletions
|
|
@ -151,6 +151,15 @@ static int sync_ptr(snd_pcm_hw_t *hw, unsigned int flags)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int issue_avail_min(snd_pcm_hw_t *hw)
|
||||
{
|
||||
if (!hw->mmap_control_fallbacked)
|
||||
return 0;
|
||||
|
||||
/* Avoid unexpected change of applptr in kernel space. */
|
||||
return sync_ptr1(hw, SNDRV_PCM_SYNC_PTR_APPL);
|
||||
}
|
||||
|
||||
static int issue_applptr(snd_pcm_hw_t *hw)
|
||||
{
|
||||
if (!hw->mmap_control_fallbacked)
|
||||
|
|
@ -506,7 +515,7 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
|
|||
params->silence_size == pcm->silence_size &&
|
||||
old_period_event == hw->period_event) {
|
||||
hw->mmap_control->avail_min = params->avail_min;
|
||||
return sync_ptr(hw, 0);
|
||||
return issue_avail_min(hw);
|
||||
}
|
||||
if (params->tstamp_type == SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW &&
|
||||
hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 12)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue