Commit 822fa19b authored by Takashi Iwai's avatar Takashi Iwai

ALSA: ALSA: ctxfi - Release PCM resources at each prepare call

The prepare callback can be called multiple times, thus it needs to
release and acquire the resource again by itself at the second or later
call.

Simply add pcm_release_resources() at the beginning of each prepare
callback in ctatc.c.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 8a4259bf
...@@ -254,6 +254,9 @@ static int atc_pcm_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm) ...@@ -254,6 +254,9 @@ static int atc_pcm_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm)
return 0; return 0;
} }
/* first release old resources */
atc->pcm_release_resources(atc, apcm);
/* Get SRC resource */ /* Get SRC resource */
desc.multi = apcm->substream->runtime->channels; desc.multi = apcm->substream->runtime->channels;
desc.msr = atc->msr; desc.msr = atc->msr;
...@@ -496,6 +499,9 @@ atc_pcm_capture_get_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm) ...@@ -496,6 +499,9 @@ atc_pcm_capture_get_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm)
int n_srcimp = 0, n_amixer = 0, n_srcc = 0, n_sum = 0; int n_srcimp = 0, n_amixer = 0, n_srcc = 0, n_sum = 0;
struct src_node_conf_t src_node_conf[2] = {{0} }; struct src_node_conf_t src_node_conf[2] = {{0} };
/* first release old resources */
atc->pcm_release_resources(atc, apcm);
/* The numbers of converting SRCs and SRCIMPs should be determined /* The numbers of converting SRCs and SRCIMPs should be determined
* by pitch value. */ * by pitch value. */
...@@ -767,6 +773,9 @@ static int spdif_passthru_playback_get_resources(struct ct_atc *atc, ...@@ -767,6 +773,9 @@ static int spdif_passthru_playback_get_resources(struct ct_atc *atc,
int n_amixer = apcm->substream->runtime->channels, i = 0; int n_amixer = apcm->substream->runtime->channels, i = 0;
unsigned int pitch = 0, rsr = atc->pll_rate; unsigned int pitch = 0, rsr = atc->pll_rate;
/* first release old resources */
atc->pcm_release_resources(atc, apcm);
/* Get SRC resource */ /* Get SRC resource */
desc.multi = apcm->substream->runtime->channels; desc.multi = apcm->substream->runtime->channels;
desc.msr = 1; desc.msr = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment