From 0dc150b7eff633f8f96ec46d706eff77b5f42271 Mon Sep 17 00:00:00 2001 From: Xing Zheng Date: Tue, 6 Nov 2018 10:27:40 +0800 Subject: [PATCH] ALSA: aloop: fix clear capture buf at wrong time We need to use uniform current jiffies to avoid the delta_capt too fast and the playback data is cleared. Change-Id: I15e46a3857d76ca37b01a4af4c4d331ec41febfc Signed-off-by: Xing Zheng --- sound/drivers/aloop.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c index 38d73b973a5f..23e91fc85929 100644 --- a/sound/drivers/aloop.c +++ b/sound/drivers/aloop.c @@ -498,15 +498,16 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable) cable->streams[SNDRV_PCM_STREAM_CAPTURE]; unsigned long delta_play = 0, delta_capt = 0; unsigned int running, count1, count2; + unsigned long cur_jiffies = cycles_to_jiffies(); running = cable->running ^ cable->pause; if (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) { - delta_play = cycles_to_jiffies() - dpcm_play->last_jiffies; + delta_play = cur_jiffies - dpcm_play->last_jiffies; dpcm_play->last_jiffies += delta_play; } if (running & (1 << SNDRV_PCM_STREAM_CAPTURE)) { - delta_capt = cycles_to_jiffies() - dpcm_capt->last_jiffies; + delta_capt = cur_jiffies - dpcm_capt->last_jiffies; dpcm_capt->last_jiffies += delta_capt; }