Re: [pulseaudio-discuss] Compile and build of pulseaudio under Windows Mingw32

2012-01-06 Thread Maarten Bosmans
2012/1/4 peqoud :
> Hello!

Hi Erich,

I sent my reply to the pulseaudio mailing list. Please subscribe or
keep the list included in CC.

> Iam Erich and I just recently found out about your mingw32-build branch of
> pulseaudio for Windows on the following link:
>
> https://github.com/mkbosmans/pulseaudio/commits/mingw32-build

Note: This branch currently is just the upstream 1.1 release (see
pulseaudio.org), all the win32-specific patches have been merged.

> As I could not find any documentation on how to compile this under Windows
> with mingw32 I hoped you can give me some adivce on this? Maybe there is
> even something I did not see?

There's no documentation of it, because it's all pretty standard. If
you have mingw32 installed, it's just your regular ./configure; make;
make install.

Having said that, I have never tried compiling _on_ Windows myself.
The win32 support has been developed on Linux, cross-compiling _for_
Windows. My experience with setting up a mingw32 environment on
Windows is that it is a great pain to get all the details right and
working.

> I basically just wanted to start into writting a WinAMP output plugin which
> should stream music to another pulseaudio server. But I did not even
> overcome the first step ;)

That would be a really nice thing to have!

> best regards,
> Erich Ebenhoch

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Sharing logged in users instance over TCP better than systemwide daemon?

2011-12-31 Thread Maarten Bosmans
2011/12/31 Graeme Pietersz :
>> Conceptally a system daemon ran from an /etc/init.d script is a better
>> fit to make a sound server available than a auto-logon user.
>
> I can see that, but after all the warnings about a system wide daemon
> being unsupported I was looking for a least bad solution.

It's still true that system-wide mode is wrong for a lot of common use
cases, even in some were it appears to be an easy way to get what you
want. The proposed workaround that you mentioned (adding a separate
user for a network-enabled pulse daemon) is even worse though.

> Perhaps this should be mentioned in the wiki? The only use case
> mentioned for a system wide daemon there is an embedded system or a
> thin client. There are also lots of scary warnings on this page:
>
> http://pulseaudio.org/wiki/WhatIsWrongWithSystemMode
>
> including this:
>
>    But my Gentoo/... distro is shipping an init script for PA!
>
>    Ignore that. It's stupid. They shouldn't be doing this.
>
> Which, again, appears over the top given there is a reasonably common
> case for which it is the right solution.

Yup, this could be better stated, more nuanced. It's important to note
though that for desktop scenario's (even with e.g. mpd) you're better
of in normal per-user mode. System-wide (and by extension the init
script) is mainly usefull for a sound server accessible over the
network.

It's a wiki (hint, hint)

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] Remove pa_prioq priority queue implementation

2011-12-26 Thread Maarten Bosmans
ping

2011/11/18 Maarten Bosmans :
> How is it that we end up with these list-like datatypes in the tree
> which are completely unused? The pa_prioq datatype was added three
> years ago, but never used.
>
> So unless somebody envisions a use for it in the near future, I
> propose to just delete it.
>
> Maarten
>
> 2011/11/18 Maarten Bosmans :
>> ---
>>  src/.gitignore         |    1 -
>>  src/Makefile.am        |    9 +--
>>  src/pulsecore/prioq.c  |  256 
>> 
>>  src/pulsecore/prioq.h  |   62 
>>  src/tests/prioq-test.c |   47 -
>>  5 files changed, 1 insertions(+), 374 deletions(-)
>>  delete mode 100644 src/pulsecore/prioq.c
>>  delete mode 100644 src/pulsecore/prioq.h
>>  delete mode 100644 src/tests/prioq-test.c
>>
>> diff --git a/src/.gitignore b/src/.gitignore
>> index 4a66969..cbde067 100644
>> --- a/src/.gitignore
>> +++ b/src/.gitignore
>> @@ -51,7 +51,6 @@ mix-test
>>  once-test
>>  pacat-simple
>>  parec-simple
>> -prioq-test
>>  proplist-test
>>  queue-test
>>  remix-test
>> diff --git a/src/Makefile.am b/src/Makefile.am
>> index 5d63aec..a028eea 100644
>> --- a/src/Makefile.am
>> +++ b/src/Makefile.am
>> @@ -238,8 +238,7 @@ TESTS_default = \
>>                volume-test \
>>                mix-test \
>>                proplist-test \
>> -               lock-autospawn-test \
>> -               prioq-test
>> +               lock-autospawn-test
>>
>>  TESTS_norun = \
>>                mcalign-test \
>> @@ -493,11 +492,6 @@ lock_autospawn_test_LDADD = $(AM_LDADD) 
>> libpulsecore-@PA_MAJORMINOR@.la libpulse
>>  lock_autospawn_test_CFLAGS = $(AM_CFLAGS)
>>  lock_autospawn_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
>>
>> -prioq_test_SOURCES = tests/prioq-test.c
>> -prioq_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulse.la 
>> libpulsecommon-@PA_MAJORMINOR@.la
>> -prioq_test_CFLAGS = $(AM_CFLAGS)
>> -prioq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
>> -
>>  sigbus_test_SOURCES = tests/sigbus-test.c
>>  sigbus_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulse.la 
>> libpulsecommon-@PA_MAJORMINOR@.la
>>  sigbus_test_CFLAGS = $(AM_CFLAGS)
>> @@ -584,7 +578,6 @@ libpulsecommon_@PA_MAJORMINOR@_la_SOURCES = \
>>                pulsecore/pid.c pulsecore/pid.h \
>>                pulsecore/pipe.c pulsecore/pipe.h \
>>                pulsecore/poll.c pulsecore/poll.h \
>> -               pulsecore/prioq.c pulsecore/prioq.h \
>>                pulsecore/memtrap.c pulsecore/memtrap.h \
>>                pulsecore/aupdate.c pulsecore/aupdate.h \
>>                pulsecore/proplist-util.c pulsecore/proplist-util.h \
>> diff --git a/src/pulsecore/prioq.c b/src/pulsecore/prioq.c
>> deleted file mode 100644
>> index 983db0f..000
>> --- a/src/pulsecore/prioq.c
>> +++ /dev/null
>> @@ -1,256 +0,0 @@
>> -/***
>> -  This file is part of PulseAudio.
>> -
>> -  Copyright 2008 Lennart Poettering
>> -
>> -  PulseAudio is free software; you can redistribute it and/or modify
>> -  it under the terms of the GNU Lesser General Public License as published
>> -  by the Free Software Foundation; either version 2.1 of the License,
>> -  or (at your option) any later version.
>> -
>> -  PulseAudio is distributed in the hope that it will be useful, but
>> -  WITHOUT ANY WARRANTY; without even the implied warranty of
>> -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> -  General Public License for more details.
>> -
>> -  You should have received a copy of the GNU Lesser General Public License
>> -  along with PulseAudio; if not, write to the Free Software
>> -  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
>> -  USA.
>> -***/
>> -
>> -#ifdef HAVE_CONFIG_H
>> -#include 
>> -#endif
>> -
>> -#include 
>> -
>> -#include 
>> -
>> -#include "prioq.h"
>> -
>> -struct pa_prioq_item {
>> -    void *value;
>> -    unsigned idx;
>> -};
>> -
>> -struct pa_prioq {
>> -    pa_prioq_item **items;
>> -    unsigned n_items;
>> -    unsigned n_allocated;
>> -    pa_compare_func_t compare_func;
>> -};
>> -
>> -PA_STATIC_FLIST_DECLARE(items, 0, pa_xfree);
>> -
>> -pa_prioq *pa_prioq_new(pa_compare_func_t compare_func) {
>> -
>> -    pa_prioq *q;
>> -
>> -    q = pa_xnew(pa_pri

Re: [pulseaudio-discuss] Sharing logged in users instance over TCP better than systemwide daemon?

2011-12-22 Thread Maarten Bosmans
2011/12/22 Graeme Pietersz :
>
>> Message: 1
>> Date: Wed, 21 Dec 2011 23:24:50 +0100
>> From: Maarten Bosmans 
>> Subject: Re: [pulseaudio-discuss] Sharing logged in users instance
>>       over TCP better than systemwide daemon?
>> To: General PulseAudio Discussion
>>       
>> Message-ID:
>>       
>> Content-Type: text/plain; charset=UTF-8
>>
>> 2011/12/10 Graeme Pietersz :
>> > I want a shared PC on a home LAN to be able to play a stream
>> > uninterrupted through one sound card (connected to a decent amp and
>> > speakers in the sitting room) while allowing other users to login
>> > and use another sound card if they wish.
>> >
>> > I was planning to use a system-wide daemon, but after reading the
>> > warnings about it, I wondered if this was a better solution:
>>
>> Actually, in this case I think a system-wide daemon is the right
>> setup. Some of the disadvantages (e.g. no shm) don't apply of the only
>> thing you want is to make a sink available over the network.
>>
>> > Following the suggestion in this thread:
>> >
>> > http://forums.fedoraforum.org/showthread.php?t=190954
>> >
>> > Have an auto logged in user that starts pulseaudio with:
>> >
>> > load-module module-native-protocol-tcp
>> >
>> > in its ~/.pulse/default.pa
>> >
>> > all other users have:
>> >
>> > default-server = 127.0.0.1
>> >
>> > in ?~/.pulse/client.conf
>> >
>> > That way any local user or anyone on the LAN can play a stream
>> > though this machine.
>> >
>> > Is this better than a system-wide daemon in any way? Is it better
>> > supported?
>>
>> I would not recommend this setup. This is just simulating a
>> system-wide daemon with a separate user daemon and has all the same
>> disadvantages. Then why not simply use the system-wide feature?
>
> I have got it running this was in the meantime. I did it because of all
> the warnings about it being unsupported: "it is explicitly not designed
> for it, you are on your own if you use it"
>
> Should I switch to a system wide daemon urgently or at leisure? Any huge
> problem with what I am doing (given that that user is always logged in
> anyway)?

Not really, but the extra user is a bit of a hack and system-wide fits
your use case nicely. I don't know which distro you are on, but at
least on Debian/Ubuntu the pulseaudio package comes with a nice init
script and pulse/pulse-access users configured for system-wide mode.

Conceptally a system daemon ran from an /etc/init.d script is a better
fit to make a sound server available than a auto-logon user.

>> > Obviously, allowing any user access is not a security issue as that
>> > is what I want (it would be good to restrict network access to the
>> > microphone though, but its not essential).
>>
>> The best setup I can think of is to run a system-wide daemon on
>> startup with module-native-protocol-tcp loaded and a per-user daemon
>> in the default setup. You should setup both daemon's config files
>> (/etc/pulse/{system,default}.pa respectively) such that instead of
>> running module-udev-detect, you only load a module-alsa-sink (and
>> perhaps a source) for the right soundcard, so that each daemon only
>> has sinks and sources for the card it needs. (thereby also solving the
>> microfone eavesdropping problem)
>
> I am a bit confused by this. Why does the per-user daemon need the
> sound card as a sink? I imagined it would see a network sink.

I understood your use case to be a separate high-quality soundcard for
living-room sound that should be made available to all machines on the
network and the integrated soundcard on the mainboard for local sound
for logged in users. Those are the two soundcards I was speaking of.

> Is there any chance of this ever being a supported way of doing things?
> Users like me really need some recommended way of doing this. Its not
> an uncommon requirement (as many previous posts on this mailing
> list, various distro forums, etc. show).
>
> Ideally I would like to be able to do this as easily as I can share a
> printer or a directory (i.e. tick boxes in a GUI). At the moment its
> harder than configuring most web servers or RDBMSs.
>
> Thanks for your help and I will try doing it this way.
>
>>
>> There could be a problem with the dbus bits of pulse, but I think that
>> those are solved in git master.
>
> So I would need to compile and install that? I am not really
> comfortable with replacing something that is provided by defau

Re: [pulseaudio-discuss] Sharing logged in users instance over TCP better than systemwide daemon?

2011-12-22 Thread Maarten Bosmans
Tanu,

Thanks for filling in the details. I knew I was missing some things,
but thought just to answer Graeme's questions to get the discussion
going.

Good to know that manually loading module-alsa-card works. Doing that
just never crossed my mind.

Maarten

2011/12/22 Tanu Kaskinen :
> On Wed, 2011-12-21 at 23:24 +0100, Maarten Bosmans wrote:
>> 2011/12/10 Graeme Pietersz :
>> > Obviously, allowing any user access is not a security issue as that is 
>> > what I want (it would be good to restrict network access to the microphone 
>> > though, but its not essential).
>>
>> The best setup I can think of is to run a system-wide daemon on
>> startup with module-native-protocol-tcp loaded and a per-user daemon
>> in the default setup. You should setup both daemon's config files
>> (/etc/pulse/{system,default}.pa respectively) such that instead of
>> running module-udev-detect, you only load a module-alsa-sink (and
>> perhaps a source) for the right soundcard, so that each daemon only
>> has sinks and sources for the card it needs. (thereby also solving the
>> microfone eavesdropping problem)
>
> Good advice. I'd use module-alsa-card instead of module-alsa-sink and
> module-alsa-source, though. That way all profiles that are supported by
> the card will be available, and you don't have to think about the sink
> parameters.
>
> Loading module-alsa-card is simple:
>
>    load-module module-alsa-card device_id=
>
>  is what /proc/asound/card shows you. The index may not
> stay stable across reboots, so using the card name is preferable. I have
> this in /proc/asound/cards:
>
>  0 [Intel          ]: HDA-Intel - HDA Intel
>                      HDA Intel at 0xee40 irq 47
>
> Here 0 is the card index, and "Intel" is the card name.
>
>> There could be a problem with the dbus bits of pulse, but I think that
>> those are solved in git master.
>
> If you mean refusing to start when the session isn't available, the
> problem (which is already fixed in 1.1) shouldn't affect the system
> mode, and if I understood the setup correctly, the per-user mode will be
> started normally as part of the X session, so the problem won't affect
> the per-user mode either.
>
> --
> Tanu
>
> ___
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] commit: resampler: Move some peak resampler asserts around

2011-12-21 Thread Maarten Bosmans
This commit:
http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=dc8edf4b43bf20e9edf6efd31836218924fad1f0

resampler: Move some peak resampler asserts around
This moves a couple of asserts from peak_resample() to peaks_init()
since they're resampler parameters that shouldn't change after
initialisation.

is wrong IMHO.

The whole point of asserts is to protect from programmer errors. This
can be null pointers (the other asserts in that function), but also
parameters that can have only certain values. The fact that the assert
can also be placed at init time is irrelevant. As the commit message
says, they _shouldn't_ change after init, the assert just makes sure
that they really haven't.

Furthermore, the assert also functions as a code comment. As further
down in the function there is code like:

if (r->work_format == PA_SAMPLE_S16NE) {
  ...
} else {
  ...
}

With the assert
pa_assert(r->work_format == PA_SAMPLE_S16NE || r->work_format ==
PA_SAMPLE_FLOAT32NE);
in the same function, it is clear that the else block handles the
float32 part, without the assert, that fact is hidden from the
programmer.

I consider this second documentation aspect of the assert as least as
important as the correctness aspect of it.

It would be nice if patches like this could be submitted to the
mailing list first, instead of committing directly. That way they can
gather feedback. If there's no reaction within a week or so, just
commit it.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Sharing logged in users instance over TCP better than systemwide daemon?

2011-12-21 Thread Maarten Bosmans
2011/12/10 Graeme Pietersz :
> I want a shared PC on a home LAN to be able to play a stream uninterrupted 
> through one sound card (connected to a decent amp and speakers in the sitting 
> room) while allowing other users to login and use another sound card if they 
> wish.
>
> I was planning to use a system-wide daemon, but after reading the warnings 
> about it, I wondered if this was a better solution:

Actually, in this case I think a system-wide daemon is the right
setup. Some of the disadvantages (e.g. no shm) don't apply of the only
thing you want is to make a sink available over the network.

> Following the suggestion in this thread:
>
> http://forums.fedoraforum.org/showthread.php?t=190954
>
> Have an auto logged in user that starts pulseaudio with:
>
> load-module module-native-protocol-tcp
>
> in its ~/.pulse/default.pa
>
> all other users have:
>
> default-server = 127.0.0.1
>
> in  ~/.pulse/client.conf
>
> That way any local user or anyone on the LAN can play a stream though this 
> machine.
>
> Is this better than a system-wide daemon in any way? Is it better supported?

I would not recommend this setup. This is just simulating a
system-wide daemon with a separate user daemon and has all the same
disadvantages. Then why not simply use the system-wide feature?

> Obviously, allowing any user access is not a security issue as that is what I 
> want (it would be good to restrict network access to the microphone though, 
> but its not essential).

The best setup I can think of is to run a system-wide daemon on
startup with module-native-protocol-tcp loaded and a per-user daemon
in the default setup. You should setup both daemon's config files
(/etc/pulse/{system,default}.pa respectively) such that instead of
running module-udev-detect, you only load a module-alsa-sink (and
perhaps a source) for the right soundcard, so that each daemon only
has sinks and sources for the card it needs. (thereby also solving the
microfone eavesdropping problem)

There could be a problem with the dbus bits of pulse, but I think that
those are solved in git master.

> Latency an issue as it will mostly be used for music and broadcast streams. 
> Having an automatically logged in user is also not a problem as I want one 
> shared user anyway.

There shouldn't be a latency difference between per-user and
system-wide. (for network streams and in case everything is setup
correctly, primarily rtkit)

That being said, just for playing music in your home, latency
shouldn't be a big issue, right?

Maarten

> Graeme
>
> --
> Graeme Pietersz
> http://moneyterms.co.uk/
> http://pietersz.co.uk/
> http://twitter.com/gpietersz
> ___
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH v2] make Adrian's echo cancellation code optional

2011-12-21 Thread Maarten Bosmans
2011/12/11 Peter Meerwald :
> From: Peter Meerwald 
>
> makes the Adrian echo canceller implementation optional at compile time
>
> this patch supersedes an earlier patch proposal and addresses the following
> comments:
> * separate patch from speex dependency rework (Arun)
> * check that at least one EC implementation is available (Arun)
> * properly align yes/no in configure summary for Adrian (Frederic)
>
> ---
>  configure.ac                                 |   15 ++-
>  src/Makefile.am                              |   10 +++---
>  src/modules/echo-cancel/echo-cancel.h        |    4 
>  src/modules/echo-cancel/module-echo-cancel.c |    8 +++-
>  4 files changed, 32 insertions(+), 5 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index ac7dcbf..0009c17 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1176,7 +1176,14 @@ AC_SUBST(WEBRTC_CFLAGS)
>  AC_SUBST(WEBRTC_LIBS)
>  AM_CONDITIONAL([HAVE_WEBRTC], [test "x$HAVE_WEBRTC" = "x1"])
>
> +AC_ARG_ENABLE([adrian-aec],
> +    AS_HELP_STRING([--enable-adrian-aec], [Enable Adrian's optional echo 
> canceller]))
> +AS_IF([test "x$enable_adrian_aec" != "xno"],
> +    [HAVE_ADRIAN_EC=1])
> +AM_CONDITIONAL([HAVE_ADRIAN_EC], [test "x$HAVE_ADRIAN_EC" = "x1"])
> +
> +
>
>  ###
>  #            Output               #
>  ###
> @@ -1322,6 +1329,7 @@ AS_IF([test "x$HAVE_IPV6" = "x1"], ENABLE_IPV6=yes, 
> ENABLE_IPV6=no)
>  AS_IF([test "x$HAVE_OPENSSL" = "x1"], ENABLE_OPENSSL=yes, ENABLE_OPENSSL=no)
>  AS_IF([test "x$HAVE_FFTW" = "x1"], ENABLE_FFTW=yes, ENABLE_FFTW=no)
>  AS_IF([test "x$HAVE_ORC" = "xyes"], ENABLE_ORC=yes, ENABLE_ORC=no)
> +AS_IF([test "x$HAVE_ADRIAN_EC" = "x1"], ENABLE_ADRIAN_EC=yes, 
> ENABLE_ADRIAN_EC=no)
>  AS_IF([test "x$HAVE_SPEEX" = "x1"], ENABLE_SPEEX=yes, ENABLE_SPEEX=no)
>  AS_IF([test "x$HAVE_WEBRTC" = "x1"], ENABLE_WEBRTC=yes, ENABLE_WEBRTC=no)
>  AS_IF([test "x$HAVE_TDB" = "x1"], ENABLE_TDB=yes, ENABLE_TDB=no)
> @@ -1370,7 +1378,8 @@ echo "
>     Enable OpenSSL (for Airtunes): ${ENABLE_OPENSSL}
>     Enable fftw:                   ${ENABLE_FFTW}
>     Enable orc:                    ${ENABLE_ORC}
> -    Enable speex:                  ${ENABLE_SPEEX}
> +    Enable Adrian echo canceller:  ${ENABLE_ADRIAN_EC}
> +    Enable speex (resampler, AEC): ${ENABLE_SPEEX}
>     Enable WebRTC echo canceller:  ${ENABLE_WEBRTC}
>     Database
>       tdb:                         ${ENABLE_TDB}
> @@ -1388,6 +1397,10 @@ echo "
>     Legacy Database Entry Support: ${ENABLE_LEGACY_DATABASE_ENTRY_FORMAT}
>  "
>
> +if test "${ENABLE_SPEEX}" = "no" && test "${ENABLE_WEBRTC}" = "no" && test 
> "${ENABLE_ADRIAN_EC}" = "no" ; then
> +AC_MSG_ERROR([At least one echo canceller implementation must be available.])
> +fi
> +

I think it's better to just disable building module-echo-cancel
instead of giving this error message when none of the necessary
requirements are available. We have lots of modules that are only
optionally build.

Maarten

