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

Commit 4048306f authored by Liam Girdwood's avatar Liam Girdwood Committed by Dhananjay Kumar
Browse files

ALSA: compress: Make sure we trigger STOP before closing the stream.



Currently we assume that userspace will shut down the compressed stream
correctly. However, if userspcae dies (e.g. cplay & ctrl-C) we dont
stop the stream before freeing it.

This now checks that the stream is stopped before freeing.

Change-Id: If163520ff08b61fcf104ad6c06d89c705b7e5935
Signed-off-by: default avatarLiam Girdwood <liam.r.girdwood@linux.intel.com>
Git-commit: 846a29fb5bbafee83c594899190628a93d24dcae
Git-repo: https://android.googlesource.com/kernel/msm


Signed-off-by: default avatarDhananjay Kumar <dhakumar@codeaurora.org>
parent 1ef1e57c
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -139,6 +139,19 @@ static int snd_compr_open(struct inode *inode, struct file *f)
static int snd_compr_free(struct inode *inode, struct file *f)
{
	struct snd_compr_file *data = f->private_data;
	struct snd_compr_runtime *runtime = data->stream.runtime;

	switch (runtime->state) {
	case SNDRV_PCM_STATE_RUNNING:
	case SNDRV_PCM_STATE_DRAINING:
	case SNDRV_PCM_STATE_PAUSED:
		data->stream.ops->trigger(&data->stream,
					SNDRV_PCM_TRIGGER_STOP);
		break;
	default:
		break;
	}

	data->stream.ops->free(&data->stream);
	kfree(data->stream.runtime->buffer);
	kfree(data->stream.runtime);