diff options
author | Liam Girdwood <liam.r.girdwood@linux.intel.com> | 2013-09-13 12:43:16 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-09-26 03:28:22 -0400 |
commit | b26d19e44adfd10b691bf4ffd50ed411c1be9317 (patch) | |
tree | 94378d0e6f3860bcd3ba30aca2566f8928251ce2 /sound/core | |
parent | 4028b6c4c03f213260e9290ff3a6b5439aad07ce (diff) |
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.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/compress_offload.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index 5863ba6dd12b..bea523a5d852 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c | |||
@@ -139,6 +139,18 @@ static int snd_compr_open(struct inode *inode, struct file *f) | |||
139 | static int snd_compr_free(struct inode *inode, struct file *f) | 139 | static int snd_compr_free(struct inode *inode, struct file *f) |
140 | { | 140 | { |
141 | struct snd_compr_file *data = f->private_data; | 141 | struct snd_compr_file *data = f->private_data; |
142 | struct snd_compr_runtime *runtime = data->stream.runtime; | ||
143 | |||
144 | switch (runtime->state) { | ||
145 | case SNDRV_PCM_STATE_RUNNING: | ||
146 | case SNDRV_PCM_STATE_DRAINING: | ||
147 | case SNDRV_PCM_STATE_PAUSED: | ||
148 | data->stream.ops->trigger(&data->stream, SNDRV_PCM_TRIGGER_STOP); | ||
149 | break; | ||
150 | default: | ||
151 | break; | ||
152 | } | ||
153 | |||
142 | data->stream.ops->free(&data->stream); | 154 | data->stream.ops->free(&data->stream); |
143 | kfree(data->stream.runtime->buffer); | 155 | kfree(data->stream.runtime->buffer); |
144 | kfree(data->stream.runtime); | 156 | kfree(data->stream.runtime); |