Skip to content

Commit

Permalink
alsa: don't call snd_pcm_drain on uninitialized stream (fixes #2956)
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksiy-Yakovenko committed Jun 18, 2023
1 parent 184d1c7 commit 953d5ac
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions plugins/alsa/alsa.c
Expand Up @@ -120,10 +120,6 @@ palsa_set_hw_params (ddb_waveformat_t *fmt) {
plugin.fmt.flags &= ~DDB_WAVEFORMAT_FLAG_IS_DOP;
}

snd_pcm_nonblock(audio, 0);
snd_pcm_drain (audio);
snd_pcm_nonblock(audio, 1);

if ((err = snd_pcm_hw_params_malloc (&hw_params)) < 0) {
fprintf (stderr, "cannot allocate hardware parameter structure (%s)\n",
snd_strerror (err));
Expand Down Expand Up @@ -499,6 +495,9 @@ _setformat_apply (void) {
}
}

snd_pcm_nonblock (audio, 0);
snd_pcm_drain (audio);
snd_pcm_nonblock (audio, 1);

int ret = palsa_set_hw_params (&requested_fmt);
if (ret < 0) {
Expand Down

0 comments on commit 953d5ac

Please sign in to comment.