Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit be9a2e93 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: x86: Stop the stream when buffer is processed after disconnection



This shouldn't happen, but just to be sure...

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 28ed125b
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -971,19 +971,22 @@ static void had_process_buffer_done(struct snd_intelhad *intelhaddata)
{
	struct snd_pcm_substream *substream;

	if (!intelhaddata->connected)
		return; /* disconnected? - bail out */

	substream = had_substream_get(intelhaddata);
	if (!substream)
		return; /* no stream? - bail out */

	if (!intelhaddata->connected) {
		snd_pcm_stop_xrun(substream);
		goto out; /* disconnected? - bail out */
	}

	/* process or stop the stream */
	if (had_process_ringbuf(substream, intelhaddata) < 0)
		snd_pcm_stop_xrun(substream);
	else
		snd_pcm_period_elapsed(substream);

 out:
	had_substream_put(intelhaddata);
}