>  if test "${ENABLE_DBUS}" = "no" && test "x$os_is_win32" != "x1" ; then
>    echo "
>  = WARNING WARNING WARNING WARNING WARNING WARNING WARNING =
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 852e962..649f82f 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -1744,12 +1744,15 @@ module_suspend_on_idle_la_CFLAGS = $(AM_CFLAGS)
>
>  # echo-cancel module
>  module_echo_cancel_la_SOURCES = \
> -               modules/echo-cancel/module-echo-cancel.c 
> modules/echo-cancel/echo-cancel.h \
> -               modules/echo-cancel/adrian-aec.c 
> modules/echo-cancel/adrian-aec.h \
> -               modules/echo-cancel/adrian.c modules/echo-cancel/adrian.h
> +               modules/echo-cancel/module-echo-cancel.c 
> modules/echo-cancel/echo-cancel.h
>  module_echo_cancel_la_LDFLAGS = $(MODULE_LDFLAGS)
>  module_echo_cancel_la_LIBADD = $(MODULE_LIBADD) $(LIBSPEEX_LIBS)
>  module_echo_cancel_la_CFLAGS = $(AM_CFLAGS) $(SERVER_CFLAGS) 
> $(LIBSPEEX_CFLAGS)
> +if HAVE_ADRIAN_EC
> +module_echo_cancel_la_SOURCES += \
> +               modules/echo-cancel/adrian-aec.c 
> modules/echo-cancel/adrian-aec.h \
> +               modules/echo-cancel/adrian.c modules/echo-cancel/adrian.h
> +module_echo_cancel_la_CFLAGS += -DHAVE_ADRIAN_EC=1
>  if HAVE_ORC
>  ORC_SOURCE += modules/echo-cancel/adrian-aec
>  nodist_module_echo_cancel_la_SOURCES = \
> @@ -1758,6 +1761,7 @@ nodist_module_echo_cancel_la_SOURCES = \
>  module_echo_cancel_la_LIBADD += $(ORC_LIBS)
>  module_echo_cancel_la_CFLAGS += $(ORC_CFLAGS) 
> -I$(top_builddir)/src/modules/echo-cancel
>  endif
> +endif
>  if HAVE_SPEEX
>  module_echo_cancel_la_SOURCES += modules/echo-cancel/speex.c
>  endif
> diff --git a/src/modules/echo-cancel/echo-cancel.h 
> b/src/modules/echo-cancel/echo-cancel.h
> index 15d44f5..870d163 100644
> --- a/src/modules/echo-cancel/echo-cancel.h
> +++ b/src/modules/echo-cancel/echo-cancel.h
> @@ -52,10 +52,12 @@ struct pa_echo_canceller_params {
>   

Re: [pulseaudio-discuss] [PATCH] consistently use parameter name p for a pa_proplist in prototype

2011-12-21 Thread Maarten Bosmans
2011/12/12 Peter Meerwald :
> From: Peter Meerwald 
>
> ---
>  src/pulse/proplist.h |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/pulse/proplist.h b/src/pulse/proplist.h
> index 52bc5ba..b95cfc9 100644
> --- a/src/pulse/proplist.h
> +++ b/src/pulse/proplist.h
> @@ -391,13 +391,13 @@ void pa_proplist_clear(pa_proplist *p);
>
>  /** Allocate a new property list and copy over every single entry from
>  * the specific list. \since 0.9.11 */
> -pa_proplist* pa_proplist_copy(pa_proplist *t);
> +pa_proplist* pa_proplist_copy(pa_proplist *p);

It would be nice to keep the variable name in the function
implementation the same as it is in the definition. (I know it wasn't
already before your change, but even so)

>  /** Return the number of entries in the property list. \since 0.9.15 */
> -unsigned pa_proplist_size(pa_proplist *t);
> +unsigned pa_proplist_size(pa_proplist *p);
>
>  /** Returns 0 when the proplist is empty, positive otherwise \since 0.9.15 */
> -int pa_proplist_isempty(pa_proplist *t);
> +int pa_proplist_isempty(pa_proplist *p);
>
>  /** Return non-zero when a and b have the same keys and values.
>  * \since 0.9.16 */
> --
> 1.7.4.1
>
> ___
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [RFC] [PATCH] build-sys: Make esound bits optional

2011-12-21 Thread Maarten Bosmans
2011/12/21 Arun Raghavan :
> IMO EsounD is really quite irrelevant on most modern systems today, and more
> so for embedded systems.
>
> Any objections to making it optional?

No, seems fine.

I'd go for HAVE_ESOUND though just to keep it consistent with the rest.

As seen in Makefile.am as a conditional or in source files as a macro,
the semantics of the symbol for esound are not different from those
for e.g. solaris. It just determines whether a certain piece of code
gets compiled or not.

The only place where esound is different from the others is in
configure.ac. But even here we have already lost a precise link
between HAVE_SOLARIS and the availability of the solaris headers. As
when --disable-solaris is passed to configure, HAVE_SOLARIS=0 even
when the headers are available.

So it's probably better to be consistently imprecise with our variable
naming than to introduce a new name prefix.

Maarten

> Cheers,
> Arun
>
> ---
>  configure.ac    |    6 ++
>  src/Makefile.am |   39 ++-
>  2 files changed, 36 insertions(+), 9 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 5e9cebc..00c5bfd 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -739,6 +739,12 @@ AC_SUBST(HAVE_ALSA)
>  AM_CONDITIONAL([HAVE_ALSA], [test "x$HAVE_ALSA" = x1])
>  AS_IF([test "x$HAVE_ALSA" = "x1"], AC_DEFINE([HAVE_ALSA], 1, [Have ALSA?]))
>
> + EsounD support (optional) 
> +
> +AC_ARG_ENABLE([esound],
> +    AS_HELP_STRING([--disable-esound],[Disable optional EsounD support]))
> +AM_CONDITIONAL([WANT_ESOUND], [test "x$enable_esound" != "xno"])
> +
>   Solaris audio support (optional) 
>
>  AC_ARG_ENABLE([solaris],
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 649f82f..df91e68 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -900,8 +900,12 @@ modlibexec_LTLIBRARIES = \
>                libprotocol-cli.la \
>                libprotocol-simple.la \
>                libprotocol-http.la \
> -               libprotocol-native.la \
> +               libprotocol-native.la
> +
> +if WANT_ESOUND
> +modlibexec_LTLIBRARIES += \
>                libprotocol-esound.la
> +endif
>
>  # We need to emulate sendmsg/recvmsg to support this on Win32
>  if !OS_IS_WIN32
> @@ -939,9 +943,11 @@ libprotocol_native_la_CFLAGS += $(DBUS_CFLAGS)
>  libprotocol_native_la_LIBADD += $(DBUS_LIBS)
>  endif
>
> +if WANT_ESOUND
>  libprotocol_esound_la_SOURCES = pulsecore/protocol-esound.c 
> pulsecore/protocol-esound.h pulsecore/esound.h
>  libprotocol_esound_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version
>  libprotocol_esound_la_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINOR@.la 
> libpulsecommon-@PA_MAJORMINOR@.la libpulse.la
> +endif
>
>  librtp_la_SOURCES = \
>                modules/rtp/rtp.c modules/rtp/rtp.h \
> @@ -998,12 +1004,10 @@ modlibexec_LTLIBRARIES += \
>                module-sine.la \
>                module-native-protocol-tcp.la \
>                module-native-protocol-fd.la \
> -               module-esound-protocol-tcp.la \
>                module-combine.la \
>                module-combine-sink.la \
>                module-remap-sink.la \
>                module-ladspa-sink.la \
> -               module-esound-sink.la \
>                module-tunnel-sink.la \
>                module-tunnel-source.la \
>                module-position-event-sounds.la \
> @@ -1016,6 +1020,12 @@ modlibexec_LTLIBRARIES += \
>                module-filter-apply.la \
>                module-filter-heuristics.la
>
> +if WANT_ESOUND
> +modlibexec_LTLIBRARIES += \
> +               module-esound-protocol-tcp.la \
> +               module-esound-sink.la
> +endif
> +
>  # See comment at librtp.la above
>  if !OS_IS_WIN32
>  modlibexec_LTLIBRARIES += \
> @@ -1028,9 +1038,12 @@ modlibexec_LTLIBRARIES += \
>                module-cli-protocol-unix.la \
>                module-simple-protocol-unix.la \
>                module-http-protocol-unix.la \
> -               module-native-protocol-unix.la \
> +               module-native-protocol-unix.la
> +if WANT_ESOUND
> +modlibexec_LTLIBRARIES += \
>                module-esound-protocol-unix.la
>  endif
> +endif
>
>  if HAVE_MKFIFO
>  modlibexec_LTLIBRARIES += \
> @@ -1039,10 +1052,12 @@ modlibexec_LTLIBRARIES += \
>  endif
>
>  if !OS_IS_WIN32
> +if WANT_ESOUND
>  modlibexec_LTLIBRARIES += \
>                module-esound-compat-spawnfd.la \
>                module-esound-compat-spawnpid.la
>  endif
> +endif
>
>  if HAVE_REGEX
>  modlibexec_LTLIBRARIES += \
> @@ -1233,8 +1248,6 @@ SYMDEF_FILES = \
>                module-pipe-source-symdef.h \
>                module-simple-protocol-tcp-symdef.h \
>                module-simple-protocol-unix-symdef.h \
> -               module-esound-protocol-tcp-symdef.h \
> -               module-esound-protocol-unix-symdef.h \
>                module-native-protocol-tcp-symdef.h \
>                module-native-protocol-unix-symdef.h \
>                module-native-protocol-fd-symdef.h \
> @@ 

Re: [pulseaudio-discuss] what's the minimum requirement for a PA sink module

2011-12-21 Thread Maarten Bosmans
2011/12/1 wang dengyi :
> Hi Guys,
>
> We use pulseaudio as the audio server on our Linux system but the real sound
> card is on the other OS which only provides a very basic audio driver. The
> audio driver only receive the PCM data (in certain format) and play it back.

Could you explain your setup a bit clearer? Do you want to run pulse
on Linux or some other OS? Is there an ALSA or OSS driver available or
is this a network sink of some sorts?

> That's all for the sound card. So we need a very minimum sink module for PA.
> What's the minimum requirement for this sink? Could the sink just blindly
> dump the audio data to the audio driver?

In general: yes this is possible. Some sinks (e.g. module-alsa-sink)
do a lot of thing, but at the heart of the sink is always the transfer
of pcm data. You could look for ideas of how to implement this in
module-oss-sink or module-pipe-sink.

Most sinks also try to account for clock differences between the sink
clock (audio hardware samplerate) and host clock (computer and pulse's
samplerate) beyond simply dumping audio data at a fixed rate.

> Regards,
>
> Dengyi Wang

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] echo-cancel test: fix segfault if invalid AEC method is given and handle mem leaks due to open files

2011-12-21 Thread Maarten Bosmans
Good work Peter,

I'd split this up into two separate patches, as the patch solves two
conceptually different issues, which just happen to be in the same
file.
(I'm sure at least Arun agrees with me here, as he has asked the same
many time already)

And the spelling fixes on the other hand could very well be more
gathered together in fewer, larger patches.

Maarten

2011/12/13 Peter Meerwald :
> From: Peter Meerwald 
>
> ---
>  src/modules/echo-cancel/module-echo-cancel.c |   16 ++--
>  1 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/src/modules/echo-cancel/module-echo-cancel.c 
> b/src/modules/echo-cancel/module-echo-cancel.c
> index 00cb2e3..96b652f 100644
> --- a/src/modules/echo-cancel/module-echo-cancel.c
> +++ b/src/modules/echo-cancel/module-echo-cancel.c
> @@ -1709,7 +1709,7 @@ int pa__init(pa_module*m) {
>         goto fail;
>     }
>
> -    if (init_common(ma, u, &source_ss, &source_map))
> +    if (init_common(ma, u, &source_ss, &source_map) < 0)
>         goto fail;
>
>     u->asyncmsgq = pa_asyncmsgq_new(0);
> @@ -2092,7 +2092,8 @@ int main(int argc, char* argv[]) {
>     source_ss.channels = DEFAULT_CHANNELS;
>     pa_channel_map_init_auto(&source_map, source_ss.channels, 
> PA_CHANNEL_MAP_DEFAULT);
>
> -    init_common(ma, &u, &source_ss, &source_map);
> +    if (init_common(ma, &u, &source_ss, &source_map) < 0)
> +        goto fail;
>
>     if (!u.ec->init(u.core, u.ec, &source_ss, &source_map, &sink_ss, 
> &sink_map, &u.blocksize,
>                      (argc > 4) ? argv[5] : NULL )) {
> @@ -2184,13 +2185,16 @@ int main(int argc, char* argv[]) {
>
>     u.ec->done(u.ec);
>
> -    fclose(u.captured_file);
> -    fclose(u.played_file);
> -    fclose(u.canceled_file);
> +out:
> +    if (u.captured_file)
> +        fclose(u.captured_file);
> +    if (u.played_file)
> +        fclose(u.played_file);
> +    if (u.canceled_file)
> +        fclose(u.canceled_file);
>     if (u.drift_file)
>         fclose(u.drift_file);
>
> -out:
>     pa_xfree(rdata);
>     pa_xfree(pdata);
>     pa_xfree(cdata);
> --
> 1.7.4.1
>
> ___
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] make speex optional, make Adrian AEC optional

2011-12-09 Thread Maarten Bosmans
2011/12/8 Arun Raghavan :
> 3. We should check to make sure that at least one canceller is selected
> at configure time

Or just skip building module-echo-cancel alltogether in that case.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] detection of SSE3 support in configure.ac

2011-12-06 Thread Maarten Bosmans
2011/12/6 Nallasellan, Singaravelan :
>> I have an optimized SSE-based resampling library that I bolted in 
>> PulseAudio. It was
>> measured to bring a 2x speed-up over speex, mainly because it uses 
>> fixed-tables
>> instead of interpolations, the price being that it can only be used for 
>> fixed-rate
>> sinks/sources.
>> Since it's hardware-specific, I'd need a means to enable/disable it at 
>> compile time,
>> using some kind of voodoo magic in configure.ac. Does anyone have pointers 
>> on SSE
>> detection logic? To make things safe, I also detect SSE at run time but 
>> would like to
>> disable it completely for other non-x86 or older platforms.
>
> CPUID processor instruction should provide all the details about the 
> processor.

Which is of course x86 specific and is already used for runtime
detection of features in src/pulsecore/cpu-x86.c.

For compile-time detection you can't use it, because of cross-compiling.
I'd just add a "case $host in" check and define a symbol like HAVE_ARM
and HAVE_X86 (if they aren't already defined somewhere) in
configure.ac, just like some ARM features are detected this way.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 2/3] conf-parser: Add support for parsing property lists.

2011-12-03 Thread Maarten Bosmans
Would the patch in this form also allow the parse_properties in
module-augment-properties to be replaced by this generic function from
conf-parser.h? That would be a nice extra.

Maarten

2011/12/3 Tanu Kaskinen :
> ---
>  src/daemon/daemon-conf.c                |    2 +-
>  src/modules/alsa/alsa-mixer.c           |    4 +-
>  src/modules/module-augment-properties.c |    2 +-
>  src/pulse/client-conf.c                 |    2 +-
>  src/pulsecore/conf-parser.c             |   46 
> ---
>  src/pulsecore/conf-parser.h             |   17 ++-
>  6 files changed, 62 insertions(+), 11 deletions(-)
>
> diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
> index 3ef7f81..4532e9e 100644
> --- a/src/daemon/daemon-conf.c
> +++ b/src/daemon/daemon-conf.c
> @@ -645,7 +645,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char 
> *filename) {
>     ci.default_channel_map_set = ci.default_sample_spec_set = FALSE;
>     ci.conf = c;
>
> -    r = f ? pa_config_parse(c->config_file, f, table, NULL) : 0;
> +    r = f ? pa_config_parse(c->config_file, f, table, NULL, NULL) : 0;
>
>     if (r >= 0) {
>
> diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
> index 36f3351..c646f31 100644
> --- a/src/modules/alsa/alsa-mixer.c
> +++ b/src/modules/alsa/alsa-mixer.c
> @@ -2390,7 +2390,7 @@ pa_alsa_path* pa_alsa_path_new(const char *paths_dir, 
> const char *fname, pa_alsa
>
>     fn = pa_maybe_prefix_path(fname, paths_dir);
>
> -    r = pa_config_parse(fn, NULL, items, p);
> +    r = pa_config_parse(fn, NULL, items, NULL, p);
>     pa_xfree(fn);
>
>     if (r < 0)
> @@ -4123,7 +4123,7 @@ pa_alsa_profile_set* pa_alsa_profile_set_new(const char 
> *fname, const pa_channel
>                               pa_run_from_build_tree() ? PA_BUILDDIR 
> "/modules/alsa/mixer/profile-sets/" :
>                               PA_ALSA_PROFILE_SETS_DIR);
>
> -    r = pa_config_parse(fn, NULL, items, ps);
> +    r = pa_config_parse(fn, NULL, items, NULL, ps);
>     pa_xfree(fn);
>
>     if (r < 0)
> diff --git a/src/modules/module-augment-properties.c 
> b/src/modules/module-augment-properties.c
> index 05f6f0a..d45bcdc 100644
> --- a/src/modules/module-augment-properties.c
> +++ b/src/modules/module-augment-properties.c
> @@ -228,7 +228,7 @@ static void update_rule(struct rule *r) {
>     table[0].data = &r->application_name;
>     table[1].data = &r->icon_name;
>
> -    if (pa_config_parse(fn, NULL, table, r) < 0)
> +    if (pa_config_parse(fn, NULL, table, NULL, r) < 0)
>         pa_log_warn("Failed to parse .desktop file %s.", fn);
>
>     pa_xfree(fn);
> diff --git a/src/pulse/client-conf.c b/src/pulse/client-conf.c
> index e2c2aae..3641e3e 100644
> --- a/src/pulse/client-conf.c
> +++ b/src/pulse/client-conf.c
> @@ -127,7 +127,7 @@ int pa_client_conf_load(pa_client_conf *c, const char 
> *filename) {
>                 goto finish;
>     }
>
> -    r = f ? pa_config_parse(fn, f, table, NULL) : 0;
> +    r = f ? pa_config_parse(fn, f, table, NULL, NULL) : 0;
>
>     if (!r)
>         r = pa_client_conf_load_cookie(c);
> diff --git a/src/pulsecore/conf-parser.c b/src/pulsecore/conf-parser.c
> index 41849c2..6602766 100644
> --- a/src/pulsecore/conf-parser.c
> +++ b/src/pulsecore/conf-parser.c
> @@ -44,15 +44,17 @@ struct parser_state {
>     unsigned lineno;
>     char *section;
>     const pa_config_item *item_table;
> +    pa_proplist *proplist;
>     char buf[4096];
>     void *userdata;
>
>     char *lvalue;
>     char *rvalue;
> +    pa_bool_t in_proplist;
>  };
>
>  /* Run the user supplied parser for an assignment */
> -static int next_assignment(struct parser_state *state) {
> +static int normal_assignment(struct parser_state *state) {
>     const pa_config_item *item;
>
>     pa_assert(state);
> @@ -76,6 +78,19 @@ static int next_assignment(struct parser_state *state) {
>     return -1;
>  }
>
> +/* Parse a proplist entry. */
> +static int proplist_assignment(struct parser_state *state) {
> +    pa_assert(state);
> +    pa_assert(state->proplist);
> +
> +    if (pa_proplist_sets(state->proplist, state->lvalue, state->rvalue) < 0) 
> {
> +        pa_log("[%s:%u] Failed to parse a proplist entry: %s = %s", 
> state->filename, state->lineno, state->lvalue, state->rvalue);
> +        return -1;
> +    }
> +
> +    return 0;
> +}
> +
>  /* Parse a variable assignment line */
>  static int parse_line(struct parser_state *state) {
>     char *c;
> @@ -102,7 +117,7 @@ static int parse_line(struct parser_state *state) {
>             }
>         }
>
> -        r = pa_config_parse(fn, NULL, state->item_table, state->userdata);
> +        r = pa_config_parse(fn, NULL, state->item_table, state->proplist, 
> state->userdata);
>         pa_xfree(path);
>         return r;
>     }
> @@ -120,6 +135,17 @@ static int parse_line(struct parser_state *state) {
>
>         pa_xfree(state->section);
>         state->section = pa_xstrndup(state->lvalue + 1, k-2);
> +
> +        if (pa_stre

Re: [pulseaudio-discuss] [PATCH 1/3] conf-parser: Pass parser state in a struct instead of function parameters.

2011-12-03 Thread Maarten Bosmans
2011/12/3 Tanu Kaskinen :
> I don't like long function parameter lists, and I plan to
> add some more state data to the parser which would make the
> parameter lists even longer without this refactoring.

Why not also change the pa_config_parser_cb_t prototype to accept a
parser_state struct?

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] Add a property list to ports.

2011-12-02 Thread Maarten Bosmans
2011/12/2 David Henningsson :
> There not used for anything yet, but hopefully soon they'll be.

I think it's a good idea to add this together with the first user of
the port proplist.

Also in the same series, please add a patch showing the port proplist
in pactl and pacmd output.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] daemon ping-pongs the sink port

2011-12-01 Thread Maarten Bosmans
2011/12/2 Tony Bernardin :
> Sorry if I'm posting this question in the wrong list. I've been trying to
> search for this issue, but have been unsuccessful so far with not even a
> hint at what I could try to get to the bottom of this. I'm not very familiar
> with the sound system.
>
> The symptom: regular hiccup in the sound output.
>
> What I've found:
> launching the pulseaudio daemon with -v showed that it is constantly
> changing the port of the sync:
>
> I: [pulseaudio] sink.c: Changed port of sink 1
> "alsa_output.pci-_00_1b.0.analog-stereo" to analog-output
> I: [pulseaudio] module-device-restore.c: Restoring volume for sink
> alsa_output.pci-_00_1b.0.analog-stereo.
> I: [pulseaudio] module-device-restore.c: Restoring mute state for sink
> alsa_output.pci-_00_1b.0.analog-stereo.
> I: [alsa-sink] alsa-sink.c: Successfully enabled synchronous volume.
> I: [alsa-sink] alsa-sink.c: Hardware volume ranges from -179.00 dB to 0.00
> dB.
> I: [alsa-sink] alsa-sink.c: Fixing base volume to 0.00 dB
> I: [alsa-sink] alsa-sink.c: Using hardware volume control. Hardware dB scale
> supported.
> I: [alsa-sink] alsa-sink.c: Using hardware mute control.
> I: [pulseaudio] sink.c: Changed port of sink 1
> "alsa_output.pci-_00_1b.0.analog-stereo" to analog-output-headphones
> I: [pulseaudio] module-device-restore.c: Restoring volume for sink
> alsa_output.pci-_00_1b.0.analog-stereo.
> I: [pulseaudio] module-device-restore.c: Restoring mute state for sink
> alsa_output.pci-_00_1b.0.analog-stereo.
> I: [alsa-sink] alsa-sink.c: Successfully enabled synchronous volume.
> I: [alsa-sink] alsa-sink.c: Hardware volume ranges from -179.00 dB to 0.00
> dB.
> I: [alsa-sink] alsa-sink.c: Fixing base volume to 0.00 dB
> I: [alsa-sink] alsa-sink.c: Using hardware volume control. Hardware dB scale
> supported.
> I: [alsa-sink] alsa-sink.c: Using hardware mute control.
>
> I noticed this also reflected in the "sound settings", and the port changes
> coincide with the hiccups.
>
> This is on up-to-date Ubuntu 11.10, where I believe the pulseaudio version
> 1.0. The underlying hardware is Intel HD audio that is integrated on the Z68
> motherboard.
>
> I'd greatly appreciate any suggestions as how I could get to the bottom of
> this issue? Maybe it's not pulseaudio's fault, but I don't know what
> configures these ports.

Interesting. Can you provide the full output of pulseaudio - when
this happens a couple of times?

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] spelling, recieve

2011-12-01 Thread Maarten Bosmans
2011/12/1 Peter Meerwald :
> Hello,
>
> probably PA has more pressing problems but 'receive' is mis-spelled
> 'recieve' in pulsecore/pstream.c, pulsecore/pstream.h,
> pulsecore/protocol-native.c, modules/module-tunnel.c, pulse/context.c

Good catch.

I did some spelling fixes a couple of months ago (including
recieve->receive), but I only checked comments and strings printed by
pulse and didn't think that function names would be spelled wrong too.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] "list-sinks" doesn't match "aplay -l"

2011-11-30 Thread Maarten Bosmans
2011/11/29 Cyrus Vafadari :
> I'm trying to use a bunch of sundcards (8 usb + 4 hdmi + 1 mobo) to control
> different zones separately & combine them in cool ways.
>
> I'm having trouble getting pulse to recognize all of my soundcards'
> existence.
>
> aplay -l recognizes all 13 cards, as does "pacmd list-cards", but pulse only
> recognizes 10 of them (0-9). It seems to find them in the "pacmd dump", but
> not in list-sinks.

Cards and sinks are different things. A card can have zero or more
sinks and zero or more sources. This can also change according to
which profile is selected for the card.

>From your output it seems that some cards only support an input
profile, hence no sinks show up for those.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 2/8] build-sys: Remove check for alloca()

2011-11-28 Thread Maarten Bosmans
2011/11/28 Colin Guthrie :
> 'Twas brillig, and Arun Raghavan at 14/11/11 05:28 did gyre and gimble:
>> On Wed, 2011-11-02 at 21:54 +0100, Maarten Bosmans wrote:
>>> As it isn't used anymore.
>>> Also, some minor cleanup.
>
>> Please break up patches into related changes only. I know that it's a
>> lot of small changes, but this sort of thing makes tracking back changes
>> and git bisect'ing a nightmare.
>>
>> Also, this would probably be checked in alsa-lib's build already, but we
>> *do* use alloca via a bunch of macros in the ALSA headers.
>
> Not sure where this stands with your thinking now Maarten, but I think
> this is now the only patch in the series without any resolution.

Yeah, I'll split it up one day and resubmit, you can clear it from your queue
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 8/8] Improve performance of peaks resampler

2011-11-28 Thread Maarten Bosmans
2011/11/27 Colin Guthrie :
> 'Twas brillig, and Maarten Bosmans at 02/11/11 20:54 did gyre and gimble:
>> This is mainly achieved by special-casing the common 1ch float case,
>> which is used by applications such as pavucontrol.
>
> OK, I pushed this and the previous patch too.
>
> I didn't check the maths so I'll trust your analysis here (and the peaks
> resampler isn't really super important either, hence my slightly
> lackadaisical stance :D)

Thanks Colin.

Unfortunately you pushed an earlier version of the patch. This isn't
entirely your fault, as these two patches have been floating on the
list in various versions at 16-11, 2-11 and 14-10 (note to readers
from the USA: try reversing those numbers ;-) and you picked the
middle one.

I rebased the latest patch on master and the diff that remains has
been sent to the list. It's fairly insignificant by itself, that's why
I rolled it up in the earlier patches to start with.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH] resampler: Some minor tweaks

2011-11-28 Thread Maarten Bosmans
that were forgotten in the previous peaks resampler commits.
---
 src/pulsecore/resampler.c |   18 --
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
index dda6a2f..3cee06f 100644
--- a/src/pulsecore/resampler.c
+++ b/src/pulsecore/resampler.c
@@ -1442,7 +1442,6 @@ static int trivial_init(pa_resampler*r) {
 /* Peak finder implementation */
 
 static void peaks_resample(pa_resampler *r, const pa_memchunk *input, unsigned 
in_n_frames, pa_memchunk *output, unsigned *out_n_frames) {
-size_t fz;
 unsigned c, o_index = 0;
 unsigned i, i_end = 0;
 void *src, *dst;
@@ -1452,21 +1451,20 @@ static void peaks_resample(pa_resampler *r, const 
pa_memchunk *input, unsigned i
 pa_assert(output);
 pa_assert(out_n_frames);
 pa_assert(r->i_ss.rate >= r->o_ss.rate);
+pa_assert(r->i_ss.channels == r->o_ss.channels);
 pa_assert(r->work_format == PA_SAMPLE_S16NE || r->work_format == 
PA_SAMPLE_FLOAT32NE);
 
-fz = r->w_sz * r->o_ss.channels;
-
 src = (uint8_t*) pa_memblock_acquire(input->memblock) + input->index;
 dst = (uint8_t*) pa_memblock_acquire(output->memblock) + output->index;
 
-i = ((r->peaks.o_counter * r->i_ss.rate) / r->o_ss.rate);
+i = (r->peaks.o_counter * r->i_ss.rate) / r->o_ss.rate;
 i = i > r->peaks.i_counter ? i - r->peaks.i_counter : 0;
 
 while (i_end < in_n_frames) {
-i_end = (((r->peaks.o_counter+1) * r->i_ss.rate) / r->o_ss.rate);
+i_end = ((r->peaks.o_counter+1) * r->i_ss.rate) / r->o_ss.rate;
 i_end = i_end > r->peaks.i_counter ? i_end - r->peaks.i_counter : 0;
 
-pa_assert_fp(o_index * fz < pa_memblock_get_length(output->memblock));
+pa_assert_fp(o_index * r->w_sz * r->o_ss.channels < 
pa_memblock_get_length(output->memblock));
 
 /* 1ch float is treated separately, because that is the common case */
 if (r->o_ss.channels == 1 && r->work_format == PA_SAMPLE_FLOAT32NE) {
@@ -1486,8 +1484,8 @@ static void peaks_resample(pa_resampler *r, const 
pa_memchunk *input, unsigned i
 o_index++, r->peaks.o_counter++;
 }
 } else if (r->work_format == PA_SAMPLE_S16NE) {
-int16_t *s = (int16_t*) ((uint8_t*) src + fz * i);
-int16_t *d = (int16_t*) ((uint8_t*) dst + fz * o_index);
+int16_t *s = (int16_t*) src + r->i_ss.channels * i;
+int16_t *d = (int16_t*) dst + r->o_ss.channels * o_index;
 
 for (; i < i_end && i < in_n_frames; i++)
 for (c = 0; c < r->o_ss.channels; c++) {
@@ -1505,8 +1503,8 @@ static void peaks_resample(pa_resampler *r, const 
pa_memchunk *input, unsigned i
 o_index++, r->peaks.o_counter++;
 }
 } else {
-float *s = (float*) ((uint8_t*) src + fz * i);
-float *d = (float*) ((uint8_t*) dst + fz * o_index);
+float *s = (float*) src + r->i_ss.channels * i;
+float *d = (float*) dst + r->o_ss.channels * o_index;
 
 for (; i < i_end && i < in_n_frames; i++)
 for (c = 0; c < r->o_ss.channels; c++) {
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] Hardcode FRAME_SIZE_MAX_ALLOW

2011-11-27 Thread Maarten Bosmans
2011/11/27 Colin Guthrie :
> 'Twas brillig, and Maarten Bosmans at 22/11/11 15:09 did gyre and gimble:
>> Instead of using PA_SCACHE_ENTRY_SIZE_MAX, the size for FRAME_SIZE_MAX_ALLOW 
>> is
>> set directly to the same value.  This removes the need for the core-scache.h
>> include, which caused an unwanted dependency of libpulsecommon on 
>> libpulsecore.
>>
>> Fixes https://bugs.freedesktop.org/show_bug.cgi?id=41539
>
> Thanks, pushed and the bug closed.

Erm, which bug did you close?
I just closed Bug 41539.

The attached patch for that bug did also resolve some linking problem
with the connect-stress test program, but that one is solved by
another patch by me floating on the list (tests: Don't link tests that
only usepublic api to libpulsecommon)

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] Update LICENSE

2011-11-27 Thread Maarten Bosmans
2011/11/27 Colin Guthrie :
> 'Twas brillig, and Maarten Bosmans at 22/11/11 15:08 did gyre and gimble:
>> Mention gdbm, lirc and fftw there.
>
> Cool. In a way we should possibly be deliberately vague here so that
> people who are concerned about this will investigate properly (I think
> this was a deliberate thought process during our last discussion on this
> topic), but I'm certainly not going to block more detail here.
>
> My only concern is that if we don't mention any future libs compiled in,
> that we may be called to task on it whereas if we were vague from the
> outset then we cannot be blamed! But this is mostly a paranoid "it might
> never happen" type concern, so... pushed.

You're right in that we shouldn't give any guarantees. But I think
it's very well possible to both be as complete as possible (I _think_
that my review caught all GPL dependencies) and at the same time put
the final burden on the concerned user. The last paragraph of LICENSE
makes this perfectly clear.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 4/4] Optimize trivial resampler

2011-11-23 Thread Maarten Bosmans
This improves the performance of a typical s16 2ch resampling by 88%.
---
 src/pulsecore/resampler.c |   12 +++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
index 5ba6b49..e33e4fb 100644
--- a/src/pulsecore/resampler.c
+++ b/src/pulsecore/resampler.c
@@ -1376,6 +1376,7 @@ static void trivial_resample(pa_resampler *r, const 
pa_memchunk *input, unsigned
 pa_assert(input);
 pa_assert(output);
 pa_assert(out_n_frames);
+pa_assert(r->i_ss.channels == r->o_ss.channels);
 
 fz = r->w_sz * r->o_ss.channels;
 
@@ -1391,7 +1392,16 @@ static void trivial_resample(pa_resampler *r, const 
pa_memchunk *input, unsigned
 
 pa_assert_fp(o_index * fz < pa_memblock_get_length(output->memblock));
 
-memcpy((uint8_t*) dst + fz * o_index, (uint8_t*) src + fz * i_index, 
(int) fz);
+/* Directly assign some common sample sizes, use memcpy as fallback */
+if (r->w_sz == 2) {
+for (unsigned c = 0; c < r->o_ss.channels; c++)
+((uint16_t *) dst)[o_index+c] = ((uint16_t *) src)[i_index+c];
+} else if (r->w_sz == 4) {
+for (unsigned c = 0; c < r->o_ss.channels; c++)
+((uint32_t *) dst)[o_index+c] = ((uint32_t *) src)[i_index+c];
+} else {
+memcpy((uint8_t *) dst + fz * o_index, (uint8_t *) src + fz * 
i_index, (int) fz);
+}
 }
 
 pa_memblock_release(input->memblock);
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 3/4] Use better variable name in trivial resampler

2011-11-23 Thread Maarten Bosmans
---
 src/pulsecore/resampler.c |   13 +
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
index 495f33f..5ba6b49 100644
--- a/src/pulsecore/resampler.c
+++ b/src/pulsecore/resampler.c
@@ -1369,7 +1369,7 @@ static int speex_init(pa_resampler *r) {
 
 static void trivial_resample(pa_resampler *r, const pa_memchunk *input, 
unsigned in_n_frames, pa_memchunk *output, unsigned *out_n_frames) {
 size_t fz;
-unsigned o_index;
+unsigned i_index, o_index;
 void *src, *dst;
 
 pa_assert(r);
@@ -1383,18 +1383,15 @@ static void trivial_resample(pa_resampler *r, const 
pa_memchunk *input, unsigned
 dst = (uint8_t*) pa_memblock_acquire(output->memblock) + output->index;
 
 for (o_index = 0;; o_index++, r->trivial.o_counter++) {
-unsigned j;
+i_index = (r->trivial.o_counter * r->i_ss.rate) / r->o_ss.rate;
+i_index = i_index > r->trivial.i_counter ? i_index - 
r->trivial.i_counter : 0;
 
-j = ((r->trivial.o_counter * r->i_ss.rate) / r->o_ss.rate);
-j = j > r->trivial.i_counter ? j - r->trivial.i_counter : 0;
-
-if (j >= in_n_frames)
+if (i_index >= in_n_frames)
 break;
 
 pa_assert_fp(o_index * fz < pa_memblock_get_length(output->memblock));
 
-memcpy((uint8_t*) dst + fz * o_index,
-   (uint8_t*) src + fz * j, (int) fz);
+memcpy((uint8_t*) dst + fz * o_index, (uint8_t*) src + fz * i_index, 
(int) fz);
 }
 
 pa_memblock_release(input->memblock);
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 2/4] Disable fastpath asserts by default

2011-11-23 Thread Maarten Bosmans
---
 configure.ac |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1f65dd5..6b1e91f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -157,6 +157,9 @@ AX_APPEND_COMPILE_FLAGS(
 [-Wall -W -Wextra -pipe -Wno-long-long -Wvla -Wno-overlength-strings 
-Wunsafe-loop-optimizations -Wundef -Wformat=2 -Wlogical-op -Wsign-compare 
-Wformat-security -Wmissing-include-dirs -Wformat-nonliteral 
-Wold-style-definition -Wpointer-arith -Winit-self 
-Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes 
-Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn 
-Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing -Wwrite-strings 
-Wno-unused-parameter -ffast-math -Wp,-D_FORTIFY_SOURCE=2 -fno-common 
-fdiagnostics-show-option],
 [], [-pedantic -Werror])
 
+# Only enable fastpath asserts when doing a debug build, e.g. from 
bootstrap.sh.
+AS_CASE([" $CFLAGS "], [*" -O0 "*], [], [AX_APPEND_FLAG(["-DFASTPATH"], 
[CPPFLAGS])])
+
 
  Linker flags 
 
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 1/4] Use fastpath assert in trivial resampler

2011-11-23 Thread Maarten Bosmans
When the assert is disabled, the trivial resampler gets a 35% performance boost.
---
 src/pulsecore/resampler.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
index dd9c1aa..495f33f 100644
--- a/src/pulsecore/resampler.c
+++ b/src/pulsecore/resampler.c
@@ -1391,7 +1391,7 @@ static void trivial_resample(pa_resampler *r, const 
pa_memchunk *input, unsigned
 if (j >= in_n_frames)
 break;
 
-pa_assert(o_index * fz < pa_memblock_get_length(output->memblock));
+pa_assert_fp(o_index * fz < pa_memblock_get_length(output->memblock));
 
 memcpy((uint8_t*) dst + fz * o_index,
(uint8_t*) src + fz * j, (int) fz);
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH] Hardcode FRAME_SIZE_MAX_ALLOW

2011-11-22 Thread Maarten Bosmans
Instead of using PA_SCACHE_ENTRY_SIZE_MAX, the size for FRAME_SIZE_MAX_ALLOW is
set directly to the same value.  This removes the need for the core-scache.h
include, which caused an unwanted dependency of libpulsecommon on libpulsecore.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=41539
---
 src/pulsecore/pstream.c |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/pulsecore/pstream.c b/src/pulsecore/pstream.c
index 3e59fc4..b08f6a6 100644
--- a/src/pulsecore/pstream.c
+++ b/src/pulsecore/pstream.c
@@ -37,7 +37,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -74,7 +73,11 @@ enum {
 typedef uint32_t pa_pstream_descriptor[PA_PSTREAM_DESCRIPTOR_MAX];
 
 #define PA_PSTREAM_DESCRIPTOR_SIZE (PA_PSTREAM_DESCRIPTOR_MAX*sizeof(uint32_t))
-#define FRAME_SIZE_MAX_ALLOW PA_SCACHE_ENTRY_SIZE_MAX /* allow uploading a 
single sample in one frame at max */
+
+/* To allow uploading a single sample in one frame, this value should be the
+ * same size (16 MB) as PA_SCACHE_ENTRY_SIZE_MAX from pulsecore/core-scache.h.
+ */
+#define FRAME_SIZE_MAX_ALLOW (1024*1024*16)
 
 PA_STATIC_FLIST_DECLARE(items, 0, pa_xfree);
 
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH] Update LICENSE

2011-11-22 Thread Maarten Bosmans
Mention gdbm, lirc and fftw there.
---
 LICENSE |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/LICENSE b/LICENSE
index b312c44..cd5e42f 100644
--- a/LICENSE
+++ b/LICENSE
@@ -2,16 +2,16 @@ All PulseAudio source files are licensed under the GNU Lesser 
General Public
 License. (see file LGPL for details)
 
 However, the server side has optional GPL dependencies.  These include the
-libsamplerate (for core libraries) and bluez (for the bluetooth proximity 
helper
-program) libraries, although others may also be included in the future.  If
-PulseAudio is compiled with these optional components, this effectively
-downgrades the license of the server part to GPL (see file GPL for details),
-exercising section 3 of the LGPL. In such circumstances, you should treat the
-client library (libpulse) of PulseAudio as being LGPL licensed and the server
-part (libpulsecore) as being GPL licensed. Since the PulseAudio daemon, tests,
-various utilities/helpers and the modules link to libpulsecore and/or the
-afore mentioned optional GPL dependencies they are of course also GPL licensed
-also in this scenario.
+libsamplerate and gdbm (core libraries), LIRC (lirc module), FFTW (equalizer
+module) and bluez (bluetooth proximity helper program) libraries, although
+others may also be included in the future.  If PulseAudio is compiled with 
these
+optional components, this effectively downgrades the license of the server part
+to GPL (see the file GPL for details), exercising section 3 of the LGPL.  In
+such circumstances, you should treat the client library (libpulse) of 
PulseAudio
+as being LGPL licensed and the server part (libpulsecore) as being GPL 
licensed.
+Since the PulseAudio daemon, tests, various utilities/helpers and the modules
+link to libpulsecore and/or the afore mentioned optional GPL dependencies they
+are of course also GPL licensed also in this scenario.
 
 Andre Adrian's echo cancellation implementation is licensed under a less
 restrictive license - see src/modules/echo-cancel/adrian-license.txt for
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] Remove pa_prioq priority queue implementation

2011-11-18 Thread Maarten Bosmans
How is it that we end up with these list-like datatypes in the tree
which are completely unused? The pa_prioq datatype was added three
years ago, but never used.

So unless somebody envisions a use for it in the near future, I
propose to just delete it.

Maarten

2011/11/18 Maarten Bosmans :
> ---
>  src/.gitignore         |    1 -
>  src/Makefile.am        |    9 +--
>  src/pulsecore/prioq.c  |  256 
> 
>  src/pulsecore/prioq.h  |   62 
>  src/tests/prioq-test.c |   47 -
>  5 files changed, 1 insertions(+), 374 deletions(-)
>  delete mode 100644 src/pulsecore/prioq.c
>  delete mode 100644 src/pulsecore/prioq.h
>  delete mode 100644 src/tests/prioq-test.c
>
> diff --git a/src/.gitignore b/src/.gitignore
> index 4a66969..cbde067 100644
> --- a/src/.gitignore
> +++ b/src/.gitignore
> @@ -51,7 +51,6 @@ mix-test
>  once-test
>  pacat-simple
>  parec-simple
> -prioq-test
>  proplist-test
>  queue-test
>  remix-test
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 5d63aec..a028eea 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -238,8 +238,7 @@ TESTS_default = \
>                volume-test \
>                mix-test \
>                proplist-test \
> -               lock-autospawn-test \
> -               prioq-test
> +               lock-autospawn-test
>
>  TESTS_norun = \
>                mcalign-test \
> @@ -493,11 +492,6 @@ lock_autospawn_test_LDADD = $(AM_LDADD) 
> libpulsecore-@PA_MAJORMINOR@.la libpulse
>  lock_autospawn_test_CFLAGS = $(AM_CFLAGS)
>  lock_autospawn_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
>
> -prioq_test_SOURCES = tests/prioq-test.c
> -prioq_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulse.la 
> libpulsecommon-@PA_MAJORMINOR@.la
> -prioq_test_CFLAGS = $(AM_CFLAGS)
> -prioq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
> -
>  sigbus_test_SOURCES = tests/sigbus-test.c
>  sigbus_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulse.la 
> libpulsecommon-@PA_MAJORMINOR@.la
>  sigbus_test_CFLAGS = $(AM_CFLAGS)
> @@ -584,7 +578,6 @@ libpulsecommon_@PA_MAJORMINOR@_la_SOURCES = \
>                pulsecore/pid.c pulsecore/pid.h \
>                pulsecore/pipe.c pulsecore/pipe.h \
>                pulsecore/poll.c pulsecore/poll.h \
> -               pulsecore/prioq.c pulsecore/prioq.h \
>                pulsecore/memtrap.c pulsecore/memtrap.h \
>                pulsecore/aupdate.c pulsecore/aupdate.h \
>                pulsecore/proplist-util.c pulsecore/proplist-util.h \
> diff --git a/src/pulsecore/prioq.c b/src/pulsecore/prioq.c
> deleted file mode 100644
> index 983db0f..000
> --- a/src/pulsecore/prioq.c
> +++ /dev/null
> @@ -1,256 +0,0 @@
> -/***
> -  This file is part of PulseAudio.
> -
> -  Copyright 2008 Lennart Poettering
> -
> -  PulseAudio is free software; you can redistribute it and/or modify
> -  it under the terms of the GNU Lesser General Public License as published
> -  by the Free Software Foundation; either version 2.1 of the License,
> -  or (at your option) any later version.
> -
> -  PulseAudio is distributed in the hope that it will be useful, but
> -  WITHOUT ANY WARRANTY; without even the implied warranty of
> -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> -  General Public License for more details.
> -
> -  You should have received a copy of the GNU Lesser General Public License
> -  along with PulseAudio; if not, write to the Free Software
> -  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
> -  USA.
> -***/
> -
> -#ifdef HAVE_CONFIG_H
> -#include 
> -#endif
> -
> -#include 
> -
> -#include 
> -
> -#include "prioq.h"
> -
> -struct pa_prioq_item {
> -    void *value;
> -    unsigned idx;
> -};
> -
> -struct pa_prioq {
> -    pa_prioq_item **items;
> -    unsigned n_items;
> -    unsigned n_allocated;
> -    pa_compare_func_t compare_func;
> -};
> -
> -PA_STATIC_FLIST_DECLARE(items, 0, pa_xfree);
> -
> -pa_prioq *pa_prioq_new(pa_compare_func_t compare_func) {
> -
> -    pa_prioq *q;
> -
> -    q = pa_xnew(pa_prioq, 1);
> -    q->compare_func = compare_func;
> -    q->n_items = 0;
> -    q->n_allocated = 64;
> -    q->items = pa_xnew(pa_prioq_item*, q->n_allocated);
> -
> -    return q;
> -}
> -
> -void pa_prioq_free(pa_prioq *q, pa_free2_cb_t free_cb, void *userdata) {
> -    pa_prioq_item **i, **e;
> -
> -    pa_assert(q);
> -
> -    for (i = q->items, e = q->items + q->n_items; i < e; i++) {
> -
> -        if (!*i)
> -            continue;
> -
> -        if (fr

[pulseaudio-discuss] [PATCH] Remove pa_prioq priority queue implementation

2011-11-18 Thread Maarten Bosmans
---
 src/.gitignore |1 -
 src/Makefile.am|9 +--
 src/pulsecore/prioq.c  |  256 
 src/pulsecore/prioq.h  |   62 
 src/tests/prioq-test.c |   47 -
 5 files changed, 1 insertions(+), 374 deletions(-)
 delete mode 100644 src/pulsecore/prioq.c
 delete mode 100644 src/pulsecore/prioq.h
 delete mode 100644 src/tests/prioq-test.c

diff --git a/src/.gitignore b/src/.gitignore
index 4a66969..cbde067 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -51,7 +51,6 @@ mix-test
 once-test
 pacat-simple
 parec-simple
-prioq-test
 proplist-test
 queue-test
 remix-test
diff --git a/src/Makefile.am b/src/Makefile.am
index 5d63aec..a028eea 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -238,8 +238,7 @@ TESTS_default = \
volume-test \
mix-test \
proplist-test \
-   lock-autospawn-test \
-   prioq-test
+   lock-autospawn-test
 
 TESTS_norun = \
mcalign-test \
@@ -493,11 +492,6 @@ lock_autospawn_test_LDADD = $(AM_LDADD) 
libpulsecore-@PA_MAJORMINOR@.la libpulse
 lock_autospawn_test_CFLAGS = $(AM_CFLAGS)
 lock_autospawn_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
-prioq_test_SOURCES = tests/prioq-test.c
-prioq_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulse.la 
libpulsecommon-@PA_MAJORMINOR@.la
-prioq_test_CFLAGS = $(AM_CFLAGS)
-prioq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
-
 sigbus_test_SOURCES = tests/sigbus-test.c
 sigbus_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulse.la 
libpulsecommon-@PA_MAJORMINOR@.la
 sigbus_test_CFLAGS = $(AM_CFLAGS)
@@ -584,7 +578,6 @@ libpulsecommon_@PA_MAJORMINOR@_la_SOURCES = \
pulsecore/pid.c pulsecore/pid.h \
pulsecore/pipe.c pulsecore/pipe.h \
pulsecore/poll.c pulsecore/poll.h \
-   pulsecore/prioq.c pulsecore/prioq.h \
pulsecore/memtrap.c pulsecore/memtrap.h \
pulsecore/aupdate.c pulsecore/aupdate.h \
pulsecore/proplist-util.c pulsecore/proplist-util.h \
diff --git a/src/pulsecore/prioq.c b/src/pulsecore/prioq.c
deleted file mode 100644
index 983db0f..000
--- a/src/pulsecore/prioq.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/***
-  This file is part of PulseAudio.
-
-  Copyright 2008 Lennart Poettering
-
-  PulseAudio is free software; you can redistribute it and/or modify
-  it under the terms of the GNU Lesser General Public License as published
-  by the Free Software Foundation; either version 2.1 of the License,
-  or (at your option) any later version.
-
-  PulseAudio is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with PulseAudio; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-  USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include 
-#endif
-
-#include 
-
-#include 
-
-#include "prioq.h"
-
-struct pa_prioq_item {
-void *value;
-unsigned idx;
-};
-
-struct pa_prioq {
-pa_prioq_item **items;
-unsigned n_items;
-unsigned n_allocated;
-pa_compare_func_t compare_func;
-};
-
-PA_STATIC_FLIST_DECLARE(items, 0, pa_xfree);
-
-pa_prioq *pa_prioq_new(pa_compare_func_t compare_func) {
-
-pa_prioq *q;
-
-q = pa_xnew(pa_prioq, 1);
-q->compare_func = compare_func;
-q->n_items = 0;
-q->n_allocated = 64;
-q->items = pa_xnew(pa_prioq_item*, q->n_allocated);
-
-return q;
-}
-
-void pa_prioq_free(pa_prioq *q, pa_free2_cb_t free_cb, void *userdata) {
-pa_prioq_item **i, **e;
-
-pa_assert(q);
-
-for (i = q->items, e = q->items + q->n_items; i < e; i++) {
-
-if (!*i)
-continue;
-
-if (free_cb)
-free_cb((*i)->value, userdata);
-
-pa_xfree(*i);
-}
-
-pa_xfree(q->items);
-pa_xfree(q);
-}
-
-static void shuffle_up(pa_prioq *q, pa_prioq_item *i) {
-unsigned j;
-
-pa_assert(q);
-pa_assert(i);
-
-j = i->idx;
-
-while (j > 0) {
-unsigned k;
-
-k = (j-1)/2;
-
-if (q->compare_func(q->items[k]->value, i->value) < 0)
-break;
-
-q->items[k]->idx = j;
-q->items[j] = q->items[k];
-
-j = k;
-}
-
-i->idx = j;
-q->items[j] = i;
-
-}
-
-pa_prioq_item* pa_prioq_put(pa_prioq *q, void *p) {
-pa_prioq_item *i;
-
-pa_assert(q);
-
-if (q->n_items >= q->n_allocated) {
-q->n_allocated = PA_MAX(q->n_items+1, q->n_allocated)*2;
-q->items = pa_xrealloc(q->items, sizeof(pa_prioq_item*) * 
q->n_allocated);
-}
-
-if (!(i = pa_flist_pop(PA_STATIC_FLIST_GET(items
-i = pa_xnew(pa_prioq_item, 1);
-
-i->value = p;
-i->idx = q->n_it

[pulseaudio-discuss] [PATCH 2/2] Use simple free function in pa_queue_free

2011-11-18 Thread Maarten Bosmans
---
 src/pulsecore/pstream.c |8 
 src/pulsecore/queue.c   |4 ++--
 src/pulsecore/queue.h   |4 ++--
 src/pulsecore/sink.c|4 ++--
 src/pulsecore/source.c  |4 ++--
 src/tests/queue-test.c  |2 +-
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/pulsecore/pstream.c b/src/pulsecore/pstream.c
index 3e59fc4..b06c77a 100644
--- a/src/pulsecore/pstream.c
+++ b/src/pulsecore/pstream.c
@@ -276,7 +276,7 @@ pa_pstream *pa_pstream_new(pa_mainloop_api *m, pa_iochannel 
*io, pa_mempool *poo
 return p;
 }
 
-static void item_free(void *item, void *q) {
+static void item_free(void *item) {
 struct item_info *i = item;
 pa_assert(i);
 
@@ -297,10 +297,10 @@ static void pstream_free(pa_pstream *p) {
 
 pa_pstream_unlink(p);
 
-pa_queue_free(p->send_queue, item_free, NULL);
+pa_queue_free(p->send_queue, item_free);
 
 if (p->write.current)
-item_free(p->write.current, NULL);
+item_free(p->write.current);
 
 if (p->write.memchunk.memblock)
 pa_memblock_unref(p->write.memchunk.memblock);
@@ -604,7 +604,7 @@ static int do_write(pa_pstream *p) {
 
 if (p->write.index >= PA_PSTREAM_DESCRIPTOR_SIZE + 
ntohl(p->write.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH])) {
 pa_assert(p->write.current);
-item_free(p->write.current, NULL);
+item_free(p->write.current);
 p->write.current = NULL;
 
 if (p->write.memchunk.memblock)
diff --git a/src/pulsecore/queue.c b/src/pulsecore/queue.c
index 2c73a3d..f4216ee 100644
--- a/src/pulsecore/queue.c
+++ b/src/pulsecore/queue.c
@@ -52,13 +52,13 @@ pa_queue* pa_queue_new(void) {
 return q;
 }
 
-void pa_queue_free(pa_queue* q, pa_free2_cb_t free_func, void *userdata) {
+void pa_queue_free(pa_queue *q, pa_free_cb_t free_func) {
 void *data;
 pa_assert(q);
 
 while ((data = pa_queue_pop(q)))
 if (free_func)
-free_func(data, userdata);
+free_func(data);
 
 pa_assert(!q->front);
 pa_assert(!q->back);
diff --git a/src/pulsecore/queue.h b/src/pulsecore/queue.h
index f3cec9b..1b95ec8 100644
--- a/src/pulsecore/queue.h
+++ b/src/pulsecore/queue.h
@@ -22,7 +22,7 @@
   USA.
 ***/
 
-#include 
+#include 
 
 typedef struct pa_queue pa_queue;
 
@@ -33,7 +33,7 @@ pa_queue* pa_queue_new(void);
 
 /* Free the queue and run the specified callback function for every
  * remaining entry. The callback function may be NULL. */
-void pa_queue_free(pa_queue* q, pa_free2_cb_t free_func, void *userdata);
+void pa_queue_free(pa_queue *q, pa_free_cb_t free_func);
 
 void pa_queue_push(pa_queue *q, void *p);
 void* pa_queue_pop(pa_queue *q);
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index aa7661a..0e54561 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -895,7 +895,7 @@ void pa_sink_move_all_finish(pa_sink *s, pa_queue *q, 
pa_bool_t save) {
 pa_sink_input_unref(i);
 }
 
-pa_queue_free(q, NULL, NULL);
+pa_queue_free(q, NULL);
 }
 
 /* Called from main context */
@@ -910,7 +910,7 @@ void pa_sink_move_all_fail(pa_queue *q) {
 pa_sink_input_unref(i);
 }
 
-pa_queue_free(q, NULL, NULL);
+pa_queue_free(q, NULL);
 }
 
 /* Called from IO thread context */
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 0ecaa4c..1e827bc 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -812,7 +812,7 @@ void pa_source_move_all_finish(pa_source *s, pa_queue *q, 
pa_bool_t save) {
 pa_source_output_unref(o);
 }
 
-pa_queue_free(q, NULL, NULL);
+pa_queue_free(q, NULL);
 }
 
 /* Called from main context */
@@ -827,7 +827,7 @@ void pa_source_move_all_fail(pa_queue *q) {
 pa_source_output_unref(o);
 }
 
-pa_queue_free(q, NULL, NULL);
+pa_queue_free(q, NULL);
 }
 
 /* Called from IO thread context */
diff --git a/src/tests/queue-test.c b/src/tests/queue-test.c
index b21775e..6b3e895 100644
--- a/src/tests/queue-test.c
+++ b/src/tests/queue-test.c
@@ -58,7 +58,7 @@ int main(int argc, char *argv[]) {
 pa_queue_push(q, (void*) "sechs");
 pa_queue_push(q, (void*) "sieben");
 
-pa_queue_free(q, NULL, NULL);
+pa_queue_free(q, NULL);
 
 return 0;
 }
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 1/2] Use simple free function in pa_dynarray_free

2011-11-18 Thread Maarten Bosmans
---
 src/pulsecore/cli-command.c |2 +-
 src/pulsecore/dynarray.c|4 ++--
 src/pulsecore/dynarray.h|4 ++--
 src/pulsecore/tokenizer.c   |6 +-
 4 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
index c38637d..a43b7ca 100644
--- a/src/pulsecore/cli-command.c
+++ b/src/pulsecore/cli-command.c
@@ -1800,7 +1800,7 @@ int pa_cli_command_execute_line_stateful(pa_core *c, 
const char *s, pa_strbuf *b
 sorted_files = pa_xnew(char*, count);
 for (i = 0; i < count; ++i)
 sorted_files[i] = pa_dynarray_get(files, i);
-pa_dynarray_free(files, NULL, NULL);
+pa_dynarray_free(files, NULL);
 
 for (i = 0; i < count; ++i) {
 for (unsigned j = 0; j < count; ++j) {
diff --git a/src/pulsecore/dynarray.c b/src/pulsecore/dynarray.c
index 69d835a..78b2eb9 100644
--- a/src/pulsecore/dynarray.c
+++ b/src/pulsecore/dynarray.c
@@ -50,14 +50,14 @@ pa_dynarray* pa_dynarray_new(void) {
 return a;
 }
 
-void pa_dynarray_free(pa_dynarray* a, pa_free2_cb_t free_func, void *userdata) 
{
+void pa_dynarray_free(pa_dynarray *a, pa_free_cb_t free_func) {
 unsigned i;
 pa_assert(a);
 
 if (free_func)
 for (i = 0; i < a->n_entries; i++)
 if (a->data[i])
-free_func(a->data[i], userdata);
+free_func(a->data[i]);
 
 pa_xfree(a->data);
 pa_xfree(a);
diff --git a/src/pulsecore/dynarray.h b/src/pulsecore/dynarray.h
index 9a8e64e..70deebb 100644
--- a/src/pulsecore/dynarray.h
+++ b/src/pulsecore/dynarray.h
@@ -22,7 +22,7 @@
   USA.
 ***/
 
-#include 
+#include 
 
 typedef struct pa_dynarray pa_dynarray;
 
@@ -34,7 +34,7 @@ pa_dynarray* pa_dynarray_new(void);
 
 /* Free the array calling the specified function for every entry in
  * the array. The function may be NULL. */
-void pa_dynarray_free(pa_dynarray* a, pa_free2_cb_t free_func, void *userdata);
+void pa_dynarray_free(pa_dynarray *a, pa_free_cb_t free_func);
 
 /* Store p at position i in the array */
 void pa_dynarray_put(pa_dynarray*a, unsigned i, void *p);
diff --git a/src/pulsecore/tokenizer.c b/src/pulsecore/tokenizer.c
index a0ade69..cb682d6 100644
--- a/src/pulsecore/tokenizer.c
+++ b/src/pulsecore/tokenizer.c
@@ -33,10 +33,6 @@
 
 #include "tokenizer.h"
 
-static void token_free(void *p, void *userdata) {
-pa_xfree(p);
-}
-
 static void parse(pa_dynarray*a, const char *s, unsigned args) {
 int infty = 0;
 const char delimiter[] = " \t\n\r";
@@ -76,7 +72,7 @@ void pa_tokenizer_free(pa_tokenizer *t) {
 pa_dynarray *a = (pa_dynarray*) t;
 
 pa_assert(a);
-pa_dynarray_free(a, token_free, NULL);
+pa_dynarray_free(a, pa_xfree);
 }
 
 const char *pa_tokenizer_get(pa_tokenizer *t, unsigned i) {
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] Simplify list free functions

2011-11-18 Thread Maarten Bosmans
These two patches convert pa_queue and pa_dynarray to use simple free functions,
with only a function pointer argument that frees the list elements, dropping the
userdata argument.  pa_asyncq and pa_flist already use this style of free 
function,
patches for pa_hashmap and pa_idxset will follow later.

[PATCH 1/2] Use simple free function in pa_dynarray_free
[PATCH 2/2] Use simple free function in pa_queue_free

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH]: High-definition audio pass-through support

2011-11-17 Thread Maarten Bosmans
2011/11/17 Kelly Anderson :
> Hi,
>
> So I patched PulseAudio 1.1 for hdmi-surround-71 and lo and behold it
> worked.
> Here's a patch, hopefully we can get this added in the next official release
> of PulseAudio.  I know that there are quite a few Xbmc users that have been
> anxiously
> waiting for high-definition audio pass-through to work correctly.  Of course
> if someone
> has a better solution, that would be fine too.

Note that there's nothing inherently high-definition about the audio
data through a hdmi connector.

How about also adding 4.0 and 5.1? That seems more complete.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH] Add pure and const attributes to functions that need them

2011-11-17 Thread Maarten Bosmans
---
 src/modules/alsa/alsa-mixer.c   |4 ++--
 src/modules/module-device-manager.c |2 +-
 src/modules/rtp/rtp.h   |5 +++--
 src/pulse/channelmap.h  |2 +-
 src/pulse/context.h |2 +-
 src/pulse/format.h  |6 +++---
 src/pulse/sample.h  |2 +-
 src/pulse/timeval.h |2 +-
 src/pulse/util.h|3 ++-
 src/pulsecore/bitset.h  |2 +-
 src/pulsecore/core-rtclock.h|6 --
 src/pulsecore/core-util.c   |1 -
 src/pulsecore/core-util.h   |2 +-
 src/pulsecore/dbus-util.c   |2 +-
 src/pulsecore/idxset.h  |   10 ++
 src/pulsecore/memchunk.c|2 +-
 src/pulsecore/memchunk.h|2 +-
 src/pulsecore/module.h  |   25 +
 src/pulsecore/namereg.h |4 ++--
 src/pulsecore/resampler.h   |4 ++--
 20 files changed, 47 insertions(+), 41 deletions(-)

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 151eef5..3f27fdc 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -2907,7 +2907,7 @@ void pa_alsa_path_set_dump(pa_alsa_path_set *ps) {
 }
 
 
-static pa_bool_t options_have_option(pa_alsa_option *options, const char 
*alsa_name) {
+static PA_GCC_PURE pa_bool_t options_have_option(pa_alsa_option *options, 
const char *alsa_name) {
 pa_alsa_option *o;
 
 pa_assert(options);
@@ -2920,7 +2920,7 @@ static pa_bool_t options_have_option(pa_alsa_option 
*options, const char *alsa_n
 return FALSE;
 }
 
-static pa_bool_t enumeration_is_subset(pa_alsa_option *a_options, 
pa_alsa_option *b_options) {
+static PA_GCC_PURE pa_bool_t enumeration_is_subset(pa_alsa_option *a_options, 
pa_alsa_option *b_options) {
 pa_alsa_option *oa, *ob;
 
 if (!a_options) return TRUE;
diff --git a/src/modules/module-device-manager.c 
b/src/modules/module-device-manager.c
index d7f30c6..e1f6ae9 100644
--- a/src/modules/module-device-manager.c
+++ b/src/modules/module-device-manager.c
@@ -533,7 +533,7 @@ static inline struct entry *load_or_initialize_entry(struct 
userdata *u, struct
 return old;
 }
 
-static uint32_t get_role_index(const char* role) {
+static PA_GCC_PURE uint32_t get_role_index(const char* role) {
 pa_assert(role);
 
 for (uint32_t i = ROLE_NONE; i < NUM_ROLES; ++i)
diff --git a/src/modules/rtp/rtp.h b/src/modules/rtp/rtp.h
index e975e75..a51345d 100644
--- a/src/modules/rtp/rtp.h
+++ b/src/modules/rtp/rtp.h
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+
 #include 
 #include 
 
@@ -56,7 +57,7 @@ int pa_rtp_sample_spec_valid(const pa_sample_spec *ss);
 uint8_t pa_rtp_payload_from_sample_spec(const pa_sample_spec *ss);
 pa_sample_spec *pa_rtp_sample_spec_from_payload(uint8_t payload, 
pa_sample_spec *ss);
 
-const char* pa_rtp_format_to_string(pa_sample_format_t f);
-pa_sample_format_t pa_rtp_string_to_format(const char *s);
+const char* pa_rtp_format_to_string(pa_sample_format_t f) PA_GCC_CONST;
+pa_sample_format_t pa_rtp_string_to_format(const char *s) PA_GCC_PURE;
 
 #endif
diff --git a/src/pulse/channelmap.h b/src/pulse/channelmap.h
index 8d62226..0c5ddff 100644
--- a/src/pulse/channelmap.h
+++ b/src/pulse/channelmap.h
@@ -293,7 +293,7 @@ pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, 
unsigned channels, p
 pa_channel_map* pa_channel_map_init_extend(pa_channel_map *m, unsigned 
channels, pa_channel_map_def_t def);
 
 /** Return a text label for the specified channel position */
-const char* pa_channel_position_to_string(pa_channel_position_t pos) 
PA_GCC_PURE;
+const char* pa_channel_position_to_string(pa_channel_position_t pos) 
PA_GCC_CONST;
 
 /** The inverse of pa_channel_position_to_string(). \since 0.9.16 */
 pa_channel_position_t pa_channel_position_from_string(const char *s) 
PA_GCC_PURE;
diff --git a/src/pulse/context.h b/src/pulse/context.h
index b2d4133..ce8423d 100644
--- a/src/pulse/context.h
+++ b/src/pulse/context.h
@@ -237,7 +237,7 @@ pa_operation* pa_context_set_name(pa_context *c, const char 
*name, pa_context_su
 const char* pa_context_get_server(pa_context *c);
 
 /** Return the protocol version of the library. */
-uint32_t pa_context_get_protocol_version(pa_context *c);
+uint32_t pa_context_get_protocol_version(pa_context *c) PA_GCC_CONST;
 
 /** Return the protocol version of the connected server. */
 uint32_t pa_context_get_server_protocol_version(pa_context *c);
diff --git a/src/pulse/format.h b/src/pulse/format.h
index 67996c5..7ff1650 100644
--- a/src/pulse/format.h
+++ b/src/pulse/format.h
@@ -63,7 +63,7 @@ typedef enum pa_encoding {
 const char *pa_encoding_to_string(pa_encoding_t e) PA_GCC_CONST;
 
 /** Converts a string of the form returned by \a pa_encoding_to_string() back 
to a \a pa_encoding_t. \since 1.0 */
-pa_encoding_t pa_encoding_from_string(const char *encoding);
+pa_encoding_t pa_encoding_fro

[pulseaudio-discuss] [PATCH] tests: Don't link tests that only use public api to libpulsecommon

2011-11-16 Thread Maarten Bosmans
---
 src/Makefile.am |   18 +-
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 456a61f..417e675 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -314,7 +314,7 @@ thread_mainloop_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 utf8_test_SOURCES = tests/utf8-test.c
 utf8_test_CFLAGS = $(AM_CFLAGS)
-utf8_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulse.la 
libpulsecommon-@PA_MAJORMINOR@.la
+utf8_test_LDADD = $(AM_LDADD) libpulse.la
 utf8_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 format_test_SOURCES = tests/format-test.c
@@ -383,17 +383,17 @@ mcalign_test_LDADD = $(AM_LDADD) $(WINSOCK_LIBS) 
libpulsecore-@PA_MAJORMINOR@.la
 mcalign_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 pacat_simple_SOURCES = tests/pacat-simple.c
-pacat_simple_LDADD = $(AM_LDADD) libpulse.la libpulse-simple.la 
libpulsecommon-@PA_MAJORMINOR@.la
+pacat_simple_LDADD = $(AM_LDADD) libpulse.la libpulse-simple.la
 pacat_simple_CFLAGS = $(AM_CFLAGS)
 pacat_simple_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 parec_simple_SOURCES = tests/parec-simple.c
-parec_simple_LDADD = $(AM_LDADD) libpulse.la libpulse-simple.la 
libpulsecommon-@PA_MAJORMINOR@.la
+parec_simple_LDADD = $(AM_LDADD) libpulse.la libpulse-simple.la
 parec_simple_CFLAGS = $(AM_CFLAGS)
 parec_simple_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 extended_test_SOURCES = tests/extended-test.c
-extended_test_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINOR@.la
+extended_test_LDADD = $(AM_LDADD) libpulse.la
 extended_test_CFLAGS = $(AM_CFLAGS)
 extended_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
@@ -414,7 +414,7 @@ volume_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 channelmap_test_SOURCES = tests/channelmap-test.c
 channelmap_test_CFLAGS = $(AM_CFLAGS)
-channelmap_test_LDADD = $(AM_LDADD) libpulse.la 
libpulsecommon-@PA_MAJORMINOR@.la
+channelmap_test_LDADD = $(AM_LDADD) libpulse.la
 channelmap_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 cpulimit_test_SOURCES = tests/cpulimit-test.c daemon/cpulimit.c 
daemon/cpulimit.h
@@ -438,12 +438,12 @@ memblockq_test_LDADD = $(AM_LDADD) $(WINSOCK_LIBS) 
libpulsecore-@PA_MAJORMINOR@.
 memblockq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 sync_playback_SOURCES = tests/sync-playback.c
-sync_playback_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINOR@.la
+sync_playback_LDADD = $(AM_LDADD) libpulse.la
 sync_playback_CFLAGS = $(AM_CFLAGS)
 sync_playback_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 interpol_test_SOURCES = tests/interpol-test.c
-interpol_test_LDADD = $(AM_LDADD) libpulse.la libpulsecore-@PA_MAJORMINOR@.la 
libpulse.la libpulsecommon-@PA_MAJORMINOR@.la
+interpol_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulse.la 
libpulsecommon-@PA_MAJORMINOR@.la
 interpol_test_CFLAGS = $(AM_CFLAGS)
 interpol_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
@@ -503,7 +503,7 @@ sigbus_test_CFLAGS = $(AM_CFLAGS)
 sigbus_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 gtk_test_SOURCES = tests/gtk-test.c
-gtk_test_LDADD = $(AM_LDADD) $(GTK20_LIBS) libpulse.la 
libpulse-mainloop-glib.la libpulse.la libpulsecommon-@PA_MAJORMINOR@.la
+gtk_test_LDADD = $(AM_LDADD) $(GTK20_LIBS) libpulse-mainloop-glib.la 
libpulse.la
 gtk_test_CFLAGS = $(AM_CFLAGS) $(GTK20_CFLAGS)
 gtk_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
@@ -518,7 +518,7 @@ usergroup_test_CFLAGS = $(AM_CFLAGS)
 usergroup_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 connect_stress_SOURCES = tests/connect-stress.c
-connect_stress_LDADD = $(AM_LDADD) libpulse.la 
libpulsecommon-@PA_MAJORMINOR@.la
+connect_stress_LDADD = $(AM_LDADD) libpulse.la
 connect_stress_CFLAGS = $(AM_CFLAGS)
 connect_stress_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] libpulsecore dependency on libpulsecommon

2011-11-16 Thread Maarten Bosmans
I'm looking for some guidance on how to solve
https://bugs.freedesktop.org/show_bug.cgi?id=41539.
The problem is that pulsecore/pstream.c (in libpulsecommon) includes
pulsecore/core-scache.h (which is itself in and includes from
libpulsecore), this is wrong. Apparantly it causes real trouble on
Solaris.

The header core-scache.h is only included to make the
PA_SCACHE_ENTRY_SIZE_MAX preprocessor symbol available.
There are several solutions possible.
 - Move the #define to a file in libpulsecommon. This is the solution
proposed in the patch attached to the bug. However, I don't like the
proposed new location in memchunk.h, because it is quite unrelated to
scache functionality.
 - Move the #define to pulse/scache.h. In this case we need to guard
against the symbol being externally visible.
 - Simply hardcode the value of 1024*1024*16 in pstream.c, perhaps
with a comment that says it should stay in sink with
PA_SCACHE_ENTRY_SIZE_MAX.

Which solution is preferred?

There are also other source-level dependenies from
libpulse/libpulsecommon on files from libpulsecore.
pulse/volume.c -> pulsecore/sample-util.h
pulse/channelmap.c -> pulsecore/sample-util.h
pulsecore/core-util.c -> pulsecore/cpu-x86.h

Is this also something we want to address? (I can make patches)

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 1/8] build-sys: Use configure cache by default in bootstrap

2011-11-15 Thread Maarten Bosmans
Is there anything (except spelling issues) against this patch?

Maarten

2011/11/2 Maarten Bosmans :
> This speeds up subsequent configure invokations
> ---
>  .gitignore   |    1 +
>  autogen.sh   |    2 +-
>  bootstrap.sh |    2 +-
>  3 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/.gitignore b/.gitignore
> index 9290ad2..765642f 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -15,6 +15,7 @@ Makefile.in
>  aclocal.m4
>  autom4te.cache
>  compile
> +config.cache
>  config.guess
>  config.h
>  config.h.in
> diff --git a/autogen.sh b/autogen.sh
> index 4051a22..5a07251 100755
> --- a/autogen.sh
> +++ b/autogen.sh
> @@ -20,4 +20,4 @@
>
>  NOCONFIGURE=1 ./bootstrap.sh
>
> -exec ./configure  "$@"
> +exec ./configure -C "$@"
> diff --git a/bootstrap.sh b/bootstrap.sh
> index d0baf95..3e2bfab 100755
> --- a/bootstrap.sh
> +++ b/bootstrap.sh
> @@ -98,7 +98,7 @@ else
>     run_versioned automake "$VERSION" --copy --foreign --add-missing
>
>     if test "x$NOCONFIGURE" = "x"; then
> -        CFLAGS="$CFLAGS -g -O0" ./configure --sysconfdir=/etc 
> --localstatedir=/var --enable-force-preopen "$@"
> +        CFLAGS="$CFLAGS -g -O0" ./configure -C --sysconfdir=/etc 
> --localstatedir=/var --enable-force-preopen "$@"
>         make clean
>     fi
>  fi
> --
> 1.7.4.1
>
>
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] Remove pulsecore/shmasyncq.[ch]

2011-11-15 Thread Maarten Bosmans
This patch was acked by Lennart on IRC.

2011/11/16 Maarten Bosmans :
> They are unused.
> ---
>  src/pulsecore/shmasyncq.c |  220 
> -
>  src/pulsecore/shmasyncq.h |   59 
>  2 files changed, 0 insertions(+), 279 deletions(-)
>  delete mode 100644 src/pulsecore/shmasyncq.c
>  delete mode 100644 src/pulsecore/shmasyncq.h
>
> diff --git a/src/pulsecore/shmasyncq.c b/src/pulsecore/shmasyncq.c
> deleted file mode 100644
> index eac56ad..000
> --- a/src/pulsecore/shmasyncq.c
> +++ /dev/null
> @@ -1,220 +0,0 @@
> -/***
> -  This file is part of PulseAudio.
> -
> -  Copyright 2006 Lennart Poettering
> -
> -  PulseAudio is free software; you can redistribute it and/or modify
> -  it under the terms of the GNU Lesser General Public License as
> -  published by the Free Software Foundation; either version 2.1 of the
> -  License, or (at your option) any later version.
> -
> -  PulseAudio is distributed in the hope that it will be useful, but
> -  WITHOUT ANY WARRANTY; without even the implied warranty of
> -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> -  Lesser General Public License for more details.
> -
> -  You should have received a copy of the GNU Lesser General Public
> -  License along with PulseAudio; if not, write to the Free Software
> -  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
> -  USA.
> -***/
> -
> -#ifdef HAVE_CONFIG_H
> -#include 
> -#endif
> -
> -#include 
> -#include 
> -
> -#include 
> -#include 
> -#include 
> -#include 
> -#include 
> -#include 
> -
> -#include "fdsem.h"
> -
> -/* For debugging purposes we can define _Y to put and extra thread
> - * yield between each operation. */
> -
> -/* #define PROFILE */
> -
> -#ifdef PROFILE
> -#define _Y pa_thread_yield()
> -#else
> -#define _Y do { } while(0)
> -#endif
> -
> -
> -struct pa_shmasyncq {
> -    pa_fdsem *read_fdsem, *write_fdsem;
> -    pa_shmasyncq_data *data;
> -};
> -
> -static int is_power_of_two(unsigned size) {
> -    return !(size & (size - 1));
> -}
> -
> -static int reduce(pa_shmasyncq *l, int value) {
> -    return value & (unsigned) (l->n_elements - 1);
> -}
> -
> -static pa_atomic_t* get_cell(pa_shmasyncq *l, unsigned i) {
> -    pa_assert(i < l->data->n_elements);
> -
> -    return (pa_atomic_t*) ((uint8*t) l->data + 
> PA_ALIGN(sizeof(pa_shmasyncq_data)) + i * (PA_ALIGN(sizeof(pa_atomic_t)) + 
> PA_ALIGN(element_size)))
> -}
> -
> -static void *get_cell_data(pa_atomic_t *a) {
> -    return (uint8_t*) a + PA_ALIGN(sizeof(atomic_t));
> -}
> -
> -pa_shmasyncq *pa_shmasyncq_new(unsigned n_elements, size_t element_size, 
> void *data, int fd[2]) {
> -    pa_shmasyncq *l;
> -
> -    pa_assert(n_elements > 0);
> -    pa_assert(is_power_of_two(n_elements));
> -    pa_assert(element_size > 0);
> -    pa_assert(data);
> -    pa_assert(fd);
> -
> -    l = pa_xnew(pa_shmasyncq, 1);
> -
> -    l->data = data;
> -    memset(data, 0, PA_SHMASYNCQ_SIZE(n_elements, element_size));
> -
> -    l->data->n_elements = n_elements;
> -    l->data->element_size = element_size;
> -
> -    if (!(l->read_fdsem = pa_fdsem_new_shm(&d->read_fdsem_data, &fd[0]))) {
> -        pa_xfree(l);
> -        return NULL;
> -    }
> -
> -    if (!(l->write_fdsem = pa_fdsem_new(&d->write_fdsem_data, &fd[1]))) {
> -        pa_fdsem_free(l->read_fdsem);
> -        pa_xfree(l);
> -        return NULL;
> -    }
> -
> -    return l;
> -}
> -
> -void pa_shmasyncq_free(pa_shmasyncq *l, pa_free_cb_t free_cb) {
> -    pa_assert(l);
> -
> -    if (free_cb) {
> -        void *p;
> -
> -        while ((p = pa_shmasyncq_pop(l, 0)))
> -            free_cb(p);
> -    }
> -
> -    pa_fdsem_free(l->read_fdsem);
> -    pa_fdsem_free(l->write_fdsem);
> -    pa_xfree(l);
> -}
> -
> -int pa_shmasyncq_push(pa_shmasyncq*l, void *p, int wait) {
> -    int idx;
> -    pa_atomic_ptr_t *cells;
> -
> -    pa_assert(l);
> -    pa_assert(p);
> -
> -    cells = PA_SHMASYNCQ_CELLS(l);
> -
> -    _Y;
> -    idx = reduce(l, l->write_idx);
> -
> -    if (!pa_atomic_ptr_cmpxchg(&cells[idx], NULL, p)) {
> -
> -        if (!wait)
> -            return -1;
> -
> -/*         pa_log("sleeping on push"); */
> -
> -        do {
> -            pa_fdsem_wait(l->read_fdsem);
> -        } while (!pa_atomic_ptr_cmpxchg(&cells[idx], NULL, p));
> -    }
> -
> -    _Y;
> -    l->wri

[pulseaudio-discuss] [PATCH] Remove pulsecore/shmasyncq.[ch]

2011-11-15 Thread Maarten Bosmans
They are unused.
---
 src/pulsecore/shmasyncq.c |  220 -
 src/pulsecore/shmasyncq.h |   59 
 2 files changed, 0 insertions(+), 279 deletions(-)
 delete mode 100644 src/pulsecore/shmasyncq.c
 delete mode 100644 src/pulsecore/shmasyncq.h

diff --git a/src/pulsecore/shmasyncq.c b/src/pulsecore/shmasyncq.c
deleted file mode 100644
index eac56ad..000
--- a/src/pulsecore/shmasyncq.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/***
-  This file is part of PulseAudio.
-
-  Copyright 2006 Lennart Poettering
-
-  PulseAudio is free software; you can redistribute it and/or modify
-  it under the terms of the GNU Lesser General Public License as
-  published by the Free Software Foundation; either version 2.1 of the
-  License, or (at your option) any later version.
-
-  PulseAudio is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public
-  License along with PulseAudio; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-  USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include 
-#endif
-
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "fdsem.h"
-
-/* For debugging purposes we can define _Y to put and extra thread
- * yield between each operation. */
-
-/* #define PROFILE */
-
-#ifdef PROFILE
-#define _Y pa_thread_yield()
-#else
-#define _Y do { } while(0)
-#endif
-
-
-struct pa_shmasyncq {
-pa_fdsem *read_fdsem, *write_fdsem;
-pa_shmasyncq_data *data;
-};
-
-static int is_power_of_two(unsigned size) {
-return !(size & (size - 1));
-}
-
-static int reduce(pa_shmasyncq *l, int value) {
-return value & (unsigned) (l->n_elements - 1);
-}
-
-static pa_atomic_t* get_cell(pa_shmasyncq *l, unsigned i) {
-pa_assert(i < l->data->n_elements);
-
-return (pa_atomic_t*) ((uint8*t) l->data + 
PA_ALIGN(sizeof(pa_shmasyncq_data)) + i * (PA_ALIGN(sizeof(pa_atomic_t)) + 
PA_ALIGN(element_size)))
-}
-
-static void *get_cell_data(pa_atomic_t *a) {
-return (uint8_t*) a + PA_ALIGN(sizeof(atomic_t));
-}
-
-pa_shmasyncq *pa_shmasyncq_new(unsigned n_elements, size_t element_size, void 
*data, int fd[2]) {
-pa_shmasyncq *l;
-
-pa_assert(n_elements > 0);
-pa_assert(is_power_of_two(n_elements));
-pa_assert(element_size > 0);
-pa_assert(data);
-pa_assert(fd);
-
-l = pa_xnew(pa_shmasyncq, 1);
-
-l->data = data;
-memset(data, 0, PA_SHMASYNCQ_SIZE(n_elements, element_size));
-
-l->data->n_elements = n_elements;
-l->data->element_size = element_size;
-
-if (!(l->read_fdsem = pa_fdsem_new_shm(&d->read_fdsem_data, &fd[0]))) {
-pa_xfree(l);
-return NULL;
-}
-
-if (!(l->write_fdsem = pa_fdsem_new(&d->write_fdsem_data, &fd[1]))) {
-pa_fdsem_free(l->read_fdsem);
-pa_xfree(l);
-return NULL;
-}
-
-return l;
-}
-
-void pa_shmasyncq_free(pa_shmasyncq *l, pa_free_cb_t free_cb) {
-pa_assert(l);
-
-if (free_cb) {
-void *p;
-
-while ((p = pa_shmasyncq_pop(l, 0)))
-free_cb(p);
-}
-
-pa_fdsem_free(l->read_fdsem);
-pa_fdsem_free(l->write_fdsem);
-pa_xfree(l);
-}
-
-int pa_shmasyncq_push(pa_shmasyncq*l, void *p, int wait) {
-int idx;
-pa_atomic_ptr_t *cells;
-
-pa_assert(l);
-pa_assert(p);
-
-cells = PA_SHMASYNCQ_CELLS(l);
-
-_Y;
-idx = reduce(l, l->write_idx);
-
-if (!pa_atomic_ptr_cmpxchg(&cells[idx], NULL, p)) {
-
-if (!wait)
-return -1;
-
-/* pa_log("sleeping on push"); */
-
-do {
-pa_fdsem_wait(l->read_fdsem);
-} while (!pa_atomic_ptr_cmpxchg(&cells[idx], NULL, p));
-}
-
-_Y;
-l->write_idx++;
-
-pa_fdsem_post(l->write_fdsem);
-
-return 0;
-}
-
-void* pa_shmasyncq_pop(pa_shmasyncq*l, int wait) {
-int idx;
-void *ret;
-pa_atomic_ptr_t *cells;
-
-pa_assert(l);
-
-cells = PA_SHMASYNCQ_CELLS(l);
-
-_Y;
-idx = reduce(l, l->read_idx);
-
-if (!(ret = pa_atomic_ptr_load(&cells[idx]))) {
-
-if (!wait)
-return NULL;
-
-/* pa_log("sleeping on pop"); */
-
-do {
-pa_fdsem_wait(l->write_fdsem);
-} while (!(ret = pa_atomic_ptr_load(&cells[idx])));
-}
-
-pa_assert(ret);
-
-/* Guaranteed to succeed if we only have a single reader */
-pa_assert_se(pa_atomic_ptr_cmpxchg(&cells[idx], ret, NULL));
-
-_Y;
-l->read_idx++;
-
-pa_fdsem_post(l->read_fdsem);
-
-return ret;
-}
-
-int pa_shmasyncq_get_fd(pa_shmasyncq *q) {
-pa_assert(q);
-
-return pa_fdsem_get(q->write_fdsem);
-}
-
-int pa_shmasyncq_before_poll(pa_shmasyncq *l) {
-int idx;
-pa_atomic_ptr_t *cells;
-
-pa_assert(l)

[pulseaudio-discuss] [PATCH 2/2] Improve performance of peaks resampler

2011-11-15 Thread Maarten Bosmans
This is mainly achieved by special-casing the common 1ch float case,
which is used by applications such as pavucontrol.

Performance is improved by 35% for a mono 48000->25Hz peaks resampling.
---
 src/pulsecore/resampler.c |   37 ++---
 1 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
index cbf5782..dd9c1aa 100644
--- a/src/pulsecore/resampler.c
+++ b/src/pulsecore/resampler.c
@@ -1443,7 +1443,9 @@ static void peaks_resample(pa_resampler *r, const 
pa_memchunk *input, unsigned i
 pa_assert(input);
 pa_assert(output);
 pa_assert(out_n_frames);
+pa_assert(r->i_ss.rate >= r->o_ss.rate);
 pa_assert(r->i_ss.channels == r->o_ss.channels);
+pa_assert(r->work_format == PA_SAMPLE_S16NE || r->work_format == 
PA_SAMPLE_FLOAT32NE);
 
 src = (uint8_t*) pa_memblock_acquire(input->memblock) + input->index;
 dst = (uint8_t*) pa_memblock_acquire(output->memblock) + output->index;
@@ -1455,19 +1457,34 @@ static void peaks_resample(pa_resampler *r, const 
pa_memchunk *input, unsigned i
 i_end = ((r->peaks.o_counter+1) * r->i_ss.rate) / r->o_ss.rate;
 i_end = i_end > r->peaks.i_counter ? i_end - r->peaks.i_counter : 0;
 
-pa_assert(o_index * r->w_sz * r->o_ss.channels < 
pa_memblock_get_length(output->memblock));
+pa_assert_fp(o_index * r->w_sz * r->o_ss.channels < 
pa_memblock_get_length(output->memblock));
 
-if (r->work_format == PA_SAMPLE_S16NE) {
+/* 1ch float is treated separately, because that is the common case */
+if (r->o_ss.channels == 1 && r->work_format == PA_SAMPLE_FLOAT32NE) {
+float *s = (float*) src + i;
+float *d = (float*) dst + o_index;
+
+for (; i < i_end && i < in_n_frames; i++) {
+float n = fabsf(*s++);
+
+if (n > r->peaks.max_f[0])
+r->peaks.max_f[0] = n;
+}
+
+if (i == i_end) {
+*d = r->peaks.max_f[0];
+r->peaks.max_f[0] = 0;
+o_index++, r->peaks.o_counter++;
+}
+} else if (r->work_format == PA_SAMPLE_S16NE) {
 int16_t *s = (int16_t*) src + r->i_ss.channels * i;
 int16_t *d = (int16_t*) dst + r->o_ss.channels * o_index;
 
 for (; i < i_end && i < in_n_frames; i++)
-for (c = 0; c < r->o_ss.channels; c++, s++) {
-int16_t n;
+for (c = 0; c < r->o_ss.channels; c++) {
+int16_t n = abs(*s++);
 
-n = (int16_t) (*s < 0 ? -*s : *s);
-
-if (PA_UNLIKELY(n > r->peaks.max_i[c]))
+if (n > r->peaks.max_i[c])
 r->peaks.max_i[c] = n;
 }
 
@@ -1482,11 +1499,9 @@ static void peaks_resample(pa_resampler *r, const 
pa_memchunk *input, unsigned i
 float *s = (float*) src + r->i_ss.channels * i;
 float *d = (float*) dst + r->o_ss.channels * o_index;
 
-pa_assert(r->work_format == PA_SAMPLE_FLOAT32NE);
-
 for (; i < i_end && i < in_n_frames; i++)
-for (c = 0; c < r->o_ss.channels; c++, s++) {
-float n = fabsf(*s);
+for (c = 0; c < r->o_ss.channels; c++) {
+float n = fabsf(*s++);
 
 if (n > r->peaks.max_f[c])
 r->peaks.max_f[c] = n;
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 1/2] Rework the peaks resampler

2011-11-15 Thread Maarten Bosmans
The algorithm had been implemented the same way as the trivial resampler.  But
an important difference between the two is that the trivial resampler can write
an output as soon as the first corresponding input sample is seen, whereas the
peaks resampler must have read all input samples before writing an output
sample.

With this rework, the peaks resampler now outputs samples correctly when the
input data is spanning multiple memblocks.
---
 src/pulsecore/resampler.c |   67 +++--
 1 files changed, 28 insertions(+), 39 deletions(-)

diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
index d4a7204..cbf5782 100644
--- a/src/pulsecore/resampler.c
+++ b/src/pulsecore/resampler.c
@@ -1435,40 +1435,33 @@ static int trivial_init(pa_resampler*r) {
 /* Peak finder implementation */
 
 static void peaks_resample(pa_resampler *r, const pa_memchunk *input, unsigned 
in_n_frames, pa_memchunk *output, unsigned *out_n_frames) {
-size_t fz;
-unsigned o_index;
-void *src, *dst;
-unsigned start = 0;
+unsigned c, o_index = 0;
+unsigned i, i_end = 0;
+uint8_t *src, *dst;
 
 pa_assert(r);
 pa_assert(input);
 pa_assert(output);
 pa_assert(out_n_frames);
-
-fz = r->w_sz * r->o_ss.channels;
+pa_assert(r->i_ss.channels == r->o_ss.channels);
 
 src = (uint8_t*) pa_memblock_acquire(input->memblock) + input->index;
 dst = (uint8_t*) pa_memblock_acquire(output->memblock) + output->index;
 
-for (o_index = 0;; o_index++, r->peaks.o_counter++) {
-unsigned j;
-
-j = ((r->peaks.o_counter * r->i_ss.rate) / r->o_ss.rate);
+i = (r->peaks.o_counter * r->i_ss.rate) / r->o_ss.rate;
+i = i > r->peaks.i_counter ? i - r->peaks.i_counter : 0;
 
-if (j > r->peaks.i_counter)
-j -= r->peaks.i_counter;
-else
-j = 0;
+while (i_end < in_n_frames) {
+i_end = ((r->peaks.o_counter+1) * r->i_ss.rate) / r->o_ss.rate;
+i_end = i_end > r->peaks.i_counter ? i_end - r->peaks.i_counter : 0;
 
-pa_assert(o_index * fz < pa_memblock_get_length(output->memblock));
+pa_assert(o_index * r->w_sz * r->o_ss.channels < 
pa_memblock_get_length(output->memblock));
 
 if (r->work_format == PA_SAMPLE_S16NE) {
-unsigned i, c;
-int16_t *s = (int16_t*) ((uint8_t*) src + fz * start);
-int16_t *d = (int16_t*) ((uint8_t*) dst + fz * o_index);
-
-for (i = start; i <= j && i < in_n_frames; i++)
+int16_t *s = (int16_t*) src + r->i_ss.channels * i;
+int16_t *d = (int16_t*) dst + r->o_ss.channels * o_index;
 
+for (; i < i_end && i < in_n_frames; i++)
 for (c = 0; c < r->o_ss.channels; c++, s++) {
 int16_t n;
 
@@ -1478,22 +1471,20 @@ static void peaks_resample(pa_resampler *r, const 
pa_memchunk *input, unsigned i
 r->peaks.max_i[c] = n;
 }
 
-if (i >= in_n_frames)
-break;
-
-for (c = 0; c < r->o_ss.channels; c++, d++) {
-*d = r->peaks.max_i[c];
-r->peaks.max_i[c] = 0;
+if (i == i_end) {
+for (c = 0; c < r->o_ss.channels; c++, d++) {
+*d = r->peaks.max_i[c];
+r->peaks.max_i[c] = 0;
+}
+o_index++, r->peaks.o_counter++;
 }
-
 } else {
-unsigned i, c;
-float *s = (float*) ((uint8_t*) src + fz * start);
-float *d = (float*) ((uint8_t*) dst + fz * o_index);
+float *s = (float*) src + r->i_ss.channels * i;
+float *d = (float*) dst + r->o_ss.channels * o_index;
 
 pa_assert(r->work_format == PA_SAMPLE_FLOAT32NE);
 
-for (i = start; i <= j && i < in_n_frames; i++)
+for (; i < i_end && i < in_n_frames; i++)
 for (c = 0; c < r->o_ss.channels; c++, s++) {
 float n = fabsf(*s);
 
@@ -1501,16 +1492,14 @@ static void peaks_resample(pa_resampler *r, const 
pa_memchunk *input, unsigned i
 r->peaks.max_f[c] = n;
 }
 
-if (i >= in_n_frames)
-break;
-
-for (c = 0; c < r->o_ss.channels; c++, d++) {
-*d = r->peaks.max_f[c];
-r->peaks.max_f[c] = 0;
+if (i == i_end) {
+for (c = 0; c < r->o_ss.channels; c++, d++) {
+*d = r->peaks.max_f[c];
+r->peaks.max_f[c] = 0;
+}
+o_index++, r->peaks.o_counter++;
 }
 }
-
-start = j;
 }
 
 pa_memblock_release(input->memblock);
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] Two patches for the peaks resampler

2011-11-15 Thread Maarten Bosmans
These are the latest version of the patches I already sent to the list.
There should be nothing controversial in them, as functionality has not been 
changed.

The correctness of the first one is not trivial to see from the patch.
So I propose that the reviewer just trusts me when I say that when looking
at sample values, the patch fixes the peaks resampler.  If you want to avoid
thinking the whole algorithm through, just check whether the pavucontrol meters 
still make sense.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] pulseaudio bug in resampler.c method src-linear

2011-11-15 Thread Maarten Bosmans
2011/11/7 Ray Walker :
> There is a bug in resampler.c (version 1.0) with an assert at line 1230.  It
> only occurs with the resampler method of src-linear.
> Here is the output.  I worked with mkbosmans in #pulseaudio on this and he
> suggested I send this email.

Yup, please keep poking us untill you have a solution.

> The bug and subsequent data is reported here:
>  https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/885347
> I have experienced this bug for over a year through many Ubuntu upgrades
> (assuming each upgrade, which I do every April and October, comes with a new
> version of pulseaudio) and prevented me from playing certain tracks on
> websites and causes Exaile to not function at all.  So, it's not something
> new with pulseaudio 1.0 but has been there for a long time.

Just to be clear: src-linear is a really bad choice for a resampler.
So you probably found the bug because hardly anybody else is using it
except for some incidental testing.

I sent an email to the libsamplerate list explaining the problem and
got a reply from the author of libsamplerate.

===========
Maarten Bosmans wrote:
> The problem is that pulseaudio asserts that after calling
> src_process() the field data.input_frames_used is equal to the value
> it set in data.input_frames[2]. Is this an correct assumption, given
> that the the number of available frames in data.output_frames is large
> enough to hold all the resampled frames?

No guarantees. Certainly not something to put an assert on.

In fact, I would say that any software that has such as assert
has a bug :-).
===

So it seems that we should alter our code and do the right thing
instead of just asserting that everything went as we (wronly)
expected.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] RFC: Routing and Priority lists

2011-11-15 Thread Maarten Bosmans
2011/11/13 Colin Guthrie :
> I've written up my latest proposal to gather feedback before starting
> (hopefully soon now) on the implementation.
> http://www.freedesktop.org/wiki/Software/PulseAudio/RFC/PriorityRouting

Would the pa_route and PA_CORE_HOOK_SINK_INPUT_ROUTE stuff from your
proposed implementation be used directly by some modules, or would all
interaction with the route decision code go through priority lists?

I think it would perhaps be clearer if there was some separation in
pa_route_decision_t between the stuff that can be used to make the
decision (direction, proplist, ignore) and the result of the decision
(device).

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] Usage of pa_assert

2011-11-08 Thread Maarten Bosmans
2011/11/8 Tanu Kaskinen :
> On Tue, 2011-11-08 at 09:00 +0100, David Henningsson wrote:
>> In short, assertions are better than nothing, but proper error handling
>> is better than assertions.
>
> In my opinion assertions are proper error handling when the error in
> question is a programming error in our own code.

Indeed. There aren't many cases that just ignoring the failure and
carrying on like nothing happened adds much value over just hitting
the assert.

So do we have an official recommendation for distributors to leave
asserts enabled in production builds? I don't care much either way.
David seems to think it's the right thing to do.

I do think that fast-path asserts (pa_assert_fp) should be disabled,
except for developer builds. There's a reason these asserts can be
enabled or disabled independently from normal asserts and although the
current code doesn't use them much, there's already a patch of me (for
the trivial resampler) that makes very good use of a fast-path assert.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 2/6] Turn device ports into reference counted objects

2011-11-08 Thread Maarten Bosmans
2011/11/8 David Henningsson :
> On 11/03/2011 07:33 PM, Tanu Kaskinen wrote:
>>
>> This looks good too. I'd really like the pa_device_port_hashmap_free()
>> function behavior change to match all other *_free() functions, though.
>
> I do acknowledge the consistency argument, but I think we're over-using
> asserts in this project in general. From a development perspective, it might
> be useful, but from maintaining PA downstream, I'm tired of PA crashing
> every time something happens that the developer did not anticipate.
> Especially in destructors like this one, we should could try to free what we
> can instead of crashing.

That's exactly why you should compile without asserts enable for
production builds.

> In short, assertions are better than nothing, but proper error handling is
> better than assertions.
>
> --
> David Henningsson, Canonical Ltd.
> http://launchpad.net/~diwic
> ___
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] using pulseaudio with simultaneous playback from mutiple X sessions

2011-11-07 Thread Maarten Bosmans
2011/11/7 Martin Steigerwald :
> Hi!
>
> I have two users on my laptop. When I start to playback sound from the session
> of the first user and then switch to the second user pulseaudio stops to play
> back sound from the first user. This way I also do not hear appointment
> reminders from the session thats currently not active unless I switch again.

Correct. This is by design.

> Before using Pulseaudio sound from both sessions has been played
> simultaneously with Phonon + Xine. Now I am using Phonon + GStreamer, but I
> bet stopping the audio comes from Pulseaudio.
>
> I read about system-wide mode. But first I shouldn't use it and second it
> doesn't solve this issue anyway, cause sound is still stopped. Maybe I missed
> setting autospawn on clients to off - cause I saw three pulseaudio daemons, 
> one
> system-wide and two from the users -, but I do not like messing around with my
> Pulseaudio setup anymore - especially when its not recommended. Reason for
> trying Pulseaudio for me mostly was cause thats whats coming with Debian KDE
> standard install out of the box in the meanwhile.
>
> So whats the official way to achieve what I had before out of the box? The
> default per-session handling of audio makes sense for unix users being used by
> different human users on a shared computer but it does not make too much sense
> for my use case.

I would load module-protocol-native-tcp with ip-acl=127.0.0.1.
Then for other users set PULSE_SERVER=localhost.

> Best way would be to tell pulseaudio explicetely when some Unix users may play
> simultaneously. Ideally it should still not allow recording audio streams from
> each other user. But for now I would be fine with a global option.

This recording thing is, among other things, one of the reasons
multiple users aren't allowed to connect to eachothers pulse daemon by
default.

> I found nothing on the wiki on that. And nothing really obvious via search
> engine either. I only found out that I am not the only user puzzled by this
> new different behavior to what I was used to before.
>
> Thanks,

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 8/8] Improve performance of peaks resampler

2011-11-02 Thread Maarten Bosmans
This is mainly achieved by special-casing the common 1ch float case,
which is used by applications such as pavucontrol.
---
 src/pulsecore/resampler.c |   37 ++---
 1 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
index f5fcfcd..81c04c9 100644
--- a/src/pulsecore/resampler.c
+++ b/src/pulsecore/resampler.c
@@ -1444,6 +1444,8 @@ static void peaks_resample(pa_resampler *r, const 
pa_memchunk *input, unsigned i
 pa_assert(input);
 pa_assert(output);
 pa_assert(out_n_frames);
+pa_assert(r->i_ss.rate >= r->o_ss.rate);
+pa_assert(r->work_format == PA_SAMPLE_S16NE || r->work_format == 
PA_SAMPLE_FLOAT32NE);
 
 fz = r->w_sz * r->o_ss.channels;
 
@@ -1457,19 +1459,34 @@ static void peaks_resample(pa_resampler *r, const 
pa_memchunk *input, unsigned i
 i_end = (((r->peaks.o_counter+1) * r->i_ss.rate) / r->o_ss.rate);
 i_end = i_end > r->peaks.i_counter ? i_end - r->peaks.i_counter : 0;
 
-pa_assert(o_index * fz < pa_memblock_get_length(output->memblock));
+pa_assert_fp(o_index * fz < pa_memblock_get_length(output->memblock));
+
+/* 1ch float is treated separately, because that is the common case */
+if (r->o_ss.channels == 1 && r->work_format == PA_SAMPLE_FLOAT32NE) {
+float *s = (float*) src + i;
+float *d = (float*) dst + o_index;
+
+for (; i < i_end && i < in_n_frames; i++) {
+float n = fabsf(*s++);
+
+if (n > r->peaks.max_f[0])
+r->peaks.max_f[0] = n;
+}
 
-if (r->work_format == PA_SAMPLE_S16NE) {
+if (i == i_end) {
+*d = r->peaks.max_f[0];
+r->peaks.max_f[0] = 0;
+o_index++, r->peaks.o_counter++;
+}
+} else if (r->work_format == PA_SAMPLE_S16NE) {
 int16_t *s = (int16_t*) ((uint8_t*) src + fz * i);
 int16_t *d = (int16_t*) ((uint8_t*) dst + fz * o_index);
 
 for (; i < i_end && i < in_n_frames; i++)
-for (c = 0; c < r->o_ss.channels; c++, s++) {
-int16_t n;
+for (c = 0; c < r->o_ss.channels; c++) {
+int16_t n = abs(*s++);
 
-n = (int16_t) (*s < 0 ? -*s : *s);
-
-if (PA_UNLIKELY(n > r->peaks.max_i[c]))
+if (n > r->peaks.max_i[c])
 r->peaks.max_i[c] = n;
 }
 
@@ -1484,11 +1501,9 @@ static void peaks_resample(pa_resampler *r, const 
pa_memchunk *input, unsigned i
 float *s = (float*) ((uint8_t*) src + fz * i);
 float *d = (float*) ((uint8_t*) dst + fz * o_index);
 
-pa_assert(r->work_format == PA_SAMPLE_FLOAT32NE);
-
 for (; i < i_end && i < in_n_frames; i++)
-for (c = 0; c < r->o_ss.channels; c++, s++) {
-float n = fabsf(*s);
+for (c = 0; c < r->o_ss.channels; c++) {
+float n = fabsf(*s++);
 
 if (n > r->peaks.max_f[c])
 r->peaks.max_f[c] = n;
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 7/8] Rework the peaks resampler

2011-11-02 Thread Maarten Bosmans
The algorithm had been implemented the same way as the trivial resampler.  But
an important difference between the two is that the trivial resampler can write
an output as soon as the first corresponding input sample is seen, whereas the
peaks resampler must have read all input samples before writing an output
sample.

With this rework, the peaks resampler now outputs samples correctly when the
input data is spanning multiple memblocks.
---
 src/pulsecore/resampler.c |   55 ++--
 1 files changed, 23 insertions(+), 32 deletions(-)

diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
index d4a7204..f5fcfcd 100644
--- a/src/pulsecore/resampler.c
+++ b/src/pulsecore/resampler.c
@@ -1436,9 +1436,9 @@ static int trivial_init(pa_resampler*r) {
 
 static void peaks_resample(pa_resampler *r, const pa_memchunk *input, unsigned 
in_n_frames, pa_memchunk *output, unsigned *out_n_frames) {
 size_t fz;
-unsigned o_index;
+unsigned c, o_index = 0;
+unsigned i, i_end = 0;
 void *src, *dst;
-unsigned start = 0;
 
 pa_assert(r);
 pa_assert(input);
@@ -1450,25 +1450,20 @@ static void peaks_resample(pa_resampler *r, const 
pa_memchunk *input, unsigned i
 src = (uint8_t*) pa_memblock_acquire(input->memblock) + input->index;
 dst = (uint8_t*) pa_memblock_acquire(output->memblock) + output->index;
 
-for (o_index = 0;; o_index++, r->peaks.o_counter++) {
-unsigned j;
-
-j = ((r->peaks.o_counter * r->i_ss.rate) / r->o_ss.rate);
+i = ((r->peaks.o_counter * r->i_ss.rate) / r->o_ss.rate);
+i = i > r->peaks.i_counter ? i - r->peaks.i_counter : 0;
 
-if (j > r->peaks.i_counter)
-j -= r->peaks.i_counter;
-else
-j = 0;
+while (i_end < in_n_frames) {
+i_end = (((r->peaks.o_counter+1) * r->i_ss.rate) / r->o_ss.rate);
+i_end = i_end > r->peaks.i_counter ? i_end - r->peaks.i_counter : 0;
 
 pa_assert(o_index * fz < pa_memblock_get_length(output->memblock));
 
 if (r->work_format == PA_SAMPLE_S16NE) {
-unsigned i, c;
-int16_t *s = (int16_t*) ((uint8_t*) src + fz * start);
+int16_t *s = (int16_t*) ((uint8_t*) src + fz * i);
 int16_t *d = (int16_t*) ((uint8_t*) dst + fz * o_index);
 
-for (i = start; i <= j && i < in_n_frames; i++)
-
+for (; i < i_end && i < in_n_frames; i++)
 for (c = 0; c < r->o_ss.channels; c++, s++) {
 int16_t n;
 
@@ -1478,22 +1473,20 @@ static void peaks_resample(pa_resampler *r, const 
pa_memchunk *input, unsigned i
 r->peaks.max_i[c] = n;
 }
 
-if (i >= in_n_frames)
-break;
-
-for (c = 0; c < r->o_ss.channels; c++, d++) {
-*d = r->peaks.max_i[c];
-r->peaks.max_i[c] = 0;
+if (i == i_end) {
+for (c = 0; c < r->o_ss.channels; c++, d++) {
+*d = r->peaks.max_i[c];
+r->peaks.max_i[c] = 0;
+}
+o_index++, r->peaks.o_counter++;
 }
-
 } else {
-unsigned i, c;
-float *s = (float*) ((uint8_t*) src + fz * start);
+float *s = (float*) ((uint8_t*) src + fz * i);
 float *d = (float*) ((uint8_t*) dst + fz * o_index);
 
 pa_assert(r->work_format == PA_SAMPLE_FLOAT32NE);
 
-for (i = start; i <= j && i < in_n_frames; i++)
+for (; i < i_end && i < in_n_frames; i++)
 for (c = 0; c < r->o_ss.channels; c++, s++) {
 float n = fabsf(*s);
 
@@ -1501,16 +1494,14 @@ static void peaks_resample(pa_resampler *r, const 
pa_memchunk *input, unsigned i
 r->peaks.max_f[c] = n;
 }
 
-if (i >= in_n_frames)
-break;
-
-for (c = 0; c < r->o_ss.channels; c++, d++) {
-*d = r->peaks.max_f[c];
-r->peaks.max_f[c] = 0;
+if (i == i_end) {
+for (c = 0; c < r->o_ss.channels; c++, d++) {
+*d = r->peaks.max_f[c];
+r->peaks.max_f[c] = 0;
+}
+o_index++, r->peaks.o_counter++;
 }
 }
-
-start = j;
 }
 
 pa_memblock_release(input->memblock);
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 6/8] oss: Use log2 function from core-util instead of own implementation

2011-11-02 Thread Maarten Bosmans
---
 src/modules/oss/oss-util.c |   19 +--
 1 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/src/modules/oss/oss-util.c b/src/modules/oss/oss-util.c
index 04899af..9412a87 100644
--- a/src/modules/oss/oss-util.c
+++ b/src/modules/oss/oss-util.c
@@ -231,23 +231,14 @@ int pa_oss_auto_format(int fd, pa_sample_spec *ss) {
 return 0;
 }
 
-static int simple_log2(int v) {
-int k = 0;
-
-for (;;) {
-v >>= 1;
-if (!v) break;
-k++;
-}
-
-return k;
-}
-
 int pa_oss_set_fragments(int fd, int nfrags, int frag_size) {
 int arg;
-arg = ((int) nfrags << 16) | simple_log2(frag_size);
 
-pa_log_debug("Asking for %i fragments of size %i (requested %i)", nfrags, 
1 << simple_log2(frag_size), frag_size);
+pa_assert(frag_size >= 0);
+
+arg = ((int) nfrags << 16) | pa_ulog2(frag_size);
+
+pa_log_debug("Asking for %i fragments of size %i (requested %i)", nfrags, 
1 << pa_ulog2(frag_size), frag_size);
 
 if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &arg) < 0) {
 pa_log("SNDCTL_DSP_SETFRAGMENT: %s", pa_cstrerror(errno));
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 5/8] Squash unused variable compiler warning

2011-11-02 Thread Maarten Bosmans
---
 src/modules/echo-cancel/module-echo-cancel.c |7 ---
 src/modules/module-equalizer-sink.c  |4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/modules/echo-cancel/module-echo-cancel.c 
b/src/modules/echo-cancel/module-echo-cancel.c
index 9b69f82..d15c9f3 100644
--- a/src/modules/echo-cancel/module-echo-cancel.c
+++ b/src/modules/echo-cancel/module-echo-cancel.c
@@ -670,7 +670,7 @@ static void do_push_drift_comp(struct userdata *u) {
 pa_memchunk rchunk, pchunk, cchunk;
 uint8_t *rdata, *pdata, *cdata;
 float drift;
-int unused;
+int unused PA_GCC_UNUSED;
 
 rlen = pa_memblockq_get_length(u->source_memblockq);
 plen = pa_memblockq_get_length(u->sink_memblockq);
@@ -762,7 +762,7 @@ static void do_push(struct userdata *u) {
 size_t rlen, plen;
 pa_memchunk rchunk, pchunk, cchunk;
 uint8_t *rdata, *pdata, *cdata;
-int unused;
+int unused PA_GCC_UNUSED;
 
 rlen = pa_memblockq_get_length(u->source_memblockq);
 plen = pa_memblockq_get_length(u->sink_memblockq);
@@ -1944,7 +1944,8 @@ int main(int argc, char* argv[]) {
 pa_channel_map source_map, sink_map;
 pa_modargs *ma = NULL;
 uint8_t *rdata = NULL, *pdata = NULL, *cdata = NULL;
-int ret = 0, unused, i;
+int unused PA_GCC_UNUSED;
+int ret = 0, i;
 char c;
 float drift;
 
diff --git a/src/modules/module-equalizer-sink.c 
b/src/modules/module-equalizer-sink.c
index 46bd0d7..e83a41d 100644
--- a/src/modules/module-equalizer-sink.c
+++ b/src/modules/module-equalizer-sink.c
@@ -1081,7 +1081,7 @@ int pa__init(pa_module*m) {
 pa_sink *master;
 pa_sink_input_new_data sink_input_data;
 pa_sink_new_data sink_data;
-size_t fs, i;
+size_t i;
 unsigned c;
 float *H;
 unsigned a_i;
@@ -1107,7 +1107,7 @@ int pa__init(pa_module*m) {
 goto fail;
 }
 
-fs = pa_frame_size(&ss);
+//fs = pa_frame_size(&ss);
 
 if (pa_modargs_get_value_boolean(ma, "use_volume_sharing", 
&use_volume_sharing) < 0) {
 pa_log("use_volume_sharing= expects a boolean argument");
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 4/8] Avoid some compiler warnings when cross-compiling for mingw32

2011-11-02 Thread Maarten Bosmans
Autoconf documentation says that AC_FUNC_SELECT_ARGTYPES shouldn't be used 
anyway.
---
 configure.ac |1 -
 src/modules/module-esound-sink.c |2 +-
 src/pulse/mainloop.c |4 +---
 src/pulsecore/poll.c |   16 
 src/pulsecore/shm.c  |2 +-
 src/pulsecore/socket-server.c|6 +++---
 src/pulsecore/socket-util.c  |   20 +++-
 7 files changed, 21 insertions(+), 30 deletions(-)

diff --git a/configure.ac b/configure.ac
index be31486..9b0e253 100644
--- a/configure.ac
+++ b/configure.ac
@@ -485,7 +485,6 @@ AC_CHECK_FUNCS_ONCE([lrintf])
 # POSIX
 AC_FUNC_FORK
 AC_FUNC_GETGROUPS
-AC_FUNC_SELECT_ARGTYPES
 AC_CHECK_FUNCS_ONCE([chmod chown fstat fchown fchmod clock_gettime getaddrinfo 
getgrgid_r getgrnam_r \
 getpwnam_r getpwuid_r gettimeofday getuid mlock nanosleep \
 pipe posix_fadvise posix_madvise posix_memalign setpgid setsid shm_open \
diff --git a/src/modules/module-esound-sink.c b/src/modules/module-esound-sink.c
index d79054f..1e26e5e 100644
--- a/src/modules/module-esound-sink.c
+++ b/src/modules/module-esound-sink.c
@@ -377,7 +377,7 @@ static int do_write(struct userdata *u) {
 
 pa_make_tcp_socket_low_delay(u->fd);
 
-if (getsockopt(u->fd, SOL_SOCKET, SO_SNDBUF, &so_sndbuf, &sl) < 0)
+if (getsockopt(u->fd, SOL_SOCKET, SO_SNDBUF, (void *) &so_sndbuf, &sl) 
< 0)
 pa_log_warn("getsockopt(SO_SNDBUF) failed: %s", 
pa_cstrerror(errno));
 else {
 pa_log_debug("SO_SNDBUF is %zu.", (size_t) so_sndbuf);
diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c
index 8e956c9..5c0345e 100644
--- a/src/pulse/mainloop.c
+++ b/src/pulse/mainloop.c
@@ -186,9 +186,7 @@ static pa_io_event* mainloop_io_new(
 FD_ZERO (&xset);
 FD_SET (fd, &xset);
 
-if ((select((SELECT_TYPE_ARG1) fd, NULL, NULL, SELECT_TYPE_ARG234 
&xset,
-SELECT_TYPE_ARG5 &tv) == -1) &&
- (WSAGetLastError() == WSAENOTSOCK)) {
+if ((select(fd, NULL, NULL, &xset, &tv) == -1) && (WSAGetLastError() 
== WSAENOTSOCK)) {
 pa_log_warn("Cannot monitor non-socket file descriptors.");
 e->dead = TRUE;
 }
diff --git a/src/pulsecore/poll.c b/src/pulsecore/poll.c
index d5abb04..cd888b5 100644
--- a/src/pulsecore/poll.c
+++ b/src/pulsecore/poll.c
@@ -106,9 +106,7 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, 
int timeout) {
 tv.tv_sec = timeout / 1000;
 tv.tv_usec = (timeout % 1000) * 1000;
 
-ready = select((SELECT_TYPE_ARG1) maxfd + 1, SELECT_TYPE_ARG234 &rset,
-SELECT_TYPE_ARG234 &wset, SELECT_TYPE_ARG234 &xset,
-SELECT_TYPE_ARG5 (timeout == -1 ? NULL : &tv));
+ready = select(maxfd + 1, &rset, &wset, &xset, (timeout == -1 ? NULL : 
&tv));
 
 if ((ready == -1) && (errno == EBADF)) {
 ready = 0;
@@ -144,9 +142,7 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, 
int timeout) {
 singl_tv.tv_sec = 0;
 singl_tv.tv_usec = 0;
 
-if (select((SELECT_TYPE_ARG1) f->fd, SELECT_TYPE_ARG234 
&rset,
-   SELECT_TYPE_ARG234 &wset, SELECT_TYPE_ARG234 
&xset,
-   SELECT_TYPE_ARG5 &singl_tv) != -1) {
+if (select(f->fd, &rset, &wset, &xset, &singl_tv) != -1) {
 if (f->events & POLLIN)
 FD_SET (f->fd, &rset);
 if (f->events & POLLOUT)
@@ -185,9 +181,7 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, 
int timeout) {
 /* Linux alters the tv struct... but it shouldn't matter here ...
  * as we're going to be a little bit out anyway as we've just eaten
  * more than a couple of cpu cycles above */
-ready = select((SELECT_TYPE_ARG1) maxfd + 1, SELECT_TYPE_ARG234 
&rset,
-SELECT_TYPE_ARG234 &wset, SELECT_TYPE_ARG234 &xset,
-SELECT_TYPE_ARG5 (timeout == -1 ? NULL : &tv));
+ready = select(maxfd + 1, &rset, &wset, &xset, (timeout == -1 ? 
NULL : &tv));
 }
 }
 
@@ -196,8 +190,6 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, 
int timeout) {
 #endif
 
 if (ready > 0) {
-int r;
-
 ready = 0;
 for (f = fds; f < &fds[nfds]; ++f) {
 f->revents = 0;
@@ -210,7 +202,7 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, 
int timeout) {
  * for some kinds of descriptors.  Detect if this 
descriptor is a
  * connected socket, a server socket, or something else 
using a
  * 0-byte recv, and use ioctl(2) to detect POLLHUP.  */
-r = recv(f->fd, NULL, 0, MSG_PEEK);
+int r = recv(f->fd, NULL, 0, MSG_PEEK);
 if (r == 0 || (r < 0 && errno == ENOTSOCK))
  

[pulseaudio-discuss] [PATCH 3/8] Remove vector.h and vector-test

2011-11-02 Thread Maarten Bosmans
This code was never used and vectorization is handled by Orc anyway.
---
 src/.gitignore  |1 -
 src/Makefile.am |8 +---
 src/pulsecore/vector.h  |   98 ---
 src/tests/vector-test.c |   83 ---
 4 files changed, 1 insertions(+), 189 deletions(-)
 delete mode 100644 src/pulsecore/vector.h
 delete mode 100644 src/tests/vector-test.c

diff --git a/src/.gitignore b/src/.gitignore
index e7e5880..4a66969 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -69,5 +69,4 @@ thread-mainloop-test
 thread-test
 usergroup-test
 utf8-test
-vector-test
 volume-test
diff --git a/src/Makefile.am b/src/Makefile.am
index edeb6e3..a5cfe94 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -219,7 +219,6 @@ TESTS = \
mainloop-test \
strlist-test \
close-test \
-   vector-test \
memblockq-test \
channelmap-test \
thread-mainloop-test \
@@ -407,11 +406,6 @@ volume_test_CFLAGS = $(AM_CFLAGS)
 volume_test_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINOR@.la
 volume_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
-vector_test_SOURCES = tests/vector-test.c
-vector_test_CFLAGS = $(AM_CFLAGS)
-vector_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulse.la 
libpulsecommon-@PA_MAJORMINOR@.la
-vector_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
-
 channelmap_test_SOURCES = tests/channelmap-test.c
 channelmap_test_CFLAGS = $(AM_CFLAGS)
 channelmap_test_LDADD = $(AM_LDADD) libpulse.la 
libpulsecommon-@PA_MAJORMINOR@.la
@@ -570,7 +564,7 @@ libpulsecommon_@PA_MAJORMINOR@_la_SOURCES = \
pulsecore/lock-autospawn.c pulsecore/lock-autospawn.h \
pulsecore/log.c pulsecore/log.h \
pulsecore/ratelimit.c pulsecore/ratelimit.h \
-   pulsecore/macro.h pulsecore/vector.h \
+   pulsecore/macro.h \
pulsecore/mcalign.c pulsecore/mcalign.h \
pulsecore/memblock.c pulsecore/memblock.h \
pulsecore/memblockq.c pulsecore/memblockq.h \
diff --git a/src/pulsecore/vector.h b/src/pulsecore/vector.h
deleted file mode 100644
index 2af79ec..000
--- a/src/pulsecore/vector.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/***
-  This file is part of PulseAudio.
-
-  Copyright 2004-2006 Lennart Poettering
-  Copyright 2006 Pierre Ossman  for Cendio AB
-
-  PulseAudio is free software; you can redistribute it and/or modify
-  it under the terms of the GNU Lesser General Public License as published
-  by the Free Software Foundation; either version 2.1 of the License,
-  or (at your option) any later version.
-
-  PulseAudio is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with PulseAudio; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-  USA.
-***/
-
-#include 
-
-/* First, define HAVE_VECTOR if we have the gcc vector extensions at all */
-#if defined(__SSE2__)
-/* || defined(__ALTIVEC__)*/
-#define HAVE_VECTOR
-
-
-/* This is supposed to be portable to different SIMD instruction
- * sets. We define vector types for different base types: uint8_t,
- * int16_t, int32_t, float. The vector type is a union. The fields .i,
- * .u, .f are arrays for accessing the separate elements of a
- * vector. .v is a gcc vector type of the right format. .m is the
- * vector in the type the SIMD extension specific intrinsic API
- * expects. PA_xxx_VECTOR_SIZE is the size of the
- * entries. PA__VECTOR_MAKE constructs a gcc vector variable with
- * the same value in all elements. */
-
-#ifdef __SSE2__
-
-#include 
-#include 
-
-#define PA_UINT8_VECTOR_SIZE 16
-#define PA_INT16_VECTOR_SIZE 8
-#define PA_INT32_VECTOR_SIZE 4
-#define PA_FLOAT_VECTOR_SIZE 4
-
-#define PA_UINT8_VECTOR_MAKE(x) (pa_v16qi) { x, x, x, x, x, x, x, x, x, x, x, 
x, x, x, x, x }
-#define PA_INT16_VECTOR_MAKE(x) (pa_v8hi) { x, x, x, x, x, x, x, x }
-#define PA_INT32_VECTOR_MAKE(x) (pa_v4si) { x, x, x, x }
-#define PA_FLOAT_VECTOR_MAKE(x) (pa_v4fi) { x, x, x, x }
-
-#endif
-
-/* uint8_t vector */
-typedef uint8_t pa_v16qi __attribute__ ((vector_size (PA_UINT8_VECTOR_SIZE * 
sizeof(uint8_t;
-typedef union pa_uint8_vector {
-uint8_t u[PA_UINT8_VECTOR_SIZE];
-pa_v16qi v;
-#ifdef __SSE2__
-__m128i m;
-#endif
-} pa_uint8_vector_t;
-
-/* int16_t vector*/
-typedef int16_t pa_v8hi __attribute__ ((vector_size (PA_INT16_VECTOR_SIZE * 
sizeof(int16_t;
-typedef union pa_int16_vector {
-int16_t i[PA_INT16_VECTOR_SIZE];
-pa_v8hi v;
-#ifdef __SSE2__
-__m128i m;
-#endif
-} pa_int16_vector_t;
-
-/* int32_t vector */
-typedef int32_t pa_v4si __attri

[pulseaudio-discuss] [PATCH 2/8] build-sys: Remove check for alloca()

2011-11-02 Thread Maarten Bosmans
As it isn't used anymore.
Also, some minor cleanup.
---
 configure.ac |   19 ---
 1 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/configure.ac b/configure.ac
index 324e32e..be31486 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,9 @@ AC_INIT([pulseaudio],[m4_esyscmd(./git-version-gen 
.tarball-version)],[pulseaudi
 AC_CONFIG_SRCDIR([src/daemon/main.c])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules color-tests 
dist-xz tar-ustar])
+
+AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability color-tests dist-xz 
tar-ustar])
+AM_SILENT_RULES([yes])
 
 m4_define(pa_major, `echo $VERSION | cut -d. -f1 | cut -d- -f1`)
 m4_define(pa_minor, `echo $VERSION | cut -d. -f2 | cut -d- -f1`)
@@ -58,14 +60,11 @@ AC_CANONICAL_HOST
 AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host", [Canonical host string.])
 
 AC_CHECK_PROG([STOW], [stow], [yes], [no])
-
 AS_IF([test "x$STOW" = "xyes" && test -d /usr/local/stow], [
 AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to 
/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
 ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
 ])
 
-AM_SILENT_RULES([yes])
-
 
  Checks for programs. 
 
@@ -154,7 +153,7 @@ esac
  Compiler flags 
 
 AX_APPEND_COMPILE_FLAGS(
-[-Wall -W -Wextra -pipe -Wno-long-long -Wvla -Wno-overlength-strings 
-Wunsafe-loop-optimizations -Wundef -Wformat=2 -Wlogical-op -Wsign-compare 
-Wformat-security -Wmissing-include-dirs -Wformat-nonliteral 
-Wold-style-definition -Wpointer-arith -Winit-self 
-Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes 
-Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn 
-Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing -Wwrite-strings 
-Wno-unused-parameter -ffast-math -Wp,-D_FORTIFY_SOURCE=2 -fno-common 
-fdiagnostics-show-option],
+[-Wall -W -Wextra -pipe -Wvla -Wno-overlength-strings 
-Wunsafe-loop-optimizations -Wundef -Wformat=2 -Wlogical-op -Wsign-compare 
-Wformat-security -Wmissing-include-dirs -Wformat-nonliteral 
-Wold-style-definition -Wpointer-arith -Winit-self 
-Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes 
-Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn 
-Wshadow -Wcast-align -Wstrict-aliasing -Wwrite-strings -Wno-unused-parameter 
-ffast-math -Wp,-D_FORTIFY_SOURCE=2 -fno-common -fdiagnostics-show-option],
 [], [-pedantic -Werror])
 
 
@@ -395,9 +394,8 @@ AC_C_CONST
 AC_C_BIGENDIAN
 AC_TYPE_PID_T
 AC_TYPE_SIZE_T
-AC_CHECK_TYPES(ssize_t, , AC_DEFINE([ssize_t], [signed long], [Define ssize_t 
if it is not done by the standard libs.]))
+AC_TYPE_SSIZE_T
 AC_TYPE_OFF_T
-
 AC_TYPE_UID_T
 AC_CHECK_DECLS(environ)
 
@@ -482,7 +480,7 @@ AC_CHECK_FUNCS([getopt_long], [], [AC_CHECK_LIB([iberty], 
[getopt_long])])
  Check for functions 
 
 # ISO
-AC_CHECK_FUNCS_ONCE([lrintf strtof])
+AC_CHECK_FUNCS_ONCE([lrintf])
 
 # POSIX
 AC_FUNC_FORK
@@ -509,9 +507,8 @@ AC_CHECK_FUNCS_ONCE([strerror_r])
 AC_CHECK_FUNCS_ONCE([lstat])
 
 # Non-standard
-AC_CHECK_FUNCS_ONCE([setresuid setresgid setreuid setregid seteuid setegid 
ppoll strsignal sig2str strtof_l pipe2 accept4])
-
-AC_FUNC_ALLOCA
+AC_CHECK_FUNCS_ONCE([setresuid setresgid setreuid setregid seteuid setegid])
+AC_CHECK_FUNCS_ONCE([ppoll sig2str strtof_l pipe2 accept4])
 
 AC_CHECK_FUNCS([regexec], [HAVE_REGEX=1], [HAVE_REGEX=0])
 AM_CONDITIONAL(HAVE_REGEX, [test "x$HAVE_REGEX" = "x1"])
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 1/8] build-sys: Use configure cache by default in bootstrap

2011-11-02 Thread Maarten Bosmans
This speeds up subsequent configure invokations
---
 .gitignore   |1 +
 autogen.sh   |2 +-
 bootstrap.sh |2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 9290ad2..765642f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,6 +15,7 @@ Makefile.in
 aclocal.m4
 autom4te.cache
 compile
+config.cache
 config.guess
 config.h
 config.h.in
diff --git a/autogen.sh b/autogen.sh
index 4051a22..5a07251 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -20,4 +20,4 @@
 
 NOCONFIGURE=1 ./bootstrap.sh
 
-exec ./configure  "$@"
+exec ./configure -C "$@"
diff --git a/bootstrap.sh b/bootstrap.sh
index d0baf95..3e2bfab 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -98,7 +98,7 @@ else
 run_versioned automake "$VERSION" --copy --foreign --add-missing
 
 if test "x$NOCONFIGURE" = "x"; then
-CFLAGS="$CFLAGS -g -O0" ./configure --sysconfdir=/etc 
--localstatedir=/var --enable-force-preopen "$@"
+CFLAGS="$CFLAGS -g -O0" ./configure -C --sysconfdir=/etc 
--localstatedir=/var --enable-force-preopen "$@"
 make clean
 fi
 fi
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] Some various patches

2011-11-02 Thread Maarten Bosmans
Here's a series of unrelated patches.  Some of them I already sent to the list 
before, but needed rebasing, others are
entirely new.

The first 6 are just some maintainance that needed being done.

The last two are improvements for the peaks resampler.  Don't worry, there's 
nothing controversial in there (I still
remember a particularly tiresome day on the IRC channel, involving the peaks 
resampler), perhaps that's for another
time, we'll see.

Maarten

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] Remove time-smoother and shm from libpulsecore

2011-11-02 Thread Maarten Bosmans
ping

2011/10/19 Maarten Bosmans :
> As they are already included in libpulsecommon.
> ---
>  src/Makefile.am |    2 --
>  1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/src/Makefile.am b/src/Makefile.am
> index c0841b4..d8270ea 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -814,7 +814,6 @@ libpulsecore_@PA_MAJORMINOR@_la_SOURCES = \
>                pulsecore/sconv_sse.c \
>                pulsecore/sconv.c pulsecore/sconv.h \
>                pulsecore/shared.c pulsecore/shared.h \
> -               pulsecore/shm.c pulsecore/shm.h \
>                pulsecore/sink-input.c pulsecore/sink-input.h \
>                pulsecore/sink.c pulsecore/sink.h \
>                pulsecore/sioman.c pulsecore/sioman.h \
> @@ -824,7 +823,6 @@ libpulsecore_@PA_MAJORMINOR@_la_SOURCES = \
>                pulsecore/source.c pulsecore/source.h \
>                pulsecore/start-child.c pulsecore/start-child.h \
>                pulsecore/thread-mq.c pulsecore/thread-mq.h \
> -               pulsecore/time-smoother.c pulsecore/time-smoother.h \
>                pulsecore/database.h
>
>  libpulsecore_@PA_MAJORMINOR@_la_CFLAGS = $(AM_CFLAGS) $(SERVER_CFLAGS) 
> $(LIBSAMPLERATE_CFLAGS) $(LIBSPEEX_CFLAGS) $(LIBSNDFILE_CFLAGS) 
> $(WINSOCK_CFLAGS)
> --
> 1.7.4.1
>
>
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] rtpoll: Update comment

2011-11-02 Thread Maarten Bosmans
ping

2011/10/13 Maarten Bosmans :
> to reflect changes made in
> 32e2cd6d3216f780c4cffed0f8eb3c30f2c8d732
> core: get rid of rt sig/timer handling since modern Linux' ppoll() is finally 
> fixed for granularity
> ---
>  src/pulsecore/rtpoll.h |    8 +---
>  1 files changed, 1 insertions(+), 7 deletions(-)
>
> diff --git a/src/pulsecore/rtpoll.h b/src/pulsecore/rtpoll.h
> index bb3c860..1c8f8b0 100644
> --- a/src/pulsecore/rtpoll.h
> +++ b/src/pulsecore/rtpoll.h
> @@ -34,13 +34,7 @@
>  * yet another wrapper around poll(). However it has certain
>  * advantages over pa_mainloop and suchlike:
>  *
> - * 1) It uses timer_create() and POSIX real time signals to guarantee
> - * optimal high-resolution timing. Starting with Linux 2.6.21 hrtimers
> - * are available, and since right now only nanosleep() and the POSIX
> - * clock and timer interfaces have been ported to hrtimers (and not
> - * ppoll/pselect!) we have to combine ppoll() with timer_create(). The
> - * fact that POSIX timers and POSIX rt signals are used internally is
> - * completely hidden.
> + * 1) High resolution timers are used
>  *
>  * 2) It allows raw access to the pollfd data to users
>  *
> --
> 1.7.4.1
>
>
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Why PA does not show me sinks for surround audio output?

2011-11-01 Thread Maarten Bosmans
2011/11/1 Lin, Mengdong :
>
>> Please provide the info I asked for earlier.
>>
>> Maarten
>
> Thank you very much, Maarten!
> Here is log of "pulseaudio -".
> My OS is Ubuntu 10.10 and I have removed other sound devices except this 
> Intel HDA sound card.

>From the log you can see that pulse tries to probe the soundcard for
all the surround modi, but that only stereo works. (e.g. see line 120
and 400)

Are you sure you can actually play multichannel audio (directly
through alsa, so without pulse) to the surround cards listed with
aplay -L?

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] PulseAudio Xen module

2011-10-31 Thread Maarten Bosmans
2011/10/31 George Boutsioukis :
> Hello PulseAudio people!
> As part of a Google Summer of code project for Xen during this summer, I
> wrote a PulseAudio module that acts as the frontend part of a Xen
> paravirtualized audio driver. Basically what it does is push audio frames
> over a ring buffer placed in memory shared between different Xen domains,
> using Xen's interrupt-like events to notify the playback backend that audio
> data is available.
> The driver right now works well and we are thinking of the best possible way
> to distribute it. Since (and correct me if I'm wrong) it's not possible to
> build PulseAudio modules with the usual headers provided for PulseAudio
> applications, we can't simply merge it with Xen's build system without the
> whole. We'd like to be able to build something like a pulseaudio-modules-xen
> package for a few common distro's, but in the most (reasonably)
> maintenance-free way possible.

Indeed, getting the module upstream and integrated into our
buildsystem would be the easiest.

> So, what would it take to check this into PulseAudio? (and build only when
> the Xen headers are found)

Well, obviously a patch against the pulseaudio tree would be better.
The symdef file is autogenerated, so you only have to add the source
file to src/modules and copy some boilerplate in configure.ac and
src/Makefile.am.

> You can find the code here:
> http://code.google.com/p/xen-audio/source/browse/#hg/frontend
> (ignore the xenpv-source module, doesn't really work yet)

So why is this based on pulse 0.9.21? I'd say try building against 1.1
or even git master, as that's what's needed to get the module
upstreamed. (Not that I expect that a lot of changes are necessary)

In the Makefile I can see you include the pulse directory, but I don't
see the module being linked against
libpulse/libpulsecommon/libpulsecore, is this correct?

> The playback module was based on pipe-sink. There are definitely some
> mistakes in there (I'm not even close to a sound programming expert), but if
> it's an issue of code quality I could clean it up to an acceptable state.

A general comment: please follow our codings style for the frontend
pulse module.
http://pulseaudio.org/wiki/CodingStyle

In particular:
  - Only use /* */  comments, not //
 - Why do you define the DPRINTF macro? Just use pa_log_debug
directly, unconditionally.
 - Opening brace of a function block goes on the line declaring the function.
 - Use a space around if(condition)statement;
 - Use static functions for non-exported functionality

Also, it seems you have to update the modargs, because you don't use
file anymore.

> Thanks,
> Giorgos
> There's a design document that describes the driver's design in detail here:
> https://docs.google.com/document/d/1rS8afKlCbiVAOdKYCHfRPn6ihkSnl7PZw1QMoOmC9b4

Seems empty.

> For more info on how paravirtualized drivers in general work in Xen see:
> http://wiki.xen.org/xenwiki/XenSplitDrivers

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Why PA does not show me sinks for surround audio output?

2011-10-31 Thread Maarten Bosmans
2011/10/31 Lin, Mengdong :
>>> The default sample channels and channel map are commented in
>> > /etc/pulse/daemon.conf:
>> >
>> > ;default-sample-channels =2
>>
>> Uncomment that and set it to 6.
>
> I've tried this method but it doesn't work. The card's profile list has not 
> change after I set default-sampel-channel=6.

As I said earlier, this setting has nothing to do with the problem
you're seeing. Jan's advise was wrong, but I agree that it is not
really evident or logical that changing that setting doesn't work.

Please provide the info I asked for earlier.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Why PA does not show me sinks for surround audio output?

2011-10-31 Thread Maarten Bosmans
2011/10/31 Lin, Mengdong :
> The sound card on my desktop supports 5.1 sound output, but PA only show one
> sink for the 2-channel front speaker. Why? Is it mean that PA cannot support
> surround output by default?

To be clear: pulse should handle this by default.

> The default sample channels and channel map are commented in
> /etc/pulse/daemon.conf:
>
> ;default-sample-channels =2
>
> ;default-channel-map= front-left,front-right

This has nothing to do with it.

> It seems the card has no profiles for surround output, by “pacmd
> list-cards”:
>
> profiles:
>
>    output:analog-stereo: Analog Stereo Output (priority
> 6000)
>
>    output:analog-stereo+input:analog-stereo: Analog Stereo
> Duplex (priority 6060)
>
>    input:analog-stereo: Analog Stereo Input (priority 60)
>
>    off: Off (priority 0)

Can you post output of pulseaudio -? btw, the IRC channel is also
good for these kinds of troubleshooting.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 4/6] tests: Rename voltest to volume-test

2011-10-29 Thread Maarten Bosmans
2011/10/29 Wang Xingchao :
> 2011/10/29 Maarten Bosmans :
>> ---
>>  src/.gitignore          |   61 +++---
>>  src/Makefile.am         |   10 ++--
>>  src/tests/voltest.c     |  134 
>> ---
>>  src/tests/volume-test.c |  134 
>> +++
>>  4 files changed, 170 insertions(+), 169 deletions(-)
>>
>
> make sense for me. this tool is very useful to check soft volume
> optimization. Only one comment about the timestamp before/after the
> test, i am afraid it become inaccurate if system in high overload,
> pa_rtclock_now() will think over sleep/interrupt time of current.

Note that this is not the same test you used earlier from my orcify
branch, that test is called svolume-test. This is an existing test
that only checks calculations on the volume variables, not on how that
volume value is applied to actual audio samples.

As such, volume-test does not use pa_rtclock_now or any timing related
functions.

In general you're right that for performance measures the wall clock
time is not ideal. But on the other hand, performance test should
always be done with an otherwise idle system, so definitely browsers,
etc. closed. In these cases the wall clock time is pretty reliable.
That's why in some tests the standard deviation of the timing
measurements is printed. If the wall clock time measurements are
reasonably close together, you know that no external program is
interfering with the measurements. Note that CPU time measurements are
no help either when the system is otherwise loaded. The actual CPU
time for other programs does not matter then, but you'll always see
cache effects, so having an idle system is needed either way.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 6/6] tests: Reduce time needed for a make check

2011-10-28 Thread Maarten Bosmans
---
 src/tests/interpol-test.c   |7 +--
 src/tests/lock-autospawn-test.c |8 
 src/tests/once-test.c   |2 +-
 src/tests/rtpoll-test.c |4 +++-
 4 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/tests/interpol-test.c b/src/tests/interpol-test.c
index ad00aca..fa89e8e 100644
--- a/src/tests/interpol-test.c
+++ b/src/tests/interpol-test.c
@@ -174,12 +174,7 @@ int main(int argc, char *argv[]) {
 
 pa_assert_se(pa_threaded_mainloop_start(m) >= 0);
 
-/* #ifdef CORK */
-for (k = 0; k < 2; k++)
-/* #else */
-/* for (k = 0; k < 2000; k++) */
-/* #endif */
-{
+for (k = 0; k < 4000; k++) {
 pa_bool_t success = FALSE, changed = FALSE;
 pa_usec_t t, rtc, d;
 struct timeval now, tv;
diff --git a/src/tests/lock-autospawn-test.c b/src/tests/lock-autospawn-test.c
index e2db24c..a7324ab 100644
--- a/src/tests/lock-autospawn-test.c
+++ b/src/tests/lock-autospawn-test.c
@@ -38,9 +38,9 @@ static void thread_func(void*k) {
 
 pa_assert_se(pa_autospawn_lock_acquire(TRUE) > 0);
 
-pa_log("%i, Got the lock!, Sleeping for 5s", PA_PTR_TO_INT(k));
+pa_log("%i, Got the lock!, Sleeping for 2s", PA_PTR_TO_INT(k));
 
-pa_msleep(5000);
+pa_msleep(2000);
 
 pa_log("%i, Releasing", PA_PTR_TO_INT(k));
 
@@ -74,9 +74,9 @@ static void thread_func2(void *k) {
 pa_log("%i, woke up", PA_PTR_TO_INT(k));
 }
 
-pa_log("%i, Got the lock!, Sleeping for 5s", PA_PTR_TO_INT(k));
+pa_log("%i, Got the lock!, Sleeping for 2s", PA_PTR_TO_INT(k));
 
-pa_msleep(5000);
+pa_msleep(2000);
 
 pa_log("%i, Releasing", PA_PTR_TO_INT(k));
 
diff --git a/src/tests/once-test.c b/src/tests/once-test.c
index b1ef6ba..cf33057 100644
--- a/src/tests/once-test.c
+++ b/src/tests/once-test.c
@@ -40,7 +40,7 @@ static pthread_barrier_t barrier;
 #endif
 static unsigned n_cpu;
 
-#define N_ITERATIONS 500
+#define N_ITERATIONS 200
 #define N_THREADS 100
 
 static void once_func(void) {
diff --git a/src/tests/rtpoll-test.c b/src/tests/rtpoll-test.c
index 6a6b73a..4c862b2 100644
--- a/src/tests/rtpoll-test.c
+++ b/src/tests/rtpoll-test.c
@@ -23,6 +23,8 @@
 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -59,7 +61,7 @@ int main(int argc, char *argv[]) {
 w = pa_rtpoll_item_new(p, PA_RTPOLL_NORMAL, 0);
 pa_rtpoll_item_set_before_callback(w, worker);
 
-pa_rtpoll_set_timer_relative(p, 1000); /* 10 s */
+pa_rtpoll_set_timer_relative(p, 4 * PA_USEC_PER_SEC);
 
 pa_rtpoll_run(p, 1);
 
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 5/6] tests: Revisit which tests to run with make check

2011-10-28 Thread Maarten Bosmans
Some tests (remix-test, sig2str) only display information, so they are not
useful for automated testing.  Others (interpol-test, once-test, thread-test)
do return an error on failure, so should be included in TESTS.
---
 src/Makefile.am |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 94b12be..f9e2e36 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -226,6 +226,7 @@ TESTS = \
utf8-test \
format-test \
get-binary-name-test \
+   interpol-test \
ipacl-test \
hook-list-test \
memblock-test \
@@ -233,12 +234,11 @@ TESTS = \
asyncmsgq-test \
queue-test \
rtpoll-test \
-   sig2str-test \
resampler-test \
smoother-test \
+   thread-test \
volume-test \
mix-test \
-   remix-test \
proplist-test \
lock-autospawn-test \
prioq-test
@@ -249,10 +249,10 @@ TESTS_norun = \
parec-simple \
extended-test \
sync-playback \
-   interpol-test \
-   thread-test \
flist-test \
+   remix-test \
rtstutter \
+   sig2str-test \
stripnul \
connect-stress \
echo-cancel-test
@@ -264,7 +264,7 @@ TESTS += \
 endif
 
 if !OS_IS_DARWIN
-TESTS_norun += \
+TESTS += \
once-test
 endif
 
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH 4/6] tests: Rename voltest to volume-test

2011-10-28 Thread Maarten Bosmans
---
 src/.gitignore  |   61 +++---
 src/Makefile.am |   10 ++--
 src/tests/voltest.c |  134 ---
 src/tests/volume-test.c |  134 +++
 4 files changed, 170 insertions(+), 169 deletions(-)

diff --git a/src/.gitignore b/src/.gitignore
index 51a1452..e7e5880 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -1,11 +1,4 @@
-once-test
-usergroup-test
-sigbus-test
 TAGS
-alsa-time-test
-gtk-test
-prioq-test
-lock-autospawn-test
 *.lo
 *.o
 *.la
@@ -13,46 +6,60 @@ lock-autospawn-test
 .libs
 Makefile
 Makefile.in
-asyncmsgq-test
-asyncq-test
 proximity-helper
-channelmap-test
 client.conf
-close-test
-cpulimit-test
-cpulimit-test2
 daemon.conf
 default.pa
 echo-cancel-test
 esdcompat
-flist-test
 gconf-helper
+pacat
+pacmd
+pactl
+paplay
+pasuspender
+pax11publish
+pulseaudio
+start-pulseaudio-x11
+start-pulseaudio-kde
+*-symdef.h
+*-orc-gen.[ch]
+# tests
+alsa-time-test
+asyncmsgq-test
+asyncq-test
+channelmap-test
+close-test
+connect-stress
+cpulimit-test
+cpulimit-test2
+extended-test
+flist-test
+format-test
 get-binary-name-test
+gtk-test
 hook-list-test
 interpol-test
 ipacl-test
+lock-autospawn-test
 mainloop-test
 mainloop-test-glib
 mcalign-test
-memblock-test
 memblockq-test
+memblock-test
 mix-test
-pacat
+once-test
 pacat-simple
-pacmd
-pactl
-paplay
 parec-simple
-pasuspender
-pax11publish
+prioq-test
 proplist-test
-pulseaudio
 queue-test
 remix-test
 resampler-test
 rtpoll-test
 rtstutter
 sig2str-test
+sigbus-test
 smoother-test
 stripnul
 strlist-test
@@ -60,13 +67,7 @@ sync-playback
 system.pa
 thread-mainloop-test
 thread-test
+usergroup-test
 utf8-test
-voltest
-start-pulseaudio-x11
-start-pulseaudio-kde
 vector-test
-*-symdef.h
-connect-stress
-extended-test
-format-test
-*-orc-gen.[ch]
+volume-test
diff --git a/src/Makefile.am b/src/Makefile.am
index 23e6203..94b12be 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -219,7 +219,6 @@ TESTS = \
mainloop-test \
strlist-test \
close-test \
-   voltest \
vector-test \
memblockq-test \
channelmap-test \
@@ -237,6 +236,7 @@ TESTS = \
sig2str-test \
resampler-test \
smoother-test \
+   volume-test \
mix-test \
remix-test \
proplist-test \
@@ -402,10 +402,10 @@ close_test_CFLAGS = $(AM_CFLAGS)
 close_test_LDADD = $(AM_LDADD) $(WINSOCK_LIBS) libpulsecore-@PA_MAJORMINOR@.la 
libpulse.la libpulsecommon-@PA_MAJORMINOR@.la
 close_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
-voltest_SOURCES = tests/voltest.c
-voltest_CFLAGS = $(AM_CFLAGS)
-voltest_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINOR@.la
-voltest_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+volume_test_SOURCES = tests/volume-test.c
+volume_test_CFLAGS = $(AM_CFLAGS)
+volume_test_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINOR@.la
+volume_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 vector_test_SOURCES = tests/vector-test.c
 vector_test_CFLAGS = $(AM_CFLAGS)
diff --git a/src/tests/voltest.c b/src/tests/voltest.c
deleted file mode 100644
index f7405ff..000
--- a/src/tests/voltest.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/***
-  This file is part of PulseAudio.
-
-  PulseAudio is free software; you can redistribute it and/or modify
-  it under the terms of the GNU Lesser General Public License as published
-  by the Free Software Foundation; either version 2.1 of the License,
-  or (at your option) any later version.
-
-  PulseAudio is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with PulseAudio; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-  USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include 
-#endif
-
-#include 
-#include 
-
-#include 
-
-#include 
-#include 
-
-int main(int argc, char *argv[]) {
-pa_volume_t v;
-pa_cvolume cv;
-float b;
-pa_channel_map map;
-pa_volume_t md = 0;
-unsigned mdn = 0;
-
-if (!getenv("MAKE_CHECK"))
-pa_log_set_level(PA_LOG_DEBUG);
-
-pa_log("Attenuation of sample 1 against 32767: %g dB", 
20.0*log10(1.0/32767.0));
-pa_log("Smallest possible attenuation > 0 applied to 32767: %li", 
lrint(32767.0*pa_sw_volume_to_linear(1)));
-
-for (v = PA_VOLUME_MUTED; v <= PA_VOLUME_NORM*2; v += 256) {
-
-double dB = pa_sw_volume_to_dB(v);
-double f = pa_sw_volume_to_linear(v);
-
-pa_log_debug("Volume: %3i; percent: %i%%; decibel %0.2f; linear = 
%0.2f; volume(decibel): %3i; volume(linear): %3i",
-   v, (v*100)/PA_VOLUME_NOR

[pulseaudio-discuss] [PATCH 3/6] tests: More useful output of make check

2011-10-28 Thread Maarten Bosmans
Instead of spilling thousands of lines of output, make check now runs the
test-suite in about 100 lines or so.  If running under make check, the output of
tests is reduced. The MAKE_CHECK environment variable is used for this, so that
when running the test manually, the full output is still shown.  Furthermore,
pa_log is used consistently instead of printf, so that all test output goes to
stderr by default.  Colored output from make check goes to stdout.
---
 configure.ac |2 +-
 src/Makefile.am  |2 +
 src/tests/asyncmsgq-test.c   |   16 ++--
 src/tests/asyncq-test.c  |   11 +---
 src/tests/get-binary-name-test.c |6 +++-
 src/tests/interpol-test.c|   16 +---
 src/tests/ipacl-test.c   |   10 +--
 src/tests/lock-autospawn-test.c  |2 -
 src/tests/memblock-test.c|   49 +-
 src/tests/memblockq-test.c   |   10 
 src/tests/mix-test.c |8 -
 src/tests/once-test.c|7 -
 src/tests/prioq-test.c   |   11 +---
 src/tests/proplist-test.c|   15 +++
 src/tests/resampler-test.c   |   36 ++--
 src/tests/smoother-test.c|   11 +---
 src/tests/thread-mainloop-test.c |2 -
 src/tests/thread-test.c  |   13 ++
 src/tests/utf8-test.c|6 ++--
 src/tests/voltest.c  |   24 +-
 20 files changed, 143 insertions(+), 114 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9322ca0..b6c9625 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,7 @@ AC_INIT([pulseaudio],[m4_esyscmd(./git-version-gen 
.tarball-version)],[mzchyfrnh
 AC_CONFIG_SRCDIR([src/daemon/main.c])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules dist-xz 
tar-ustar])
+AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules color-tests 
dist-xz tar-ustar])
 
 m4_define(pa_major, `echo $VERSION | cut -d. -f1 | cut -d- -f1`)
 m4_define(pa_minor, `echo $VERSION | cut -d. -f2 | cut -d- -f1`)
diff --git a/src/Makefile.am b/src/Makefile.am
index cc3e13b..23e6203 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -289,6 +289,8 @@ TESTS_norun += \
alsa-time-test
 endif
 
+TESTS_ENVIRONMENT=MAKE_CHECK=1
+
 if BUILD_TESTS_DEFAULT
 noinst_PROGRAMS = $(TESTS) $(TESTS_norun)
 else
diff --git a/src/tests/asyncmsgq-test.c b/src/tests/asyncmsgq-test.c
index 96e5a0d..9fbe5bc 100644
--- a/src/tests/asyncmsgq-test.c
+++ b/src/tests/asyncmsgq-test.c
@@ -49,19 +49,19 @@ static void the_thread(void *_q) {
 switch (code) {
 
 case OPERATION_A:
-printf("Operation A\n");
+pa_log_info("Operation A");
 break;
 
 case OPERATION_B:
-printf("Operation B\n");
+pa_log_info("Operation B");
 break;
 
 case OPERATION_C:
-printf("Operation C\n");
+pa_log_info("Operation C");
 break;
 
 case QUIT:
-printf("quit\n");
+pa_log_info("quit");
 quit = 1;
 break;
 }
@@ -79,22 +79,22 @@ int main(int argc, char *argv[]) {
 
 pa_assert_se(t = pa_thread_new("test", the_thread, q));
 
-printf("Operation A post\n");
+pa_log_info("Operation A post");
 pa_asyncmsgq_post(q, NULL, OPERATION_A, NULL, 0, NULL, NULL);
 
 pa_thread_yield();
 
-printf("Operation B post\n");
+pa_log_info("Operation B post");
 pa_asyncmsgq_post(q, NULL, OPERATION_B, NULL, 0, NULL, NULL);
 
 pa_thread_yield();
 
-printf("Operation C send\n");
+pa_log_info("Operation C send");
 pa_asyncmsgq_send(q, NULL, OPERATION_C, NULL, 0, NULL);
 
 pa_thread_yield();
 
-printf("Quit post\n");
+pa_log_info("Quit post");
 pa_asyncmsgq_post(q, NULL, QUIT, NULL, 0, NULL, NULL);
 
 pa_thread_free(t);
diff --git a/src/tests/asyncq-test.c b/src/tests/asyncq-test.c
index 46bac9f..6ac8cba 100644
--- a/src/tests/asyncq-test.c
+++ b/src/tests/asyncq-test.c
@@ -36,12 +36,12 @@ static void producer(void *_q) {
 int i;
 
 for (i = 0; i < 1000; i++) {
-printf("pushing %i\n", i);
+pa_log_debug("pushing %i", i);
 pa_asyncq_push(q, PA_UINT_TO_PTR(i+1), 1);
 }
 
 pa_asyncq_push(q, PA_UINT_TO_PTR(-1), TRUE);
-printf("pushed end\n");
+pa_log_debug("pushed end");
 }
 
 static void consumer(void *_q) {
@@ -59,16 +59,19 @@ static void consumer(void *_q) {
 
 pa_assert(p == PA_UINT_TO_PTR(i+1));
 
-printf("popped %i\n", i);
+pa_log_debug("popped %i", i);
 }
 
-printf("popped end\n");
+pa_log_debug("popped end");
 }
 
 int main(int argc, char *argv[]) {
 pa_asyncq *q;
 pa_thread *t1, *t2;
 
+if (!getenv("MAKE_CHECK"))
+   

[pulseaudio-discuss] [PATCH 2/6] tests: Make sure tests assert on failures and return error status

2011-10-28 Thread Maarten Bosmans
When a test program exits with a nonzero return value (or an assert is hit),
the test is regarded as a FAIL.
This makes `make check` a little more useful.
---
 src/tests/extended-test.c|2 +-
 src/tests/get-binary-name-test.c |4 ++--
 src/tests/interpol-test.c|4 ++--
 src/tests/ipacl-test.c   |   11 +--
 src/tests/memblockq-test.c   |   20 +++-
 src/tests/thread-test.c  |9 -
 6 files changed, 21 insertions(+), 29 deletions(-)

diff --git a/src/tests/extended-test.c b/src/tests/extended-test.c
index 631fdc8..0647aea 100644
--- a/src/tests/extended-test.c
+++ b/src/tests/extended-test.c
@@ -156,7 +156,7 @@ static void context_state_callback(pa_context *c, void 
*userdata) {
 
 int main(int argc, char *argv[]) {
 pa_mainloop* m = NULL;
-int i, ret = 0;
+int i, ret = 1;
 
 for (i = 0; i < SAMPLE_HZ; i++)
 data[i] = (float) sin(((double) i/SAMPLE_HZ)*2*M_PI*SINE_HZ)/2;
diff --git a/src/tests/get-binary-name-test.c b/src/tests/get-binary-name-test.c
index 4afe81b..c35160f 100644
--- a/src/tests/get-binary-name-test.c
+++ b/src/tests/get-binary-name-test.c
@@ -43,12 +43,12 @@ int main(int argc, char *argv[]) {
 if (strlen(exename) < allocated - 1) {
 printf("%s\n", exename);
 pa_xfree(exename);
-break;
+return 0;
 }
 
 pa_xfree(exename);
 allocated *= 2;
 }
 
-return 0;
+return 1;
 }
diff --git a/src/tests/interpol-test.c b/src/tests/interpol-test.c
index ffe4ab3..1a7c4b4 100644
--- a/src/tests/interpol-test.c
+++ b/src/tests/interpol-test.c
@@ -25,13 +25,13 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
 #include 
 #include 
 
+#include 
 #include 
 
 #define INTERPOLATE
@@ -87,7 +87,7 @@ static void stream_latency_cb(pa_stream *p, void *userdata) {
 
 /* This is called whenever the context status changes */
 static void context_state_callback(pa_context *c, void *userdata) {
-assert(c);
+pa_assert(c);
 
 switch (pa_context_get_state(c)) {
 case PA_CONTEXT_CONNECTING:
diff --git a/src/tests/ipacl-test.c b/src/tests/ipacl-test.c
index 7a7267d..74bafd7 100644
--- a/src/tests/ipacl-test.c
+++ b/src/tests/ipacl-test.c
@@ -5,7 +5,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #ifdef HAVE_NETINET_IN_H
@@ -27,12 +26,12 @@ static void do_ip_acl_check(const char *s, int fd, int 
expected) {
 pa_ip_acl *acl;
 int result;
 
-acl = pa_ip_acl_new(s);
-assert(acl);
+pa_assert_se(acl = pa_ip_acl_new(s));
 result = pa_ip_acl_check(acl, fd);
 pa_ip_acl_free(acl);
 
 printf("%-20s result=%u (should be %u)\n", s, result, expected);
+pa_assert(result == expected);
 }
 
 int main(int argc, char *argv[]) {
@@ -44,14 +43,14 @@ int main(int argc, char *argv[]) {
 int r;
 
 fd = socket(PF_INET, SOCK_STREAM, 0);
-assert(fd >= 0);
+pa_assert(fd >= 0);
 
 sa.sin_family = AF_INET;
 sa.sin_port = htons(22);
 sa.sin_addr.s_addr = inet_addr("127.0.0.1");
 
 r = connect(fd, (struct sockaddr*) &sa, sizeof(sa));
-assert(r >= 0);
+pa_assert(r >= 0);
 
 do_ip_acl_check("127.0.0.1", fd, 1);
 do_ip_acl_check("127.0.0.2/0", fd, 1);
@@ -76,7 +75,7 @@ int main(int argc, char *argv[]) {
 pa_assert_se(inet_pton(AF_INET6, "::1", &sa6.sin6_addr) == 1);
 
 r = connect(fd, (struct sockaddr*) &sa6, sizeof(sa6));
-assert(r >= 0);
+pa_assert(r >= 0);
 
 do_ip_acl_check("::1", fd, 1);
 do_ip_acl_check("::1/9", fd, 1);
diff --git a/src/tests/memblockq-test.c b/src/tests/memblockq-test.c
index 085d70e..09d2142 100644
--- a/src/tests/memblockq-test.c
+++ b/src/tests/memblockq-test.c
@@ -22,12 +22,12 @@
 #endif
 
 #include 
-#include 
 #include 
 #include 
 
 #include 
 #include 
+#include 
 
 static void dump_chunk(const pa_memchunk *chunk) {
 size_t n;
@@ -86,33 +86,27 @@ int main(int argc, char *argv[]) {
 
 p = pa_mempool_new(FALSE, 0);
 
-silence.memblock = pa_memblock_new_fixed(p, (char*) "__", 2, 1);
-assert(silence.memblock);
+pa_assert_se(silence.memblock = pa_memblock_new_fixed(p, (char*) "__", 2, 
1));
 silence.index = 0;
 silence.length = pa_memblock_get_length(silence.memblock);
 
-bq = pa_memblockq_new("test memblockq", 0, 200, 10, &ss, 4, 4, 40, 
&silence);
-assert(bq);
+pa_assert_se(bq = pa_memblockq_new("test memblockq", 0, 200, 10, &ss, 4, 
4, 40, &silence));
 
-chunk1.memblock = pa_memblock_new_fixed(p, (char*) "11", 2, 1);
+pa_assert_se(chunk1.memblock = pa_memblock_new_fixed(p, (char*) "11", 2, 
1));
 chunk1.index = 0;
 chunk1.length = 2;
-assert(chunk1.memblock);
 
-chunk2.memblock = pa_memblock_new_fixed(p, (char*) "XX22", 4, 1);
+pa_assert_se(chunk2.memblock = pa_memblock_new_fixed(p, (char*) "XX22", 4, 
1));
 chunk2.index = 2;
 chunk2.length = 2;
-assert(chunk2.memblock);
 
-chunk3.memblock = pa_memb

[pulseaudio-discuss] [PATCH 1/6] tests: refactor ipacl-test

2011-10-28 Thread Maarten Bosmans
Common test code is moved to a separate function.
---
 src/tests/ipacl-test.c |   95 +---
 1 files changed, 26 insertions(+), 69 deletions(-)

diff --git a/src/tests/ipacl-test.c b/src/tests/ipacl-test.c
index be9caad..7a7267d 100644
--- a/src/tests/ipacl-test.c
+++ b/src/tests/ipacl-test.c
@@ -23,6 +23,18 @@
 #include 
 #include 
 
+static void do_ip_acl_check(const char *s, int fd, int expected) {
+pa_ip_acl *acl;
+int result;
+
+acl = pa_ip_acl_new(s);
+assert(acl);
+result = pa_ip_acl_check(acl, fd);
+pa_ip_acl_free(acl);
+
+printf("%-20s result=%u (should be %u)\n", s, result, expected);
+}
+
 int main(int argc, char *argv[]) {
 struct sockaddr_in sa;
 #ifdef HAVE_IPV6
@@ -30,7 +42,6 @@ int main(int argc, char *argv[]) {
 #endif
 int fd;
 int r;
-pa_ip_acl *acl;
 
 fd = socket(PF_INET, SOCK_STREAM, 0);
 assert(fd >= 0);
@@ -42,45 +53,14 @@ int main(int argc, char *argv[]) {
 r = connect(fd, (struct sockaddr*) &sa, sizeof(sa));
 assert(r >= 0);
 
-acl = pa_ip_acl_new("127.0.0.1");
-assert(acl);
-printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
-pa_ip_acl_free(acl);
-
-acl = pa_ip_acl_new("127.0.0.2/0");
-assert(acl);
-printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
-pa_ip_acl_free(acl);
-
-acl = pa_ip_acl_new("127.0.0.1/32");
-assert(acl);
-printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
-pa_ip_acl_free(acl);
-
-acl = pa_ip_acl_new("127.0.0.1/7");
-assert(acl);
-printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
-pa_ip_acl_free(acl);
-
-acl = pa_ip_acl_new("127.0.0.2");
-assert(acl);
-printf("result=%u (should be 0)\n", pa_ip_acl_check(acl, fd));
-pa_ip_acl_free(acl);
-
-acl = pa_ip_acl_new("127.0.0.0/8;0.0.0.0/32");
-assert(acl);
-printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
-pa_ip_acl_free(acl);
-
-acl = pa_ip_acl_new("128.0.0.2/9");
-assert(acl);
-printf("result=%u (should be 0)\n", pa_ip_acl_check(acl, fd));
-pa_ip_acl_free(acl);
-
-acl = pa_ip_acl_new("::1/9");
-assert(acl);
-printf("result=%u (should be 0)\n", pa_ip_acl_check(acl, fd));
-pa_ip_acl_free(acl);
+do_ip_acl_check("127.0.0.1", fd, 1);
+do_ip_acl_check("127.0.0.2/0", fd, 1);
+do_ip_acl_check("127.0.0.1/32", fd, 1);
+do_ip_acl_check("127.0.0.1/7", fd, 1);
+do_ip_acl_check("127.0.0.2", fd, 0);
+do_ip_acl_check("127.0.0.0/8;0.0.0.0/32", fd, 1);
+do_ip_acl_check("128.0.0.2/9", fd, 0);
+do_ip_acl_check("::1/9", fd, 0);
 
 close(fd);
 
@@ -98,35 +78,12 @@ int main(int argc, char *argv[]) {
 r = connect(fd, (struct sockaddr*) &sa6, sizeof(sa6));
 assert(r >= 0);
 
-acl = pa_ip_acl_new("::1");
-assert(acl);
-printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
-pa_ip_acl_free(acl);
-
-acl = pa_ip_acl_new("::1/9");
-assert(acl);
-printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
-pa_ip_acl_free(acl);
-
-acl = pa_ip_acl_new("::/0");
-assert(acl);
-printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
-pa_ip_acl_free(acl);
-
-acl = pa_ip_acl_new("::2/128");
-assert(acl);
-printf("result=%u (should be 0)\n", pa_ip_acl_check(acl, fd));
-pa_ip_acl_free(acl);
-
-acl = pa_ip_acl_new("::2/127");
-assert(acl);
-printf("result=%u (should be 0)\n", pa_ip_acl_check(acl, fd));
-pa_ip_acl_free(acl);
-
-acl = pa_ip_acl_new("::2/126");
-assert(acl);
-printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
-pa_ip_acl_free(acl);
+do_ip_acl_check("::1", fd, 1);
+do_ip_acl_check("::1/9", fd, 1);
+do_ip_acl_check("::/0", fd, 1);
+do_ip_acl_check("::2/128", fd, 0);
+do_ip_acl_check("::2/127", fd, 0);
+do_ip_acl_check("::2/126", fd, 1);
 
 close(fd);
 #endif
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] Revised patch set for `make check`

2011-10-28 Thread Maarten Bosmans
The branch can also be reviewed from
https://github.com/mkbosmans/pulseaudio/compare/master...make-check

Merge make-check branch from git://github.com/mkbosmans/pulseaudio.git

I addressed Arun's comments, except for:
[PATCH] tests: Reduce time needed for a make check
  "I'm happier with the old values for most tests, is running tests really 
slowing us down?"

The patch reduces the testsuite run time from 100 to about 55 seconds.  
Because I'm fine with the patch included or not, (or even just the parts you 
like)
I moved it to the end of the series, so you can easily skip merging the patch.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 5/6] cli: Show card ports and jack detection status

2011-10-28 Thread Maarten Bosmans
2011/10/27 David Henningsson :
> Expose the new stuff through pacmd.

Can you also make it available in the pactl output?

> Signed-off-by: David Henningsson 
> ---
>  src/pulsecore/cli-text.c |   48 +
>  1 files changed, 31 insertions(+), 17 deletions(-)
>
> diff --git a/src/pulsecore/cli-text.c b/src/pulsecore/cli-text.c
> index 5498744..2253635 100644
> --- a/src/pulsecore/cli-text.c
> +++ b/src/pulsecore/cli-text.c
> @@ -102,6 +102,33 @@ char *pa_client_list_to_string(pa_core *c) {
>     return pa_strbuf_tostring_free(s);
>  }
>
> +static const char *port_available_to_string(pa_port_available_t a) {
> +    switch (a) {
> +        case PA_PORT_AVAILABLE_UNKNOWN:
> +            return "unknown";
> +        case PA_PORT_AVAILABLE_NO:
> +            return "no";
> +        case PA_PORT_AVAILABLE_YES:
> +            return "yes";
> +        default:
> +            return "invalid"; /* Should never happen! */

In general we use pa_assert_not_reached(). If that's applicable here
too, then the comment is not necessary anymore.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] old module-loopback, without source= and sync=

2011-10-26 Thread Maarten Bosmans
2011/10/26 Richard Henwood :
> hi all,
>
> I've coded an app [1] that assumes
>
> pactl load-module module-loopback source=%s sink=%s
>
> On versions of Linux where PA is older (not supporting source= and sink=), is 
> there a substitution available on the command line?
> cheers,

The source and sink arguments were there from the beginning of module-loopback.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Any way to get PA to wake up less when playing low latency?

2011-10-24 Thread Maarten Bosmans
2011/10/25 Dylan Reid :
> I'm playing audio with a latency of 10ms.  This is working pretty well, but
> it is eating a lot of CPU

Is it just due to the constant waking up and cocntext switching, or do
some other functions light up on a profile run?

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] python binding

2011-10-24 Thread Maarten Bosmans
2011/10/25 zw g :
> Dear List,
>
> Newbie here.
> Is there any python binding library of PulseAudio?

I'm not sure, but there is a mixer program based on Python, so perhaps
you can look how that is done.
https://github.com/Valodim/pamixer

> If there is, anyone help me out, i would like to use it since i want to
> write a music player which might send different sounds to different physical
> channels of the sound card.

There probably are generic methods for playing audio in python. If you
use those, your program will probably be more cross-platform.

Maarten

> Thanks in advance.
>
> B.R.
> Gui
>
> ___
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>
>
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [RFC PATCH] softvolume: implement fast volume translation

2011-10-20 Thread Maarten Bosmans
2011/10/20 Arun Raghavan :
> On Tue, 2011-10-18 at 17:09 -0400, Wang Xingchao wrote:
>> if all channels have same volume setting, use fast way to
>> do volume change. this patch intended to work for two formats:
>> s16ne/s16re.
>>
>> Signed-off-by: Wang Xingchao 
>> ---
>
> As Tanu points out, some hard data here would be good. But just to set
> your expectations correctly, this code is actually not used on any
> recent x86 or ARM machine since there are optimised routines for these.
> I'm certainly not against optimisations to these paths, since
> there /are/ other architectures that PA runs on.

That's only for s16. And actually that exact same optimisation
(treating the stream as mono if all channel volumes are equal) could
also work for the assembly functions, just as I had already added it
to the Orc functions in my orcify branch.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [RFC PATCH] softvolume: implement fast volume translation

2011-10-20 Thread Maarten Bosmans
2011/10/20 Arun Raghavan :
> On Tue, 2011-10-18 at 12:10 +0200, Maarten Bosmans wrote:
>> > 2011/10/18 Wang Xingchao :
>> >> if all channels have same volume setting, use fast way to
>> >> do volume change. this patch intended to work for two formats:
>> >> s16ne/s16re.
> [...]
>> The Orc svolume implementation currently only handles 1ch s16ne (the
>> orcify branch also adds 1ch float), so I added a similar test for
>> identical channel volumes for the Orc case:
>> https://github.com/mkbosmans/pulseaudio/commit/8659d08f22ccaba0c1ca18c0b29744318bf4fe08
>> I like that way (only using one extra variable) a bit better than
>> yours (with both same_vol and fast_vol added), but that is not really
>> important.
>
> Were you referring to the code in master? That handles both 1ch and 2ch.

Indeed, you're right, that's just me typing in stuff from memory
without looking it up.
Although the distinction I was trying to make was between s16 and float.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] fix two warnings in utils/padsp.c

2011-10-20 Thread Maarten Bosmans
2011/10/20 Arun Raghavan :
> On Tue, 2011-10-18 at 14:48 +0800, Lu Guanqun wrote:
>> CC     libpulsedsp_la-padsp.lo
>> utils/padsp.c:1524:5: warning: no previous prototype for '__open_2' 
>> [-Wmissing-prototypes]
>> utils/padsp.c:2560:5: warning: no previous prototype for '__open64_2' 
>> [-Wmissing-prototypes]
>> ---
>>  src/utils/padsp.c |    3 +++
>>  1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/utils/padsp.c b/src/utils/padsp.c
>> index a8bc8d2..414ebe4 100644
>> --- a/src/utils/padsp.c
>> +++ b/src/utils/padsp.c
>> @@ -64,6 +64,9 @@
>>  #undef open
>>  #undef open64
>>
>> +int __open_2(const char *filename, int flags);
>> +int __open64_2(const char *filename, int flags);
>> +
>
> These two are defined a little later from where you've added them. Is
> this really present in master?

I also see these warnings from time to time, but not always. IIRC also
in master. But I haven't really been able to pinpoint exactly where
the problem lies. Until that time, I don't think just adding these is
a solution.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] Remove time-smoother and shm from libpulsecore

2011-10-20 Thread Maarten Bosmans
2011/10/20 Arun Raghavan :
> On Wed, 2011-10-19 at 14:10 +0200, Maarten Bosmans wrote:
>> As they are already included in libpulsecommon.
>> ---
>
> AFAICT, time-smoother.h is used in libpulse (pa_stream_get_time), but
> shm.h is not, so shouldn't be in pulsecommon.

But shm.h is used in pulsecore/memblock.c, which is in libpulsecommon,
so it should also be.
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] PulseAudio support on Solaris

2011-10-19 Thread Maarten Bosmans
2011/10/19 Brian Cameron :
> The issue seems to be caused by the fact that libpulsecommon includes
> pulsecore/pstream.c, which includes pulsecore/core-scache.h to gain access
> to the PA_SCACHE_ENTRY_SIZE_MAX #define.
>
> Moving this #define so it is in pulsecore/memchunk.h (a header already
> associated with libpulsecommon and also included by pulsecore/scache.h) and
> fixing pstream.c to include memchunk.h fixes this issue.

Thanks for trying this workaround and confirming that this is indeed
the problem.
(core-cache.h includes core.h, sink.h and others, which define objects
using PA_DECLARE_PUBLIC_CLASS, that cause trouble when not linked in.
I'm wondering why this is no problem on Linux)

> I am not sure if this is the best way to fix this issue.  If the PulseAudio
> maintainers want to rearrange the header files in some other way to avoid
> the libpulsecommon pstream.c file needing to include
> pulsecore/core-scache.h, that is obviously okay.

Did you check that other users of PA_SCACHE_ENTRY_SIZE_MAX can find
the macro in the new location?

The problem with the workaround is obviously that something about the
scache does not belong in memchunk.h conceptually.

> I also notice that src/Makefile needs to be updated so connect_stress links
> with libpulsecore, so this is also fixed in this patch.

This needs to go in a separate patch.

> This patch is pretty simple, and it makes PulseAudio link properly on
> Solaris so libpulsecore does not need to be linked into libpulsecommon.  Can
> this go upstream?
>
> I updated the bug with the patch and the above comment:

In general, either the ML or bugzilla is fine.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] alsa-mixer: Take channel mask of volume element into account when finding a subset path

2011-10-19 Thread Maarten Bosmans
The patch looks simple, but I'm not entirely sure the concept is
sound. Please review.

The problem I'm trying to solve is that analog-output-mono is (in my
view incorrectly) seen as a subset of analog-output-lfe-on-mono.
Relevant debug output:

D: [lt-pulseaudio] alsa-mixer.c: Path analog-output-mono (Analoge
mono-uitvoer), direction=1, priority=50, probed=yes, supported=yes,
has_mute=yes, has_volume=yes, has_dB=yes, min_volume=0, max_volume=31,
min_dB=-81, max_dB=12
D: [lt-pulseaudio] alsa-mixer.c: Element Master, direction=1,
switch=2, volume=2, volume_limit=-1, enumeration=0, required=0,
required_any=0, required_absent=0, mask=0x6, n_channels=2,
override_map=no
D: [lt-pulseaudio] alsa-mixer.c: Element Master Mono, direction=1,
switch=1, volume=1, volume_limit=-1, enumeration=0, required=4,
required_any=0, required_absent=0, mask=0x7, n_channels=1,
override_map=yes
D: [lt-pulseaudio] alsa-mixer.c: Element PCM, direction=1, switch=1,
volume=1, volume_limit=-1, enumeration=0, required=0, required_any=0,
required_absent=0, mask=0x36f66, n_channels=2,
override_map=yes

D: [lt-pulseaudio] alsa-mixer.c: Path analog-output-lfe-on-mono
(Analoge output (LFE)), direction=1, priority=40, probed=yes,
supported=yes, has_mute=yes, has_volume=yes, has_dB=yes, min_volume=0,
max_volume=31, min_dB=-81, max_dB=12
D: [lt-pulseaudio] alsa-mixer.c: Element Master, direction=1,
switch=1, volume=1, volume_limit=-1, enumeration=0, required=0,
required_any=0, required_absent=0, mask=0x36f66, n_channels=2,
override_map=yes
D: [lt-pulseaudio] alsa-mixer.c: Element Master Mono, direction=1,
switch=1, volume=1, volume_limit=-1, enumeration=0, required=4,
required_any=0, required_absent=0, mask=0x80, n_channels=1,
override_map=yes
D: [lt-pulseaudio] alsa-mixer.c: Element PCM, direction=1, switch=1,
volume=1, volume_limit=-1, enumeration=0, required=0, required_any=0,
required_absent=0, mask=0x36f66, n_channels=2,
override_map=yes

D: [lt-pulseaudio] alsa-mixer.c: Removing path 'analog-output-mono' as
it is a subset of 'analog-output-lfe-on-mono'.

Is it correct to think that analog-output-mono should not be a subset
of analog-output-lfe-on-mono? If it is, the patch fixes this.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH] alsa-mixer: Take channel mask of volume element into account when finding a subset path

2011-10-19 Thread Maarten Bosmans
---
 src/modules/alsa/alsa-mixer.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 3f27fdc..f390119 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -2956,6 +2956,10 @@ static pa_bool_t element_is_subset(pa_alsa_element *a, 
pa_alsa_element *b, snd_m
 /* Check the volume_use */
 if (a->volume_use != PA_ALSA_VOLUME_IGNORE) {
 
+/* If b cannot control at least the channels of a, a is not a subset 
of b */
+if (a->merged_mask & ~b->merged_mask)
+  return FALSE;
+
 /* "Constant" is subset of "Constant" only when their constant values 
are equal */
 if (a->volume_use == PA_ALSA_VOLUME_CONSTANT && b->volume_use == 
PA_ALSA_VOLUME_CONSTANT && a->constant_volume != b->constant_volume)
 return FALSE;
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] PulseAudio support on Solaris

2011-10-19 Thread Maarten Bosmans
2011/10/17 Brian Cameron :
> I found this issue when I try to build PA clients.  For example, when
> PulseAudio tries to build pactl, I see these errors.  I see similar
> errors trying to build any PA client:
>
> Undefined                       first referenced
>  symbol                             in file
> pa_object_unref
> /home/brianca/packages/BUILD/SUNWpulseaudio-1.0/amd64/pulseaudio-1.0/src/.libs/libpulsecommon-1.0.so
> pa_sink_input_type_id
> /home/brianca/packages/BUILD/SUNWpulseaudio-1.0/amd64/pulseaudio-1.0/src/.libs/libpulsecommon-1.0.so
> pa_object_type_id
> /home/brianca/packages/BUILD/SUNWpulseaudio-1.0/amd64/pulseaudio-1.0/src/.libs/libpulsecommon-1.0.so
> pa_msgobject_type_id
> /home/brianca/packages/BUILD/SUNWpulseaudio-1.0/amd64/pulseaudio-1.0/src/.libs/libpulsecommon-1.0.so
> pa_source_output_type_id
> /home/brianca/packages/BUILD/SUNWpulseaudio-1.0/amd64/pulseaudio-1.0/src/.libs/libpulsecommon-1.0.so
> pa_object_ref
> /home/brianca/packages/BUILD/SUNWpulseaudio-1.0/amd64/pulseaudio-1.0/src/.libs/libpulsecommon-1.0.so
> pa_sink_type_id
> /home/brianca/packages/BUILD/SUNWpulseaudio-1.0/amd64/pulseaudio-1.0/src/.libs/libpulsecommon-1.0.so
> pa_source_type_id
> /home/brianca/packages/BUILD/SUNWpulseaudio-1.0/amd64/pulseaudio-1.0/src/.libs/libpulsecommon-1.0.so
> pa_core_type_id
> /home/brianca/packages/BUILD/SUNWpulseaudio-1.0/amd64/pulseaudio-1.0/src/.libs/libpulsecommon-1.0.so
> ld: fatal: symbol referencing errors. No output written to .libs/pacat
>
> I found that using the attached patch which causes PA clients to link
> against libpulsecore fixes this problem.  Now that I am looking at this
> more closely, I suspect the problem is that PA clients are including
> header files that define functions that are not included in the clients.
>
> Since the Solaris linker does not support lazy linking and requires all
> symbols to be resolved at link time, this causes a problem.  Perhaps
> this is not an issue on Linux because these functions are unused by
> clients and the linker does not care if the symbols are not resolved?
>
> At any rate, if people have any suggestions about how the code could
> be modified to avoid this problem, then that would be much appreciated.

I think I found the source of the problem.
Some source files from libpulse or libpulsecommon include header files
from libpulsecore.

pulse/volume.c -> pulsecore/sample-util.h
pulse/channelmap.c -> pulsecore/sample-util.h
pulsecore/core-util.c -> pulsecore/cpu-x86.h
pulsecore/pstream.c -> pulsecore/core-scache.h

This is not how it supposed to be, but as they only use macros from
those headers and no typedefs, functions, etc. it is sorta OK.
Apparantly somehow Solaris gets upset by this and Linux does not.

Brian, can you verify my assumption by compiling pulseaudio without
your patches, but with the mentioned includes disabled? (and the
necessary #defines copied from the header files to the source files)

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH] Remove time-smoother and shm from libpulsecore

2011-10-19 Thread Maarten Bosmans
As they are already included in libpulsecommon.
---
 src/Makefile.am |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index c0841b4..d8270ea 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -814,7 +814,6 @@ libpulsecore_@PA_MAJORMINOR@_la_SOURCES = \
pulsecore/sconv_sse.c \
pulsecore/sconv.c pulsecore/sconv.h \
pulsecore/shared.c pulsecore/shared.h \
-   pulsecore/shm.c pulsecore/shm.h \
pulsecore/sink-input.c pulsecore/sink-input.h \
pulsecore/sink.c pulsecore/sink.h \
pulsecore/sioman.c pulsecore/sioman.h \
@@ -824,7 +823,6 @@ libpulsecore_@PA_MAJORMINOR@_la_SOURCES = \
pulsecore/source.c pulsecore/source.h \
pulsecore/start-child.c pulsecore/start-child.h \
pulsecore/thread-mq.c pulsecore/thread-mq.h \
-   pulsecore/time-smoother.c pulsecore/time-smoother.h \
pulsecore/database.h
 
 libpulsecore_@PA_MAJORMINOR@_la_CFLAGS = $(AM_CFLAGS) $(SERVER_CFLAGS) 
$(LIBSAMPLERATE_CFLAGS) $(LIBSPEEX_CFLAGS) $(LIBSNDFILE_CFLAGS) 
$(WINSOCK_CFLAGS)
-- 
1.7.4.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [RFC PATCH] softvolume: implement fast volume translation

2011-10-19 Thread Maarten Bosmans
2011/10/19 Wang Xingchao :
> hi,
>
> I got not stable results, which means the optimization is not as good
> as expected.
> All results based on plain c volume function, not touch sse part.

It's good to test your optimizations. Be sure to also test with
various lengths of the memblock (1021 below). In realworld usage, I
saw numbers like 4, 1021, 2.

Also don't make assumptions on what method is faster. For example in the line
if (PA_UNLIKELY(++channel >= channels))
in the exisiting svolume code, it actually is a performance
improvement to remove the PA_UNLIKELY. That's just to show that the
original author probably didn't test this.

> All tests are for format s16ne.
>
> Result1: channels 4, with same volume, with patch; samples 1021, loop 1000;
> Result2: channels 4, with same volume, without patch; samples 1021, loop 1000;
> Result1: channels 4, with different volumes; samples 1021, loop 1000;

> Attached the raw patch for the test. As Maarten had done some work, i
> decide to check them first.

Why do do you two channels at the same time? Won't that cause problems
when the number of samples that is being processed isn't even? The
test case in the commit I linked to earlier should have caught this.
It might also be faster to treat the samples just as a mono stream.

I like the for(;length;length--) approach better than introducing a
separate counter i.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [RFC PATCH] softvolume: implement fast volume translation

2011-10-19 Thread Maarten Bosmans
2011/10/19 Lu Guanqun :
> Hi Maarten,
>
> Thanks for your nice work, I'll take a look.
>
> According to my test here, it seems soft volume processing doesn't cost
> CPU usage too much, instead, it's the resampling that takes much CPU
> usage. e.g. one sink input, resampler of speex-float-3 is used, the
> general CPU usage is about 4%, when resampler of 'copy' is used (of
> course, in this case, the same format of sink input and sink should
> match), it drops to less than 1%.
>
> So should we optimize resampler a little harder?

Sure, resampling is by far the most CPU intensive thing pulse does.
That's why we have the choice of such a large array of algorithms, so
that the user can pick the one that fits his CPU/quality tradeoff
best.

In general you can assume than these resamplers are already as
optimized as possible. Especially for our default speex resampler, I
don't expect there's a lot to gain. But if you'd like you could work
with that project to see if there are improvements possible. Last week
I sent some patches to speed up the trivial resampler, but that is
more of a toy-resampler, so not that important.

If optimizing the resampling algorithms is hard, the easiest solution
is to minimize the amount of resampling we do. Pierre's patches that
just got merged are a good example of this.

Only without resampling (the copy-resampler, which should be more
aptly names noop-resampler, because no copying is done) the CPU usage
of the other stuff (svolume, sconv, channel remap, mixing) comes on
the radar.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Pulse and audio settings

2011-10-19 Thread Maarten Bosmans
2011/10/19 Robert Orzanna :
> Hello,
> With the new version of pulse (1.0-4) I hoped that pulse will somehow take
> care of my alsa settings which still is not the case.
> All settings, for example set with alsamixer, are discarded after reboot.

Indeed, pulse takes over the volume control. This is by design, so
there's no point in hoping a new version of pulse will 'fix' this.

PulseAudio saves the volumes and reapplies for new audio streams.
Messing with volumes in the lower alsa layer directly is not advised.
If you change volumes in pavucontrol or the gnome volume control,
you'll see that they are preserved after reboot.

> Now I wonder what's the best way to define some settings such as mic and PCM
> level with pulse when pavucontrol does not offer such possibilities?

Why would you want to adjust these settings outside of pulseaudio and
in what way do the sliders in pavucontrol not suffice?

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [RFC PATCH] softvolume: implement fast volume translation

2011-10-18 Thread Maarten Bosmans
> 2011/10/18 Wang Xingchao :
>> if all channels have same volume setting, use fast way to
>> do volume change. this patch intended to work for two formats:
>> s16ne/s16re.

I did some work to optimize svolume already, see my branch on github:
https://github.com/mkbosmans/pulseaudio/compare/master...orcify

After a few pending patches that I have already sent to the list are
pulled, I plan to submit this branch in parts. (the branch needs to be
rebased after the pending patches are committed)

For testing correctness of your volume implementation (and
performance, as Tanu suggested) you can use the svolume-test program
added in this commit:
https://github.com/mkbosmans/pulseaudio/commit/cf0c5c9ad47ba0434b0518ca79ca802d0e62153a

The Orc svolume implementation currently only handles 1ch s16ne (the
orcify branch also adds 1ch float), so I added a similar test for
identical channel volumes for the Orc case:
https://github.com/mkbosmans/pulseaudio/commit/8659d08f22ccaba0c1ca18c0b29744318bf4fe08
I like that way (only using one extra variable) a bit better than
yours (with both same_vol and fast_vol added), but that is not really
important.

2011/10/18 Wang Xingchao :
> Hi all,
>
> I didnot touch much formats optermization, only for most used
> s16nr/re, please help review whether the idea is acceptable. If so, i
> will take the responsbility for all formats.

I'd say only float32ne is another candidate.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] PulseAudio support on Solaris

2011-10-18 Thread Maarten Bosmans
2011/10/17 Brian Cameron :
> I found this issue when I try to build PA clients.  For example, when
> PulseAudio tries to build pactl, I see these errors.  I see similar
> errors trying to build any PA client:
>
> Undefined                       first referenced
>  symbol                             in file
> pa_object_unref
> /home/brianca/packages/BUILD/SUNWpulseaudio-1.0/amd64/pulseaudio-1.0/src/.libs/libpulsecommon-1.0.so
> pa_sink_input_type_id
> /home/brianca/packages/BUILD/SUNWpulseaudio-1.0/amd64/pulseaudio-1.0/src/.libs/libpulsecommon-1.0.so
> pa_object_type_id
> /home/brianca/packages/BUILD/SUNWpulseaudio-1.0/amd64/pulseaudio-1.0/src/.libs/libpulsecommon-1.0.so
> pa_msgobject_type_id
> /home/brianca/packages/BUILD/SUNWpulseaudio-1.0/amd64/pulseaudio-1.0/src/.libs/libpulsecommon-1.0.so
> pa_source_output_type_id
> /home/brianca/packages/BUILD/SUNWpulseaudio-1.0/amd64/pulseaudio-1.0/src/.libs/libpulsecommon-1.0.so
> pa_object_ref
> /home/brianca/packages/BUILD/SUNWpulseaudio-1.0/amd64/pulseaudio-1.0/src/.libs/libpulsecommon-1.0.so
> pa_sink_type_id
> /home/brianca/packages/BUILD/SUNWpulseaudio-1.0/amd64/pulseaudio-1.0/src/.libs/libpulsecommon-1.0.so
> pa_source_type_id
> /home/brianca/packages/BUILD/SUNWpulseaudio-1.0/amd64/pulseaudio-1.0/src/.libs/libpulsecommon-1.0.so
> pa_core_type_id
> /home/brianca/packages/BUILD/SUNWpulseaudio-1.0/amd64/pulseaudio-1.0/src/.libs/libpulsecommon-1.0.so
> ld: fatal: symbol referencing errors. No output written to .libs/pacat
>
> I found that using the attached patch which causes PA clients to link
> against libpulsecore fixes this problem.  Now that I am looking at this
> more closely, I suspect the problem is that PA clients are including
> header files that define functions that are not included in the clients.

I audited the utils and tests and the following programs where your
patch adds libpulsecore only use functionality from libpulse and
libpulsecommon:
pacat, pactl, pasuspender, pacmd, pax11publish, mainloop-test, voltest
libpulsecore should not be added for these, because they don't use
functionality from that library. Your output log from above suggests
that something in libpulsecommon uses functionality from
pulsecore/object.[ch], so those files should probably be moved to from
libpulsecore to libpulsecommon. Does that fix linking on Solaris?

The rest of the utils only use public libpulse headers, so for these
libpulsecommon should even be removed from the linker line.
get-binary-name, pacat-simple, parec-simple, extended-test,
channelmap-test, sync-playback, gtk-test, connect-stress

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] PulseAudio support on Solaris

2011-10-17 Thread Maarten Bosmans
2011/10/17 Brian Cameron :
>> (And yupp, here too this sounds like a bug if clients ever end up
>> linking against libpulsecore. That library is not API stable, and things
>> will end in desaster if this happens).
>
> Now that I am looking at this more closely, I suspect that my attached
> patch to address the above linking issue is wrong, and I need to find a
> better way to get clients to link properly without linking in
> libpulsecore.

Lennart meant 3rd party applications that use libpulse to access
PulseAudio functionality.
The clients in the pulse tree (src/utils and src/tests) are can link
against libpulsecore, if needed. They are special because if the API
of pulsecore changes, those will also be changed to match.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Rename Sink

2011-10-17 Thread Maarten Bosmans
Note: please do not hijack threads and please use inline reply instead
of top posting, as now it is not really clear what part of which
message you're replying to.

2011/10/17 Chris :
> Oh hey, this may answer my question from a few days ago.
>
> So I want a sink/source single device so I can dump output from one
> app and attach another as input...this line from the wiki...is this
> the right type?  Basically a patch cable is what I want.

This was already answered, right? Use module-null-sink.

> add-autoload-sink combined module-combine master=output slaves=output2
> sink_name=combined

autoload-sink is deprecated, IIRC. Just use load-module.

Read the Modules page on the wiki. master argument of module-combine
is deprecated (so is module-combine, use module-combine-sink)

> I just name it 'virtual cable' and the apps if pulseaudio aware would
> see it in their choices for inputs and outputs I'm assuming?

Indeed.

> Sorry for being dense, I somehow didn't realize the commands
> 'add-autoload-sink' etc were just passed to pulseaudio on the command
> line.

Yeah, the syntax of default.pa is just a bunch of commands of the CLI protocol.

Maarten


> On Mon, Oct 17, 2011 at 7:43 AM, Maarten Bosmans  wrote:
>>
>> 2011/10/12 Cyrus Vafadari :
>> > Is there a way to rename a sink?
>> > i.e., I want the pacmd list-sinks to return "name: " instead of
>> > "name:
>> > "
>> > card: 2
>> > 
>> > device.bus_path = "pci-:00:1d.0-usb-0:2:1.0"
>> > sysfs.path = 
>> > "/devices/pci:00/:00:1d.0/usb5/5-2/5-2:1.0/sound/card1"
>>
>> I don't think it is possible to change a sink name. module-udev-detect
>> sets this. If you want to set the sink name, you should load
>> module-alsa-sink manually. This is not advised though.
>>
>> A better solution would be to set the device.description property, see
>> http://pulseaudio.org/wiki/CLI
>> This string is shown in most UIs for the sink.
>>
>> Maarten
>> ___
>> pulseaudio-discuss mailing list
>> pulseaudio-discuss@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>
>
>
> --
> 73      de     Chris       KC2RGW
> ---
> ˙dn ǝpıs ʇɥƃıɹ ɹoʇıuoɯ ɹnoʎ uɹnʇ
> ǝsɐǝןd 'sıɥʇ ƃuıpɐǝɹ ǝɹɐ noʎ ɟı
> ___
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Rename Sink

2011-10-17 Thread Maarten Bosmans
2011/10/12 Cyrus Vafadari :
> Is there a way to rename a sink?
> i.e., I want the pacmd list-sinks to return "name: " instead of
> "name:
> "
> card: 2
> 
> device.bus_path = "pci-:00:1d.0-usb-0:2:1.0"
> sysfs.path = "/devices/pci:00/:00:1d.0/usb5/5-2/5-2:1.0/sound/card1"

I don't think it is possible to change a sink name. module-udev-detect
sets this. If you want to set the sink name, you should load
module-alsa-sink manually. This is not advised though.

A better solution would be to set the device.description property, see
http://pulseaudio.org/wiki/CLI
This string is shown in most UIs for the sink.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] PulseAudio LICENSE file is wrong or misleading about GPL/LGPL

2011-10-17 Thread Maarten Bosmans
2011/10/17 Arun Raghavan :
> On Sun, 2011-10-16 at 15:07 -0500, Brian Cameron wrote:
>> Maarten:
>>
>> > Do I conclude correctly from the bug that in pulse 1.0 it isn't true
>> > anymore that the library dependencies are:
>> > libpulse ->  libpulsecommon
>> > libpulsecore ->  libpulsecommon
>>
>> I am not familiar enough with PulseAudio to be able to describe the
>> library dependencies.  I just know that programs which use libpulse
>> fail to compile unless you link in libpulsecore.  It seems that
>> libpulse or libpulsecommon uses symbols in libpulsecore.
>
> At least on my system, this is not the case:
>
> $ readelf -d /usr/lib/libpulse.so | grep pulse
>  0x0001 (NEEDED)             Shared library: 
> [libpulsecommon-1.98.so]
>  0x000e (SONAME)             Library soname: [libpulse.so.0]
>
> readelf -d /usr/lib/libpulsecommon-1.98.so | grep pulse
>  0x000e (SONAME)             Library soname: 
> [libpulsecommon-1.98.so]

Right, good to know that the library setup is still sane.

> Are you sure this isn't some Solaris linker weirdness?
>
>> > I do remember some stuff about circular dependencies. But as only
>> > libpulsecore links to libsamplerate, the above dependency chain would
>> > be the best to have, because libpulse is always LGPL, regardless of
>> > pulse is build with libsamplerate support.
>>
>> I think it may be ambiguous if libpulse is LGPL if it links in
>> libpulsecore built with GPL libsamplerate.
>
> It does not, *but*, I see one bug that I've fixed now [1] -- during a
> Makefile.am cleanup, a bunch of extra dependencies got added to
> libpulsecommon, including libsamplerate. This will get fixed in the next
> release which shouldn't be too far away.
>
> [1]: 
> http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=bb4b8f896e63559df2b53617ff205d8a4024178c

Erm, yes, sorry about that mistake. Thanks for spotting that, Arun!

And of course, during the time we had this bug unfixed, the LICENSING
file really was wrong about libpulse not linking against
libsamplerate.

> [...]
>> > And I'm a bit confused about why you would
>> > have a GPL library installed, but don't want pulse to use it in order
>> > to keep it LGPL. (and of course for these kind of use cases you can
>> > easily override the autodetection)
>>
>> To me, it seems more "safe" to avoid linking a GPL library into a
>> LGPL program by default.  This is the sort of licensing concern that
>> would be better for people to make a conscious decision about rather
>> than having a configure script make a decision for you.  Personally I
>> think this is especially a concern if the LICENSING file is not
>> well maintained, or contains incorrect or misleading information.
>
> It is well-maintained, insofar that when things with different licenses
> are pulled in, the file is updated. I'm assuming that people who care
> keen about the GPL/LGPL division would also be careful about how the PA
> server is compiled. I'm not completely against making libsamplerate an
> off-by-default choice if others feel this is more prudent, though.

With your Makefile.am fix there shouldn't be a problem with using
libsamplerate automatically if it is available, because the GPLness is
contained at the daemon and not leaked anymore to the client library.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] PulseAudio 1.0 GConf module cannot build on Solaris

2011-10-16 Thread Maarten Bosmans
2011/10/15 Brian Cameron :
> 3) On Solaris, the PulseAudio GConf module does not compile since the
>   "module_info" structure defined in the PulseAudio code conflicts
>   with a structure with the same name in /usr/include/sys/stream.h.
>   Could the PulseAudio code be updated to use a more unique PulseAudio
>   specific name as suggested in the patch in this bug:
>
>   https://bugs.freedesktop.org/show_bug.cgi?id=41823
>
>   Note that sys/stream.h is included by sys/types.h on Solaris, and
>   sys/types.h is included in the src/modules/gconf/modules-gconf.c
>   PulseAudio file.

Your proposed patch clashes with pa_module_info in src/pulse/introspect.h.
Perhaps not on the compiler level, but at least it's very confusing
for the reader.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] PulseAudio LICENSE file is wrong or misleading about GPL/LGPL

2011-10-16 Thread Maarten Bosmans
2011/10/15 Brian Cameron :
> 2) Bug #41822 highlights that there may be licensing issues with
>   PulseAudio.  It says anything that links against libpulsecore is
>   GPL'ed.  Now that libpulsecommon and libpulse and the GStreamer Pulse
>   plugin now link against libpulsecore, this raises concern that any
>   program linking against PulseAudio is GPL, such as anything using
>   the GStreamer PulseAudio plugin.  Now that the speex resampler is
>   available, maybe it is time to drop libsamplerate as a dependency?
>
>   https://bugs.freedesktop.org/show_bug.cgi?id=41822

Do I conclude correctly from the bug that in pulse 1.0 it isn't true
anymore that the library dependencies are:
libpulse -> libpulsecommon
libpulsecore -> libpulsecommon

I do remember some stuff about circular dependencies. But as only
libpulsecore links to libsamplerate, the above dependency chain would
be the best to have, because libpulse is always LGPL, regardless of
pulse is build with libsamplerate support.

>   At any rate, on Solaris, we are disabling building with libsamplerate
>   for this reason.  It seems a bit ugly that libsamplerate is enabled
>   by default by the PulseAudio configure script if it is available if
>   there are these sorts of concerns.

In what way does compiling pulse with --disable-samplerate no solve
your licensing problems here?
I would not be in favor of removing an _optional_ dependency
alltogether just because enabling it is not desired by some subset of
users.

Enabling of an optional depency if all the requirements are met is
quite standard practice. And I'm a bit confused about why you would
have a GPL library installed, but don't want pulse to use it in order
to keep it LGPL. (and of course for these kind of use cases you can
easily override the autodetection)

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] Fix PulseAudio 1.0 build for Solaris

2011-10-16 Thread Maarten Bosmans
2011/10/15 Brian Cameron :
> 1) The Solaris linker does not allow lazy linking, so client programs
>   must link against all libraries that contain symbols used by the
>   program.  So I filed this bug:
>
>   https://bugs.freedesktop.org/show_bug.cgi?id=41539
>
>   A proposed patch in this bug shows how we fix this problem on
>   Solaris.  This changes the PulseAudio pkg-config files so that they
>   also specify that client needs to link against libpulsecommon and
>   libpulsecore, since these now contain symbols needed by client
>   programs.

This is not how things are supposed work on Linux. Libraries should
only link against libraries from which they use symbol. In
pulseaudio's case that's just libpulse, because that is our public
API. Overlinking is generally frowned upon.

>   The responses to this bug suggest that this is not desirable since
>   these PulseAudio libraries may be updated in future versions and it
>   is not desirable to make programs relink on Linux when these
>   libraries change.

Indeed, this is one of the reasons.

>   Wouldn't a better solution be to just drop the version numbers from
>   these libraries, or to only update their version numbers when you
>   really want people to need to relink?  Why embed version numbers in
>   library names when you want them to work across multiple versions?

Couldn't you just add Libs.private when compiling pulse applications?

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] PulseAudio support on Solaris

2011-10-16 Thread Maarten Bosmans
2011/10/15 Brian Cameron :
>
> PulseAudio Team:
>
> The decision was made recently to integrate PulseAudio into Solaris, so
> that is pretty exciting.  I am not exactly sure when it will integrate.
> At the moment, I am just working to get it building and working okay.

Indeed, exciting.

> I have encountered a few build issues, and I am wondering if PulseAudio
> could be updated to make it more portable and to build more easily on
> Solaris.  There are only about 3 changes that need to be made (issue #2
> below is a more general issue).

In general: yes, we would like to have portability fixes submitted
upstream. Thank you for collaborating. I'm looking forward to the
first pulse release that works unpatched on solaris.

Patches that you just want to submit for inclusion upstream
(especially simple things like #4 below) can be just send to the
mailing list directly. We generally prefer that to a bug report.

I'll start a new thread for the first three.

> 1) The Solaris linker does not allow lazy linking, so client programs
>   must link against all libraries that contain symbols used by the
>   program.  So I filed this bug:
>
>   https://bugs.freedesktop.org/show_bug.cgi?id=41539
>
>   A proposed patch in this bug shows how we fix this problem on
>   Solaris.  This changes the PulseAudio pkg-config files so that they
>   also specify that client needs to link against libpulsecommon and
>   libpulsecore, since these now contain symbols needed by client
>   programs.
>
>   The responses to this bug suggest that this is not desirable since
>   these PulseAudio libraries may be updated in future versions and it
>   is not desirable to make programs relink on Linux when these
>   libraries change.
>
>   Wouldn't a better solution be to just drop the version numbers from
>   these libraries, or to only update their version numbers when you
>   really want people to need to relink?  Why embed version numbers in
>   library names when you want them to work across multiple versions?
>
> 2) Bug #41822 highlights that there may be licensing issues with
>   PulseAudio.  It says anything that links against libpulsecore is
>   GPL'ed.  Now that libpulsecommon and libpulse and the GStreamer Pulse
>   plugin now link against libpulsecore, this raises concern that any
>   program linking against PulseAudio is GPL, such as anything using
>   the GStreamer PulseAudio plugin.  Now that the speex resampler is
>   available, maybe it is time to drop libsamplerate as a dependency?
>
>   https://bugs.freedesktop.org/show_bug.cgi?id=41822
>
>   At any rate, on Solaris, we are disabling building with libsamplerate
>   for this reason.  It seems a bit ugly that libsamplerate is enabled
>   by default by the PulseAudio configure script if it is available if
>   there are these sorts of concerns.
>
> 3) On Solaris, the PulseAudio GConf module does not compile since the
>   "module_info" structure defined in the PulseAudio code conflicts
>   with a structure with the same name in /usr/include/sys/stream.h.
>   Could the PulseAudio code be updated to use a more unique PulseAudio
>   specific name as suggested in the patch in this bug:
>
>   https://bugs.freedesktop.org/show_bug.cgi?id=41823
>
>   Note that sys/stream.h is included by sys/types.h on Solaris, and
>   sys/types.h is included in the src/modules/gconf/modules-gconf.c
>   PulseAudio file.
>
> 4) Some straightforward compile issues that seem appropriate to fix for
>   building on Solaris is in the patch in this bug:
>
>   https://bugs.freedesktop.org/show_bug.cgi?id=41538

This one looks good, see also my comment attached to the patch.

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


  1   2   3   >