]> code.delx.au - pulseaudio/log
pulseaudio
12 years agowin32: Avoid some compiler warnings when cross-compiling for mingw32
Maarten Bosmans [Wed, 2 Nov 2011 20:54:13 +0000 (21:54 +0100)]
win32: Avoid some compiler warnings when cross-compiling for mingw32

Autoconf documentation says that AC_FUNC_SELECT_ARGTYPES shouldn't be used anyway.

12 years agodevice-port: Remove redundant include after the better circular dep fix.
Colin Guthrie [Sun, 27 Nov 2011 15:44:23 +0000 (15:44 +0000)]
device-port: Remove redundant include after the better circular dep fix.

12 years agox11: Drop unneeded 'struct' and use the typedef directly.
Colin Guthrie [Sun, 27 Nov 2011 15:23:55 +0000 (15:23 +0000)]
x11: Drop unneeded 'struct' and use the typedef directly.

12 years agoUse simple free function in pa_queue_free
Maarten Bosmans [Fri, 18 Nov 2011 08:58:09 +0000 (09:58 +0100)]
Use simple free function in pa_queue_free

12 years agoUse simple free function in pa_dynarray_free
Maarten Bosmans [Fri, 18 Nov 2011 08:58:08 +0000 (09:58 +0100)]
Use simple free function in pa_dynarray_free

12 years agodevice-port: Fix the circular dependency problem more cleanly.
Tanu Kaskinen [Sun, 27 Nov 2011 15:16:53 +0000 (17:16 +0200)]
device-port: Fix the circular dependency problem more cleanly.

Declaring structs before including anything ensures that the
structs are available for everybody in case of circular includes.

12 years agobluetooth: Fix property reply handling for hfgw
Mikel Astiz [Wed, 23 Nov 2011 16:08:11 +0000 (17:08 +0100)]
bluetooth: Fix property reply handling for hfgw

12 years agoresamplers: Optimize trivial resampler
Maarten Bosmans [Wed, 23 Nov 2011 10:40:08 +0000 (11:40 +0100)]
resamplers: Optimize trivial resampler

This improves the performance of a typical s16 2ch resampling by 88%.

12 years agoresamplers: Use better variable name in trivial resampler
Maarten Bosmans [Wed, 23 Nov 2011 10:40:07 +0000 (11:40 +0100)]
resamplers: Use better variable name in trivial resampler

12 years agobuild-sys: Disable fastpath asserts by default
Maarten Bosmans [Wed, 23 Nov 2011 10:40:06 +0000 (11:40 +0100)]
build-sys: Disable fastpath asserts by default

12 years agoresamplers: Use fastpath assert in trivial resampler
Maarten Bosmans [Wed, 23 Nov 2011 10:40:05 +0000 (11:40 +0100)]
resamplers: Use fastpath assert in trivial resampler

When the assert is disabled, the trivial resampler gets a 35% performance boost.

12 years agopulsecore: Hardcode FRAME_SIZE_MAX_ALLOW
Maarten Bosmans [Tue, 22 Nov 2011 15:09:18 +0000 (16:09 +0100)]
pulsecore: Hardcode FRAME_SIZE_MAX_ALLOW

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

12 years agoUpdate LICENSE
Maarten Bosmans [Tue, 22 Nov 2011 15:08:48 +0000 (16:08 +0100)]
Update LICENSE

Mention gdbm, lirc and fftw there.

12 years agopulsecore: Fix issue with circuilar definitions.
Colin Guthrie [Sun, 27 Nov 2011 14:19:57 +0000 (14:19 +0000)]
pulsecore: Fix issue with circuilar definitions.

Without this fix, errors about previous definitions are generated in
numerous locations.

Example of error:

  CC     libpulsecore_1.98_la-auth-cookie.lo
In file included from ../../src/pulsecore/source.h:46:0,
                 from ../../src/pulsecore/sink.h:40,
                 from ../../src/pulsecore/core.h:50,
                 from ../../src/pulsecore/shared.h:25,
                 from ../../src/pulsecore/auth-cookie.c:33:
../../src/pulsecore/device-port.h:40:24: error: redefinition of typedef
'pa_core'
../../src/pulsecore/core.h:29:24: note: previous declaration of
'pa_core' was here
make[3]: *** [libpulsecore_1.98_la-auth-cookie.lo] Error 1

Overall it would be nicer if we could avoid this kind of fix, but it
would require further reorganisation that I'm not prepared to undertake
right now.

12 years agocli: Show card ports and jack detection status
David Henningsson [Fri, 25 Nov 2011 14:17:15 +0000 (15:17 +0100)]
cli: Show card ports and jack detection status

