|
@@ -139,6 +139,18 @@ 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);
|