1
commit a256766c10c52cb6667de8a65f5cbb332fad4cc7
2
Author: Jaroslav Kysela <perex@perex.cz>
3
Date: Mon Dec 21 09:09:42 2009 +0100
5
pcm: Close event timer in pcm_hw plugin
7
Dan McCombs discovered that snd_pcm_close() invocations are not leading
8
to associated timers being closed, which results in successively more
9
timers being created but not freed.
11
Original patch from Daniel T Chen <crimsun@ubuntu.com>.
13
BugLink: https://bugs.launchpad.net/bugs/451893
15
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
17
diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
18
index 2095b01..b557912 100644
19
--- a/src/pcm/pcm_hw.c
20
+++ b/src/pcm/pcm_hw.c
21
@@ -338,18 +338,6 @@ static int snd_pcm_hw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
25
-static int snd_pcm_hw_hw_free(snd_pcm_t *pcm)
27
- snd_pcm_hw_t *hw = pcm->private_data;
28
- int fd = hw->fd, err;
29
- if (ioctl(fd, SNDRV_PCM_IOCTL_HW_FREE) < 0) {
31
- SYSMSG("SNDRV_PCM_IOCTL_HW_FREE failed");
37
static void snd_pcm_hw_close_timer(snd_pcm_hw_t *hw)
39
if (hw->period_timer) {
40
@@ -421,6 +409,20 @@ static int snd_pcm_hw_change_timer(snd_pcm_t *pcm, int enable)
42
snd_pcm_hw_close_timer(hw);
43
pcm->fast_ops = &snd_pcm_hw_fast_ops;
44
+ hw->period_event = 0;
49
+static int snd_pcm_hw_hw_free(snd_pcm_t *pcm)
51
+ snd_pcm_hw_t *hw = pcm->private_data;
52
+ int fd = hw->fd, err;
53
+ snd_pcm_hw_change_timer(pcm, 0);
54
+ if (ioctl(fd, SNDRV_PCM_IOCTL_HW_FREE) < 0) {
56
+ SYSMSG("SNDRV_PCM_IOCTL_HW_FREE failed");