SHA256
1
0
forked from pool/alsa-utils
alsa-utils/0004-alsaloop-Improve-xrun_sync-fill-missing-playback-sam.patch
Takashi Iwai 3a57fbf7f8 Accepting request 122710 from home:tiwai:branches:multimedia:libs
- backport fix patches from upstream:
  * Some document fixes
  * Improve xrun_sync in alsaloop
  * Add option to dump HW parameters to aplay
  * Add the support for mapped volumes to amixer
  * Add option to tread any xrun as fatal to aplay/arecord
  * configure.in fixes
  * alsactl: Don't access other cards than specified
  * aplay prints Vu-meter to stderr now
  * fix the avail_min setup in alsaloop

OBS-URL: https://build.opensuse.org/request/show/122710
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=52
2012-05-29 09:34:36 +00:00

43 lines
1.3 KiB
Diff

From 53107e1e3146e3687e571b2c31f9d271623c5411 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Mon, 20 Feb 2012 16:41:19 +0100
Subject: [PATCH 04/13] alsaloop: Improve xrun_sync - fill missing playback
samples
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
alsaloop/pcmjob.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/alsaloop/pcmjob.c b/alsaloop/pcmjob.c
index bfac2d3..c9b120f 100644
--- a/alsaloop/pcmjob.c
+++ b/alsaloop/pcmjob.c
@@ -949,6 +949,23 @@ static int xrun_sync(struct loopback *loop)
logit(LOG_CRIT, "%s start failed: %s\n", play->id, snd_strerror(err));
return err;
}
+ } else if (delay1 < fill) {
+ diff = (fill - delay1) / play->pitch;
+ while (diff > 0) {
+ delay1 = play->buf_size - play->buf_pos;
+ if (verbose > 6)
+ snd_output_printf(loop->output,
+ "sync: playback short, silence filling %li / buf_count=%li\n", (long)delay1, play->buf_count);
+ if (delay1 > diff)
+ delay1 = diff;
+ if ((err = snd_pcm_format_set_silence(play->format, play->buf + play->buf_pos * play->channels, delay1)) < 0)
+ return err;
+ play->buf_pos += delay1;
+ play->buf_pos %= play->buf_size;
+ play->buf_count += delay1;
+ diff -= delay1;
+ }
+ writeit(play);
}
if (verbose > 5) {
snd_output_printf(loop->output, "%s: xrun sync ok\n", loop->id);
--
1.7.9.2