Skip to content

Commit 20d9a26

Browse files
committed
ALSA: snd-aloop - fix capture buffer silence
In a special case, some old samples are left in the capture ring buffer. Fix it. Signed-off-by: Jaroslav Kysela <[email protected]>
1 parent 1446c5f commit 20d9a26

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sound/drivers/aloop.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ static void copy_play_buf(struct loopback_pcm *play,
347347
unsigned int bytes)
348348
{
349349
struct snd_pcm_runtime *runtime = play->substream->runtime;
350-
char *src = play->substream->runtime->dma_area;
350+
char *src = runtime->dma_area;
351351
char *dst = capt->substream->runtime->dma_area;
352352
unsigned int src_off = play->buf_pos;
353353
unsigned int dst_off = capt->buf_pos;
@@ -385,8 +385,10 @@ static void copy_play_buf(struct loopback_pcm *play,
385385
dst_off = (dst_off + size) % capt->pcm_buffer_size;
386386
}
387387

388-
if (clear_bytes > 0)
388+
if (clear_bytes > 0) {
389389
clear_capture_buf(capt, clear_bytes);
390+
capt->silent_size = 0;
391+
}
390392
}
391393

392394
#define BYTEPOS_UPDATE_POSONLY 0

0 commit comments

Comments
 (0)