alsa-utils/0003-alsaloop-another-try-to-force-correct-formats-for-li.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

73 lines
2.4 KiB
Diff

From 3801e25964070390c525b9f2c39913e6ea1eb864 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 8 Mar 2011 12:56:56 +0100
Subject: [PATCH 03/16] alsaloop: another try to force correct formats for
libsamplerate
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
alsaloop/pcmjob.c | 22 ++++++++++++++++------
1 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/alsaloop/pcmjob.c b/alsaloop/pcmjob.c
index 6b50cf0..bfac2d3 100644
--- a/alsaloop/pcmjob.c
+++ b/alsaloop/pcmjob.c
@@ -1358,11 +1358,11 @@ static void lhandle_start(struct loopback_handle *lhandle)
lhandle->total_queued = 0;
}
-static void fix_format(struct loopback *loop)
+static void fix_format(struct loopback *loop, int force)
{
snd_pcm_format_t format = loop->capt->format;
- if (loop->sync != SYNC_TYPE_SAMPLERATE)
+ if (!force && loop->sync != SYNC_TYPE_SAMPLERATE)
return;
if (format == SND_PCM_FORMAT_S16 ||
format == SND_PCM_FORMAT_S32)
@@ -1400,7 +1400,7 @@ int pcmjob_start(struct loopback *loop)
if (err < 0)
goto __error;
loop->play->format = loop->capt->format = err;
- fix_format(loop);
+ fix_format(loop, 0);
err = get_rate(loop->capt);
if (err < 0)
goto __error;
@@ -1412,6 +1412,7 @@ int pcmjob_start(struct loopback *loop)
}
loop->reinit = 0;
loop->use_samplerate = 0;
+__again:
if (loop->latency_req) {
loop->latency_reqtime = frames_to_time(loop->play->rate_req,
loop->latency_req);
@@ -1460,10 +1461,19 @@ int pcmjob_start(struct loopback *loop)
goto __error;
if ((err = init_handle(loop->capt, 1)) < 0)
goto __error;
- if (loop->play->rate_req != loop->play->rate)
- loop->use_samplerate = 1;
- if (loop->capt->rate_req != loop->capt->rate)
+ if (loop->play->rate_req != loop->play->rate ||
+ loop->capt->rate_req != loop->capt->rate) {
+ snd_pcm_format_t format1, format2;
loop->use_samplerate = 1;
+ format1 = loop->play->format;
+ format2 = loop->capt->format;
+ fix_format(loop, 1);
+ if (loop->play->format != format1 ||
+ loop->capt->format != format2) {
+ pcmjob_stop(loop);
+ goto __again;
+ }
+ }
}
#ifdef USE_SAMPLERATE
if (loop->sync == SYNC_TYPE_SAMPLERATE)
--
1.7.5.3