From bb812433a8847704ab7681aad812558439e176ee Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 1 Mar 2007 17:13:26 +0000 Subject: [PATCH] Handle when ALSA tweaks our sample spec so much that the frame size changes. (closes #57). git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1431 fefdeb5f-60dc-0310-8127-8f9354f1896f --- Makefile.am | 6 ++++-- configure.ac | 1 + src/modules/module-alsa-sink.c | 9 ++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1b77187..765e8fa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,8 +17,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA. -EXTRA_DIST = bootstrap.sh LICENSE GPL LGPL doxygen/Makefile.am doxygen/Makefile.in doxygen/doxygen.conf.in README todo -SUBDIRS=libltdl src doxygen +EXTRA_DIST = config.rpath m4/ChangeLog bootstrap.sh LICENSE GPL LGPL doxygen/Makefile.am doxygen/Makefile.in doxygen/doxygen.conf.in README todo +SUBDIRS= libltdl src doxygen MAINTAINERCLEANFILES = noinst_DATA = @@ -46,3 +46,5 @@ doxygen: $(MAKE) -C doxygen doxygen .PHONY: homepage distcleancheck doxygen + +ACLOCAL_AMFLAGS = -I m4 diff --git a/configure.ac b/configure.ac index 65a99a0..68ad672 100644 --- a/configure.ac +++ b/configure.ac @@ -772,6 +772,7 @@ AM_CONDITIONAL([FORCE_PREOPEN], [test "x$FORCE_PREOPEN" = "x1"]) AC_CONFIG_FILES([ Makefile src/Makefile +po/Makefile.in libpulse.pc libpulse-simple.pc libpulse-browse.pc diff --git a/src/modules/module-alsa-sink.c b/src/modules/module-alsa-sink.c index 74a57f3..6f8f270 100644 --- a/src/modules/module-alsa-sink.c +++ b/src/modules/module-alsa-sink.c @@ -159,7 +159,11 @@ static void do_write(struct userdata *u) { memchunk = &u->memchunk; } - assert(memchunk->memblock && memchunk->memblock->data && memchunk->length && memchunk->memblock->length && (memchunk->length % u->frame_size) == 0); + assert(memchunk->memblock); + assert(memchunk->memblock->data); + assert(memchunk->length); + assert(memchunk->memblock->length); + assert((memchunk->length % u->frame_size) == 0); if ((frames = snd_pcm_writei(u->pcm_handle, (uint8_t*) memchunk->memblock->data + memchunk->index, memchunk->length / u->frame_size)) < 0) { if (frames == -EAGAIN) @@ -415,6 +419,9 @@ int pa__init(pa_core *c, pa_module*m) { goto fail; } + /* ALSA might tweak the sample spec, so recalculate the frame size */ + frame_size = pa_frame_size(&ss); + if (ss.channels != map.channels) /* Seems ALSA didn't like the channel number, so let's fix the channel map */ pa_channel_map_init_auto(&map, ss.channels, PA_CHANNEL_MAP_ALSA); -- 2.7.4