SHA256
1
0
forked from pool/alsa-utils
alsa-utils/0002-alsaloop-libsamplerate-requires-specific-formats-for.patch
Takashi Iwai 141a404e6c Accepting request 72632 from home:tiwai:branches:multimedia:libs
- Backport alsa-utils fixes from upstream:
  0001-alsamixer-fix-display-of-active-inactive-controls.patch
  0002-alsaloop-libsamplerate-requires-specific-formats-for.patch
  0003-alsaloop-another-try-to-force-correct-formats-for-li.patch
  0004-alsamixer-fix-build-on-uClibc.patch
  0005-alsactl-init-Mute-CD-Playback-volume-by-default.patch
  0006-Revert-alsactl-Display-help-for-names-command.patch
  0007-alsaucm-Add-list1-command-for-non-tuple-lists.patch
  0008-alsaucm-Don-t-double-free-empty-lists.patch
  0009-aplay-Add-i-option-for-interactive-mode.patch
  0010-aplay-Avoid-recursive-signal-handling.patch
  0012-alsaloop-Use-AM_CFLAGS-in-Makefile.am.patch
  0013-Updated-COPYING-with-the-recent-FSF-address.patch
  0014-alsamixer-Fix-64bit-issues.patch
  0015-aplay-Add-include-files-for-mkdir.patch
  0016-aplay-Use-standard-endian-convesions.patch

OBS-URL: https://build.opensuse.org/request/show/72632
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=33
2011-06-03 13:33:27 +00:00

62 lines
1.8 KiB
Diff

From 3853175d122ef368db1f653140502ec44d4b2a4a Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Mon, 7 Mar 2011 14:21:19 +0100
Subject: [PATCH 02/16] alsaloop: libsamplerate requires specific formats,
force them for slave mode
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
alsaloop/pcmjob.c | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/alsaloop/pcmjob.c b/alsaloop/pcmjob.c
index 0b84803..6b50cf0 100644
--- a/alsaloop/pcmjob.c
+++ b/alsaloop/pcmjob.c
@@ -1238,8 +1238,8 @@ static int closeit(struct loopback_handle *lhandle)
static int init_handle(struct loopback_handle *lhandle, int alloc)
{
snd_pcm_uframes_t lat;
- lhandle->frame_size = (snd_pcm_format_width(lhandle->format) / 8) *
- lhandle->channels;
+ lhandle->frame_size = (snd_pcm_format_physical_width(lhandle->format)
+ / 8) * lhandle->channels;
lhandle->sync_point = lhandle->rate * 15; /* every 15 seconds */
lat = lhandle->loopback->latency;
if (lhandle->buffer_size > lat)
@@ -1358,6 +1358,23 @@ static void lhandle_start(struct loopback_handle *lhandle)
lhandle->total_queued = 0;
}
+static void fix_format(struct loopback *loop)
+{
+ snd_pcm_format_t format = loop->capt->format;
+
+ if (loop->sync != SYNC_TYPE_SAMPLERATE)
+ return;
+ if (format == SND_PCM_FORMAT_S16 ||
+ format == SND_PCM_FORMAT_S32)
+ return;
+ if (snd_pcm_format_width(format) > 16)
+ format = SND_PCM_FORMAT_S32;
+ else
+ format = SND_PCM_FORMAT_S16;
+ loop->capt->format = format;
+ loop->play->format = format;
+}
+
int pcmjob_start(struct loopback *loop)
{
snd_pcm_uframes_t count;
@@ -1383,6 +1400,7 @@ int pcmjob_start(struct loopback *loop)
if (err < 0)
goto __error;
loop->play->format = loop->capt->format = err;
+ fix_format(loop);
err = get_rate(loop->capt);
if (err < 0)
goto __error;
--
1.7.5.3