Expose the new stuff through pacmd.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
12 years agoNotify port available status changes, and update protocol version
David Henningsson [Fri, 25 Nov 2011 14:17:14 +0000 (15:17 +0100)]
Notify port available status changes, and update protocol version

The recommended way of setting available status is to call
pa_device_port_set_available, which will send a subscription event
to the relevant card. It will also fire a hook.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
12 years agoCards now has ports directly, and device port has list of profiles
David Henningsson [Fri, 25 Nov 2011 14:17:13 +0000 (15:17 +0100)]
Cards now has ports directly, and device port has list of profiles

This forms the base for being able to expose all ports of all
profiles (even inactive ones) to clients.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
12 years agoTurn device ports into reference counted objects
David Henningsson [Fri, 25 Nov 2011 14:17:12 +0000 (15:17 +0100)]
Turn device ports into reference counted objects

Since both cards and sinks can hold references to a port, it makes
sense to reference count them. Although no current implementation
actually has sinks with ports but without a card, it felt wrong
to make it harder to make such an implementation in the future.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
12 years agoIntroduce "available" concept for ports, and communicate that to clients. Bump protoc...
David Henningsson [Fri, 25 Nov 2011 14:17:11 +0000 (15:17 +0100)]
Introduce "available" concept for ports, and communicate that to clients. Bump protocol version to 24.

Note: There is still no notification when status availability changes.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
12 years agofilters: Handle echo-cancel streams better
Arun Raghavan [Thu, 17 Nov 2011 14:31:59 +0000 (20:01 +0530)]
filters: Handle echo-cancel streams better

This makes handling of echo-cancel streams (and potentially other
filters that need to work with multiple streams) cleaner. We do this by
adding the ability to apply filter on a group of streams rather than
always treating streams individually.

This is required, for example, when changing the input source for an
echo-cancel source output. When this happens, we want to change the
module-echo-cancel instance to actually cancel between the new source
and old sink.

To do this when one stream in a group moves, we create a new filter
instance between the current master sink/source pair and move the
relevant streams to the virtual sink/source from this new instance.

12 years agoproplist: Add internal API to get stream group
Arun Raghavan [Wed, 23 Nov 2011 10:56:40 +0000 (16:26 +0530)]
proplist: Add internal API to get stream group

This moves out code from module-stream-restore and makes an internal API
out of it to get a "stream group" for a given sink input or source output.
This is factored out for reuse in module-filter-*.

The stream group basically provides some means of attaching a logical
identification to the stream (by role, application id, etc.).

12 years agofilters: Allow a filter to have both sink and source
Arun Raghavan [Fri, 11 Nov 2011 09:38:24 +0000 (15:08 +0530)]
filters: Allow a filter to have both sink and source

This sets the base for better representing module-echo-cancel. This
patch itself should change no behaviour -- it only makes way for other
changes.

12 years agofilters: Fix the master source/sink when autoloaded
Arun Raghavan [Wed, 23 Nov 2011 11:16:12 +0000 (16:46 +0530)]
filters: Fix the master source/sink when autoloaded

When autoloaded, it is expected that module-filter-apply (or whatever is
loading us) will take care of applying the filter on the correct
sink/source master. Instead of adding complexity by tracking what is
currently being filtered, we just disallow filtering anything except the
original master sink/source and let module-filter-apply or whatever is
loading us deal with dynamic sink/source changes.

12 years agoecho-cancel: Use more human-friendly descriptions
Arun Raghavan [Tue, 22 Nov 2011 07:54:22 +0000 (13:24 +0530)]
echo-cancel: Use more human-friendly descriptions

This makes what devices are being cancelled clearer in the UI (at the
cost of being somewhat less clear when multiple devices of the same name
are plugged, but at least that's a much smaller set than everyone).

12 years agoecho-cancel: Use speex by default if webrtc isn't available
Arun Raghavan [Tue, 15 Nov 2011 07:20:10 +0000 (12:50 +0530)]
echo-cancel: Use speex by default if webrtc isn't available

Thanks to Peter Meerwald <pmeerw@pmeerw.net> for pointing this out.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=42925

12 years agocore: Look up /etc/machine-id if D-Bus machine-id is not found
Arun Raghavan [Mon, 14 Nov 2011 08:12:21 +0000 (13:42 +0530)]
core: Look up /etc/machine-id if D-Bus machine-id is not found

It appears that this is currently the fallback for early boot and other
such cases where /var might not be available. Relevant upstream commit:

http://cgit.freedesktop.org/dbus/dbus/commit/?id=66e52541d5bdd4927a5c702963749760643313f4

Thanks to Samuli Suominen <ssuominen@gentoo.org> for pointing this out
in https://bugs.gentoo.org/show_bug.cgi?id=390287

12 years agooss: Use log2 function from core-util instead of own implementation
Maarten Bosmans [Wed, 2 Nov 2011 20:54:15 +0000 (21:54 +0100)]
oss: Use log2 function from core-util instead of own implementation

12 years agoSquash unused variable compiler warning
Maarten Bosmans [Wed, 2 Nov 2011 20:54:14 +0000 (21:54 +0100)]
Squash unused variable compiler warning

12 years agoRemove vector.h and vector-test
Maarten Bosmans [Wed, 2 Nov 2011 20:54:12 +0000 (21:54 +0100)]
Remove vector.h and vector-test

This code was never used and vectorization is handled by Orc anyway.

12 years agobuild-sys: Remove time-smoother and shm from libpulsecore
Maarten Bosmans [Wed, 19 Oct 2011 12:10:13 +0000 (14:10 +0200)]
build-sys: Remove time-smoother and shm from libpulsecore

As they are already included in libpulsecommon.

12 years agortpoll: Update comment
Maarten Bosmans [Thu, 13 Oct 2011 18:54:17 +0000 (20:54 +0200)]
rtpoll: Update comment

to reflect changes made in
32e2cd6d3216f780c4cffed0f8eb3c30f2c8d732
core: get rid of rt sig/timer handling since modern Linux' ppoll() is finally fixed for granularity

12 years agostream: Fix upload samples' cleanup
Antti-Ville Jansson [Fri, 11 Nov 2011 14:22:24 +0000 (16:22 +0200)]
stream: Fix upload samples' cleanup

In pa_create_stream_callback, a stream is inserted into
s->context->record_streams only if it's a record stream. Otherwise it's
inserted into s->context->playback_streams. However, in stream_unlink the
stream is removed from s->context->playback_streams only if it's a playback
stream and otherwise it's removed from s->context->record_streams.

Thus, if the stream is an upload stream, we first insert it into
s->context->playback_streams in pa_create_stream_callback and then try to
remove it unsuccessfully from s->context->record_streams in stream_unlink. This
means that we are leaking hashmap entries until the context is freed,
constantly consuming more memory with applications that upload and unload a
large number of samples through one context.

Of course, this begs the question whether upload streams even belong in either
of those hashmaps. I don't want to mess around with the code too much at this
point though, so this patch should be a sufficient improvement.

12 years agoalsa: Minor debug code cleanup
Arun Raghavan [Sat, 12 Nov 2011 05:48:25 +0000 (11:18 +0530)]
alsa: Minor debug code cleanup

Remove a trap on underrun and uncomment a couple of useful debug prints
(still enabled only when DEBUG_TIMING is defined).

12 years agotests: Add playback tests to check-daemon
Arun Raghavan [Thu, 10 Nov 2011 07:54:07 +0000 (13:24 +0530)]
tests: Add playback tests to check-daemon

Adds the standard/extended API playback tests to the check-daemon set.

12 years agocore: Make debugging a bit simpler
Arun Raghavan [Thu, 10 Nov 2011 07:13:09 +0000 (12:43 +0530)]
core: Make debugging a bit simpler

This takes out a bunch of commented debug prints and puts them in
defines. Makes it easier to turn them all on/off at a single point.

12 years agotests: Add a target for running manual tests
Maarten Bosmans [Mon, 7 Nov 2011 18:39:34 +0000 (00:09 +0530)]
tests: Add a target for running manual tests

This adds a check-daemon make target which requires a running PulseAudio
server to test against.

12 years agoecho-cancel: Make WebRTC the default canceller
Arun Raghavan [Mon, 7 Nov 2011 14:05:28 +0000 (19:35 +0530)]
echo-cancel: Make WebRTC the default canceller

Works pretty well, and isn't a CPU hog, so let's use it!

12 years agoecho-cancel: Turn WebRTC analog gain control on by default
Arun Raghavan [Mon, 7 Nov 2011 14:05:05 +0000 (19:35 +0530)]
echo-cancel: Turn WebRTC analog gain control on by default

Seems to be pretty well-behaved.

12 years agoecho-cancel: Hook up WebRTC analog gain control
Arun Raghavan [Fri, 4 Nov 2011 11:08:30 +0000 (16:38 +0530)]
echo-cancel: Hook up WebRTC analog gain control

12 years agoecho-cancel: Add infrastructure for cancellers to do AGC
Arun Raghavan [Fri, 4 Nov 2011 10:47:26 +0000 (16:17 +0530)]
echo-cancel: Add infrastructure for cancellers to do AGC

This adds some infrastructure for canceller implementations to also
perform acoustic gain control. Cancellers now have a couple of new API
calls that allow them to get/set capture volume.

This is made slightly complex by the fact that cancellation happens in
thread context while most volume mangling needs to be done in main
context. To deal with this, while getting the volume we save source
volume updates as they are propagated to thread context and use this
cached value for queries. To set the volume, we send an async message to
main context and let that set the source volume.

12 years agosink,source: Update sample rate if possible on stream uncork
Arun Raghavan [Sun, 6 Nov 2011 13:42:19 +0000 (19:12 +0530)]
sink,source: Update sample rate if possible on stream uncork

If a stream is being uncorked and no other stream is running, we try to
update the sink/source sample rate to match it and avoid resampling.

12 years agosink,source: Allow sample rate switching with corked streams
Arun Raghavan [Mon, 7 Nov 2011 09:31:25 +0000 (15:01 +0530)]
sink,source: Allow sample rate switching with corked streams

This updates corked streams' resamplers when switching sample rates on a
sink/source, which means the restriction of allowing sample rate updates
only when no streams are attached to a sink/source is now relaxed to
preventing updates only when there is a running stream attached.

12 years agosink-input,source-output: Add an update_rate() function
Arun Raghavan [Sun, 6 Nov 2011 12:50:01 +0000 (18:20 +0530)]
sink-input,source-output: Add an update_rate() function

This factors out the resampler updating code from finish_move() and
makes a separate function for use from other points.

12 years agosink,source: Fix corked stream handling in update_rate()
Arun Raghavan [Mon, 7 Nov 2011 06:01:42 +0000 (11:31 +0530)]
sink,source: Fix corked stream handling in update_rate()

This fixes the conditional that checks for corked streams and prevents
rate updates.

12 years agocli: Add a dump-volumes command
Arun Raghavan [Thu, 18 Aug 2011 06:26:26 +0000 (11:56 +0530)]
cli: Add a dump-volumes command

The purpose of this command is to print all the internal volume
variables for sinks/sources and all corresponding
sink-inputs/source-outputs  to make debugging and reasoning about
volume-related issues easier.

12 years agoecho-cancel: Fix webrtc gain control initialisation
Arun Raghavan [Thu, 3 Nov 2011 13:46:47 +0000 (19:16 +0530)]
echo-cancel: Fix webrtc gain control initialisation

12 years agoalsa: fixed_latency_range modarg for module-alsa-card
Lars R. Damerow [Thu, 3 Nov 2011 20:31:48 +0000 (21:31 +0100)]
alsa: fixed_latency_range modarg for module-alsa-card

12 years agoalsa: fixed latency range handling for udev-detect
Lars R. Damerow [Thu, 3 Nov 2011 20:29:03 +0000 (21:29 +0100)]
alsa: fixed latency range handling for udev-detect

12 years agoalsa: support fixed latency range in alsa modules
Lars R. Damerow [Thu, 3 Nov 2011 20:14:45 +0000 (21:14 +0100)]
alsa: support fixed latency range in alsa modules

This adds a boolean module parameter to disable automatic dynamic
latency readjustments on underruns, but leaves automatic dynamic
watermark readjustments untouched.

12 years agobluetooth: Remove match for org.bluez.MediaTransport.PropertyChanged
Frédéric Dalleau [Tue, 4 Oct 2011 07:37:27 +0000 (09:37 +0200)]
bluetooth: Remove match for org.bluez.MediaTransport.PropertyChanged

12 years agobluetooth: Use static string in DBUS signal handler description
Frédéric Dalleau [Tue, 4 Oct 2011 07:37:26 +0000 (09:37 +0200)]
bluetooth: Use static string in DBUS signal handler description

12 years agobluetooth: Set hfgw profile when HandsfreeGateway is playing
Frédéric Dalleau [Tue, 4 Oct 2011 07:37:25 +0000 (09:37 +0200)]
bluetooth: Set hfgw profile when HandsfreeGateway is playing

Allow module-bluetooth-device to listens to HandsfreeGateway state
changes using DBUS signals. When an handsfree connects, module-bluetooth-device
is loaded and goes to playing state. When the handsfree disconnect audio,
the card profile is set to "off". If the headset connects audio again after
that, the card profile should switch to "hfgw" again to match state of audio
connection.

12 years agobluetooth: Set off profile on SCO disconnect
Frédéric Dalleau [Tue, 4 Oct 2011 07:37:24 +0000 (09:37 +0200)]
bluetooth: Set off profile on SCO disconnect

Sends a message from IO thread to main thread using pa_msgobject when POLLERR
or POLLHUP is received on SCO socket.

12 years agobluetooth: Release MediaEnpoint if card profile is set to Off
Frédéric Dalleau [Tue, 4 Oct 2011 07:37:23 +0000 (09:37 +0200)]
bluetooth: Release MediaEnpoint if card profile is set to Off

If card profile is set to "off", the audio stream should be released.
Current implementation releases the stream when the card profile
is changed to "hsp" or "hfgw" again and immediatly reconnects after that.

12 years agobluetooth: Do not unload module-bluetooth-device on ERR or HUP
Frédéric Dalleau [Tue, 4 Oct 2011 07:37:22 +0000 (09:37 +0200)]
bluetooth: Do not unload module-bluetooth-device on ERR or HUP

This happens in the following scenario :
An HandsfreeGateway connects RFCOMM and then SCO. A card appears in
PA and can be used. If for some reason, SCO is disconnected,
module-bluetooth-device is unloaded. The card will disappear, even
if RFCOMM is still connected. After that, it is not possible to
connect SCO again from PA.

12 years agobluetooth: Fix Media Endpoint for HandsfreeGateway
Frédéric Dalleau [Tue, 4 Oct 2011 07:37:21 +0000 (09:37 +0200)]
bluetooth: Fix Media Endpoint for HandsfreeGateway

This patch will add the necessary quirks so that pulseaudio can register
an endpoint on the /MediaEndpoint/HFPHS path. This endpoint is to be
used for HFP Handsfree profile.

12 years agodoc: Fix some old 0pointer.de references
Arun Raghavan [Wed, 2 Nov 2011 14:10:15 +0000 (19:40 +0530)]
doc: Fix some old 0pointer.de references

12 years agotests: Revisit which tests to run with make check
Maarten Bosmans [Tue, 4 Oct 2011 12:12:20 +0000 (14:12 +0200)]
tests: Revisit which tests to run with make check

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.

12 years agotests: Rename voltest to volume-test
Maarten Bosmans [Tue, 4 Oct 2011 12:08:05 +0000 (14:08 +0200)]
tests: Rename voltest to volume-test

12 years agotests: More useful output of make check
Maarten Bosmans [Tue, 4 Oct 2011 12:01:03 +0000 (14:01 +0200)]
tests: More useful output of make check

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.

12 years agotests: Make sure tests assert on failures and return error status
Maarten Bosmans [Fri, 28 Oct 2011 14:30:05 +0000 (16:30 +0200)]
tests: Make sure tests assert on failures and return error status

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.

12 years agotests: refactor ipacl-test
Maarten Bosmans [Fri, 28 Oct 2011 14:24:18 +0000 (16:24 +0200)]
tests: refactor ipacl-test

Common test code is moved to a separate function.

12 years agosink, source: Join two ifs with the same condition.
Tanu Kaskinen [Mon, 31 Oct 2011 18:45:50 +0000 (20:45 +0200)]
sink, source: Join two ifs with the same condition.

Changes in v2:
 * Moved the comment in source.c to the right place.

12 years agoecho-cancel: Adapt test code for drift compensation
Arun Raghavan [Mon, 10 Oct 2011 17:01:38 +0000 (22:31 +0530)]
echo-cancel: Adapt test code for drift compensation

This dumps out an additional file with each line having a command of the
form:

p <number of playback samples processed>
c <number of capture samples processed>
d <drift as passed to set_drift()>

The test program can be provided this file to "replay" the data exactly
as when it was run live.

The non-drift-compensation path is retained as-is since it is much
simpler.

12 years agoecho-cancel: Plug in WebRTC drift compensation
Arun Raghavan [Fri, 7 Oct 2011 10:58:11 +0000 (16:28 +0530)]
echo-cancel: Plug in WebRTC drift compensation

This adds the ability for echo cancellers to provide their own drift
compensation, and hooks in the appropriate bits to implement this in the
WebRTC canceller.

We do this by introducing an alternative model for the canceller. So
far, the core engine just provided a run() method which was given
blocksize-sized chunks of playback and record samples. The new model has
the engine provide play() and record() methods that can (in theory) be
called by the playback and capture threads. The latter would actually do
the processing required.

In addition to this a set_drift() method may be provided by the
implementation. PA will provide periodic samples of the drift to the
engine. These values need to be aggregated and processed over some time,
since the point values vary quite a bit (but generally fit a linear
regression reasonably accurately). At some point of time, we might move
the actual drift calculation into PA and change the semantics of this
function.

NOTE: This needs further testing before being deemed ready for wider use.

12 years agobluetooth: sbc: Reduce for-loop induced indentation in sbc_unpack_frame
Johan Hedberg [Thu, 20 Oct 2011 12:47:49 +0000 (15:47 +0300)]
bluetooth: sbc: Reduce for-loop induced indentation in sbc_unpack_frame

12 years agobluetooth: sbc: overflow bugfix and audio decoding quality improvement
Siarhei Siamashka [Thu, 20 Oct 2011 12:47:48 +0000 (15:47 +0300)]
bluetooth: sbc: overflow bugfix and audio decoding quality improvement

The "(((audio_sample << 1) | 1) << frame->scale_factor[ch][sb])"
part of expression
    "frame->sb_sample[blk][ch][sb] =
        (((audio_sample << 1) | 1) << frame->scale_factor[ch][sb]) /
        levels[ch][sb] - (1 << frame->scale_factor[ch][sb])"
in "sbc_unpack_frame" function can sometimes overflow 32-bit signed int.
This problem can be reproduced by first using bitpool 128 and encoding
some random noise data, and then feeding it to sbc decoder. The obvious
thing to do would be to change "audio_sample" variable type to uint32_t.

However the problem is a little bit more complicated. According
to the section "12.6.2 Scale Factors" of A2DP spec:
    scalefactor[ch][sb] = pow(2.0, (scale_factor[ch][sb] + 1))

And according to "12.6.4 Reconstruction of the Subband Samples":
    sb_sample[blk][ch][sb] = scalefactor[ch][sb] *
        ((audio_sample[blk][ch][sb]*2.0+1.0) / levels[ch][sb]-1.0);

Hence the current code for calculating "sb_sample[blk][ch][sb]" is
not quite correct, because it loses one least significant bit of
sample data and passes twice smaller sample values to the synthesis
filter (the filter also deviates from the spec to compensate this).
This all has quite a noticeable impact on audio quality. Moreover,
it makes sense to keep a few extra bits of precision here in order
to minimize rounding errors. So the proposed patch introduces a new
SBCDEC_FIXED_EXTRA_BITS constant and uses uint64_t data type
for intermediate calculations in order to safeguard against
overflows. This patch intentionally addresses only the quality
issue, but performance can be also improved later (like replacing
division with multiplication by reciprocal).

Test for the difference of sbc encoding/decoding roundtrip vs.
the original audio file for joint stereo, bitpool 128, 8 subbands
and http://media.xiph.org/sintel/sintel-master-st.flac sample
demonstrates some quality improvement:

=== before ===
    --- comparing original / sbc_encoder.exe + sbcdec ---
    stddev:    4.64 PSNR: 82.97 bytes:170495708/170496000
=== after ===
    --- comparing original / sbc_encoder.exe + sbcdec ---
    stddev:    1.95 PSNR: 90.50 bytes:170495708/170496000

12 years agobluetooth: audio: Update license for shared header files
Marcel Holtmann [Fri, 26 Aug 2011 18:18:54 +0000 (11:18 -0700)]
bluetooth: audio: Update license for shared header files

The header files with constants and structures for audio specific
interaction with Pulseaudio are suppose to be under LGPL license.

For some odd reason a2dp-codecs.h ended up being under GPL license
which is against the intention of this being shared and re-used by
non-GPL programs. Fix this now to avoid any future confusion.

12 years agocore: Add a string list membership check function
Arun Raghavan [Thu, 27 Oct 2011 10:49:18 +0000 (12:49 +0200)]
core: Add a string list membership check function

This adds a pa_str_in_list() to check for a given string in a
space-separated list of strings. For now, this is merely present to
avoid duplication of role matching code (intended roles can be a
space-separate list) across modules.

12 years agodoc: Correct intended roles property documentation
Arun Raghavan [Thu, 27 Oct 2011 10:54:17 +0000 (12:54 +0200)]
doc: Correct intended roles property documentation

The documentation says we expect a comma-separate list of intended
roles, but the code splits the string on whitespaces, so this corrects
the documentation to match the implementation.

12 years agoalsa: Set return code before printing it.
Dylan Reid [Wed, 26 Oct 2011 03:34:31 +0000 (20:34 -0700)]
alsa: Set return code before printing it.

The error message for snd_pcm_hw_params_set_period_wakeup was
printing "ret", but "ret" wasn't being set.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
12 years agorole-cork: Allow module-role-cork to act globally.
Colin Guthrie [Mon, 24 Oct 2011 21:51:20 +0000 (23:51 +0200)]
role-cork: Allow module-role-cork to act globally.

Allow a module argument to specify that we should act globally
rather than just within a given sink.

The default value is to not opporate globally thus retaining the
current behaviour.

12 years agorole-cork: Make module-role-cork more generic.
Colin Guthrie [Mon, 24 Oct 2011 21:35:38 +0000 (23:35 +0200)]
role-cork: Make module-role-cork more generic.

Operate on a list of 'trigger roles' and 'cork roles'. i.e.
react to any stream with a role in the trigger list and apply a
cork to any stream with the a role in the cork list.

The trigger roles default to 'phone' and the cork roles default
to both 'music' and 'video' thus achieving the same functionality
as currently when called without any arguments.

12 years agorole-cork: Rename module-cork-music-on-phone to module-role-cork.
Colin Guthrie [Mon, 24 Oct 2011 20:55:45 +0000 (22:55 +0200)]
role-cork: Rename module-cork-music-on-phone to module-role-cork.

This module will be extended to be a bit more generic so the
old name will soon be obsolete.

12 years agogitignore: Update for recent additions
Arun Raghavan [Fri, 21 Oct 2011 04:37:31 +0000 (10:07 +0530)]
gitignore: Update for recent additions

Adds echo-cancel-test and new cmake files

12 years agoconf: Use .nofail when loading module-jackdbus-detect
Colin Guthrie [Thu, 20 Oct 2011 13:11:53 +0000 (14:11 +0100)]
conf: Use .nofail when loading module-jackdbus-detect

When starting via a console login, PA will likely not have a session DBus
to play with. As there is no X11 environment, libdbus will be unable
to launch a session DBus for us and thus the module will fail to load
which in turn prevents PA from loading.

If the user subsequently logs into X11 this it will still not be possible
to load the module as the server will be ignorant of the X11 and DBus
environment variables so a longer term solution for handling this should
be found.

12 years agosolaris: Use real_volume for set/get volume
Arun Raghavan [Thu, 20 Oct 2011 09:16:23 +0000 (14:46 +0530)]
solaris: Use real_volume for set/get volume

This got missed when other bits were updated. Patch submitted by
Brian Cameron <brian.cameron@oracle.com>.

12 years agonative: Fix Solaris build
Arun Raghavan [Thu, 20 Oct 2011 09:14:22 +0000 (14:44 +0530)]
native: Fix Solaris build

tcpwrappers has some Solaris-specific quirks that need to be dealt with.
Patch submitted by Brian Cameron <brian.cameron@oracle.com>.

12 years agoUpdate LICENSE.
Colin Guthrie [Thu, 20 Oct 2011 09:04:49 +0000 (10:04 +0100)]
Update LICENSE.

Some of the license wording was less than clear. Try to clarify the
different GPL 'downgrade' scenarios but also be generic to ensure that
those packagers where GPL is a problem check thoroughly before they ship.

Inspired by comments from Brian Cameron @ Oracle via fdo#41822

12 years agoalsa: Handle the "profile" modarg in module-alsa-card
Tanu Kaskinen [Mon, 3 Oct 2011 15:11:47 +0000 (18:11 +0300)]
alsa: Handle the "profile" modarg in module-alsa-card

12 years agoosx: module_bonjour_publish needs to be linked against libprotocol-native.la
Daniel Mack [Mon, 17 Oct 2011 09:33:27 +0000 (11:33 +0200)]
osx: module_bonjour_publish needs to be linked against libprotocol-native.la

12 years agobuild-sys: Provide a simple CMake Config setup (similar to pkgconfig)
Colin Guthrie [Tue, 11 Oct 2011 19:42:42 +0000 (20:42 +0100)]
build-sys: Provide a simple CMake Config setup (similar to pkgconfig)

I'd rather not have to do this, as I don't really see the point in
duplicating what is done in pkgconfig, but this is likely the
easiest way to avoid nasty hacks.

12 years agosink,source: Account for corked streams in update_rate()
Arun Raghavan [Tue, 18 Oct 2011 04:23:20 +0000 (09:53 +0530)]
sink,source: Account for corked streams in update_rate()

pa_sink/source_used_by() ignores corked/monitor streams, but we need to
make sure there aren't any of these while updating rate (at least for
now -- this is a restriction that would be nice to get rid of).

12 years agoalsa: fix list of sampling rates
Pierre-Louis Bossart [Mon, 17 Oct 2011 19:43:50 +0000 (14:43 -0500)]
alsa: fix list of sampling rates

add all standard audio rates

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
12 years agoalsa: Probe sink/source sample rates
Arun Raghavan [Mon, 17 Oct 2011 17:16:06 +0000 (22:46 +0530)]
alsa: Probe sink/source sample rates

This probes sink and source sample rates and uses this information to
validate rate changes and check incoming passthrough formats.

12 years agoalsa: Remove unused variable
Arun Raghavan [Mon, 17 Oct 2011 15:46:23 +0000 (21:16 +0530)]
alsa: Remove unused variable

12 years agosink,source: Handle equal default and alternate sample rates
Arun Raghavan [Mon, 17 Oct 2011 14:33:52 +0000 (20:03 +0530)]
sink,source: Handle equal default and alternate sample rates

12 years agosink,source: Add the ability to disable alternat sample rate switching
Arun Raghavan [Mon, 17 Oct 2011 14:31:03 +0000 (20:01 +0530)]
sink,source: Add the ability to disable alternat sample rate switching

Setting the alternate sample rate to 0 in config disables this feature.

12 years agosource: Bring rate update code in sync with sink code
Arun Raghavan [Mon, 10 Oct 2011 19:17:56 +0000 (00:47 +0530)]
source: Bring rate update code in sync with sink code

Basically adds code to handle passthrough sources. This isn't a tested
path at the moment, but in the future, when we do wish to support these,
it'll save us the trouble of having to sync all the code again.

12 years agoalsa: support for alternate sampling rate
Pierre-Louis Bossart [Tue, 2 Aug 2011 23:37:29 +0000 (18:37 -0500)]
alsa: support for alternate sampling rate

This is where the actual changes happen.
Some additional checks would be required to make sure the
rate is actually supported
Tested with both PCM and passthrough streams

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
12 years agosink,source: support for rate update
Pierre-Louis Bossart [Tue, 2 Aug 2011 23:37:28 +0000 (18:37 -0500)]
sink,source: support for rate update

Avoid resampling or use integer resampling when supported by the
sinks/sources

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
12 years agocore: infrastructure for alternate sampling rate
Pierre-Louis Bossart [Tue, 2 Aug 2011 23:37:27 +0000 (18:37 -0500)]
core: infrastructure for alternate sampling rate

New parameter to avoid resampling. BIG power savings here...

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
12 years agobuild-sys: Minor CXXFLAGS fix
Arun Raghavan [Mon, 17 Oct 2011 11:39:24 +0000 (17:09 +0530)]
build-sys: Minor CXXFLAGS fix

Set it on echo-cancel-test only if webrtc support is enabled.

12 years agoecho-cancel: Add the WebRTC echo canceller
Arun Raghavan [Mon, 19 Sep 2011 08:11:13 +0000 (13:41 +0530)]
echo-cancel: Add the WebRTC echo canceller

This adds the WebRTC echo canceller as another module-echo-cancel
backend. We're exposing both the full echo canceller as well as the
mobile echo control version as modargs.

Pending items:

1. The mobile canceller doesn't seem to work at the moment.

2. We still need to add bits to hook in drift compensation (to support
   sink and source from different devices).

The most controversial part of this patch would probably be the
mandatory build-time dependency on a C++ compiler. If the optional
--enable-webrtc-aec is set, then there's also a dependency on libstdc++.

12 years agomacro: typedef pa_bool_t to bool instead of _Bool
Arun Raghavan [Mon, 19 Sep 2011 08:08:03 +0000 (13:38 +0530)]
macro: typedef pa_bool_t to bool instead of _Bool

They're functionally equivalent, and the former lets the header be
included in C++ as well.

12 years agoecho-cancel: Simplify checking if AEC is active
Arun Raghavan [Mon, 17 Oct 2011 10:25:51 +0000 (15:55 +0530)]
echo-cancel: Simplify checking if AEC is active

This removes the active_mask bits and just check source and sink states
directly.

12 years agoalsa: New modarg "paths_dir" for module-alsa-card
Tanu Kaskinen [Thu, 6 Oct 2011 20:09:15 +0000 (23:09 +0300)]
alsa: New modarg "paths_dir" for module-alsa-card

The new module argument can be used to provide a custom
directory for loading alsa path configuration files. This is
useful for testing: no need to be root to create test
configuration files.

12 years agoFix deferred volume not being applied if sink is closed
David Henningsson [Thu, 13 Oct 2011 15:30:39 +0000 (17:30 +0200)]
Fix deferred volume not being applied if sink is closed

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
12 years agobuild-sys: Drop libsamplerate from pulsecommon deps
Arun Raghavan [Mon, 17 Oct 2011 04:12:25 +0000 (09:42 +0530)]
build-sys: Drop libsamplerate from pulsecommon deps

This was erroneously added in:

    commit d766b38e1ba5d483ad7eec105860e9b9f7f55702
    build: Remove unnecessary flags in AM_CFLAGS

12 years agofilter-apply: Move sink/source unlink callbacks before m-s-r
Arun Raghavan [Wed, 12 Oct 2011 12:14:30 +0000 (17:44 +0530)]
filter-apply: Move sink/source unlink callbacks before m-s-r

module-stream-restore and modile-filter-apply can get into an infinite
loop if m-s-r is called before m-f-a (m-s-r rescues a stream and
attaches it to a sink/source, which then triggers m-f-a to move it back
to the filter sink/source, and so on). The purpose of the m-f-a hooks is
to beat m-s-r, so moving them to be run first.