mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Fixed repeated prepare call
This commit is contained in:
parent
4ecd9eaa46
commit
a83b209df2
6 changed files with 14 additions and 5 deletions
|
|
@ -307,7 +307,7 @@ static int snd_pcm_file_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
|||
snd_pcm_file_t *file = pcm->private;
|
||||
unsigned int channel;
|
||||
snd_pcm_t *slave = file->slave;
|
||||
int err = snd_pcm_hw_params(slave, params);
|
||||
int err = _snd_pcm_hw_params(slave, params);
|
||||
if (err < 0)
|
||||
return err;
|
||||
file->buffer_bytes = snd_pcm_frames_to_bytes(slave, slave->buffer_size);
|
||||
|
|
|
|||
|
|
@ -336,6 +336,7 @@ static inline int muldiv_near(int a, int b, int c)
|
|||
return n;
|
||||
}
|
||||
|
||||
int _snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
|
||||
int snd_pcm_hw_refine_soft(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
|
||||
int snd_pcm_hw_refine_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
|
||||
int (*cprepare)(snd_pcm_t *pcm,
|
||||
|
|
|
|||
|
|
@ -2099,7 +2099,7 @@ int snd_pcm_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
max periods
|
||||
Return 0 on success or a negative number expressing the error.
|
||||
*/
|
||||
int snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
int _snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
int err;
|
||||
snd_pcm_sw_params_t sw;
|
||||
|
|
@ -2154,6 +2154,14 @@ int snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
pcm->access == SND_PCM_ACCESS_MMAP_COMPLEX) {
|
||||
err = snd_pcm_mmap(pcm);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
int err;
|
||||
assert(pcm && params);
|
||||
err = _snd_pcm_hw_params(pcm, params);
|
||||
if (err >= 0)
|
||||
err = snd_pcm_prepare(pcm);
|
||||
return err;
|
||||
|
|
|
|||
|
|
@ -583,7 +583,7 @@ static int snd_pcm_plug_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
return err;
|
||||
}
|
||||
slave = plug->slave;
|
||||
err = snd_pcm_hw_params(slave, params);
|
||||
err = _snd_pcm_hw_params(slave, params);
|
||||
if (err < 0) {
|
||||
snd_pcm_plug_clear(pcm);
|
||||
return err;
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ int snd_pcm_plugin_hw_refine_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
int snd_pcm_plugin_hw_params_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
return snd_pcm_hw_params(plugin->slave, params);
|
||||
return _snd_pcm_hw_params(plugin->slave, params);
|
||||
}
|
||||
|
||||
snd_pcm_fast_ops_t snd_pcm_plugin_fast_ops = {
|
||||
|
|
|
|||
|
|
@ -570,7 +570,7 @@ static int snd_pcm_share_hw_refine_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *pa
|
|||
static int snd_pcm_share_hw_params_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
return snd_pcm_hw_params(share->slave->pcm, params);
|
||||
return _snd_pcm_hw_params(share->slave->pcm, params);
|
||||
}
|
||||
|
||||
static int snd_pcm_share_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue