mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-04 13:30:08 -05:00
Fixed double initialization in prepare
This commit is contained in:
parent
857d492b99
commit
23348526ef
1 changed files with 11 additions and 0 deletions
|
|
@ -813,6 +813,17 @@ static int snd_pcm_share_prepare(snd_pcm_t *pcm)
|
||||||
snd_pcm_share_slave_t *slave = share->slave;
|
snd_pcm_share_slave_t *slave = share->slave;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
Pthread_mutex_lock(&slave->mutex);
|
Pthread_mutex_lock(&slave->mutex);
|
||||||
|
switch (share->state) {
|
||||||
|
case SND_PCM_STATE_OPEN:
|
||||||
|
err = -EBADFD;
|
||||||
|
goto _end;
|
||||||
|
case SND_PCM_STATE_RUNNING:
|
||||||
|
err = -EBUSY;
|
||||||
|
goto _end;
|
||||||
|
case SND_PCM_STATE_PREPARED:
|
||||||
|
err = 0;
|
||||||
|
goto _end;
|
||||||
|
}
|
||||||
if (slave->prepared_count == 0) {
|
if (slave->prepared_count == 0) {
|
||||||
err = snd_pcm_prepare(slave->pcm);
|
err = snd_pcm_prepare(slave->pcm);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue