Commit graph

6156 commits

Author SHA1 Message Date
David Henningsson
0dced7f275 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>
2011-11-26 16:46:42 +02:00
David Henningsson
d9685ec85d 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>
2011-11-26 16:46:42 +02:00
David Henningsson
961ec210a6 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>
2011-11-26 13:47:33 +02:00
Arun Raghavan
fabb28f935 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.
2011-11-24 13:03:26 +05:30
Arun Raghavan
1798c653db 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.).
2011-11-24 13:03:26 +05:30
Arun Raghavan
c30a68ebbd 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.
2011-11-24 12:35:48 +05:30
Arun Raghavan
aaf0f5bd6e 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.
2011-11-24 12:35:48 +05:30
Arun Raghavan
ac3d66f978 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).
2011-11-23 12:00:29 +05:30
Arun Raghavan
4b7b244564 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
2011-11-15 12:51:32 +05:30
Arun Raghavan
42881d2770 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
2011-11-15 12:51:31 +05:30
Maarten Bosmans
c2976b1f87 oss: Use log2 function from core-util instead of own implementation 2011-11-14 11:08:04 +05:30
Maarten Bosmans
93f46b92c7 Squash unused variable compiler warning 2011-11-14 11:08:04 +05:30
Maarten Bosmans
df5483f614 Remove vector.h and vector-test
This code was never used and vectorization is handled by Orc anyway.
2011-11-14 11:08:04 +05:30
Maarten Bosmans
ebd6aa594e build-sys: Remove time-smoother and shm from libpulsecore
As they are already included in libpulsecommon.
2011-11-14 11:08:04 +05:30
Maarten Bosmans
bcee830007 rtpoll: Update comment
to reflect changes made in
32e2cd6d32
core: get rid of rt sig/timer handling since modern Linux' ppoll() is finally fixed for granularity
2011-11-14 10:54:18 +05:30
Antti-Ville Jansson
7d05ac606b 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.
2011-11-14 10:54:18 +05:30
Arun Raghavan
d320ae029b 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).
2011-11-14 10:54:18 +05:30
Arun Raghavan
7a237e6210 tests: Add playback tests to check-daemon
Adds the standard/extended API playback tests to the check-daemon set.
2011-11-10 13:24:07 +05:30
Arun Raghavan
efbfe5fecb 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.
2011-11-10 12:43:09 +05:30
Maarten Bosmans
80cfa050db tests: Add a target for running manual tests
This adds a check-daemon make target which requires a running PulseAudio
server to test against.
2011-11-08 00:09:34 +05:30
Arun Raghavan
cc89b4aff1 echo-cancel: Make WebRTC the default canceller
Works pretty well, and isn't a CPU hog, so let's use it!
2011-11-07 19:36:23 +05:30
Arun Raghavan
c3d714693c echo-cancel: Turn WebRTC analog gain control on by default
Seems to be pretty well-behaved.
2011-11-07 19:36:08 +05:30
Arun Raghavan
fb02d50fe3 echo-cancel: Hook up WebRTC analog gain control 2011-11-07 17:37:50 +05:30
Arun Raghavan
3d2f2424eb 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.
2011-11-07 17:37:50 +05:30
Arun Raghavan
a813e85503 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.
2011-11-07 15:38:31 +05:30
Arun Raghavan
993d73d330 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.
2011-11-07 15:38:30 +05:30
Arun Raghavan
8616f82a67 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.
2011-11-07 15:38:30 +05:30
Arun Raghavan
75573435a0 sink,source: Fix corked stream handling in update_rate()
This fixes the conditional that checks for corked streams and prevents
rate updates.
2011-11-07 11:31:42 +05:30
Arun Raghavan
0a238f69ad 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.
2011-11-04 15:32:13 +05:30
Arun Raghavan
0d13f6ebd2 echo-cancel: Fix webrtc gain control initialisation 2011-11-04 15:25:33 +05:30
Lars R. Damerow
1e6eda8eda alsa: fixed_latency_range modarg for module-alsa-card 2011-11-03 21:31:48 +01:00
Lars R. Damerow
c07c4b353d alsa: fixed latency range handling for udev-detect 2011-11-03 21:31:27 +01:00
Lars R. Damerow
7a387fed36 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.
2011-11-03 21:17:54 +01:00
Frédéric Dalleau
6124bf8951 bluetooth: Remove match for org.bluez.MediaTransport.PropertyChanged 2011-11-03 00:29:00 +05:30
Frédéric Dalleau
12abb05ebd bluetooth: Use static string in DBUS signal handler description 2011-11-03 00:29:00 +05:30
Frédéric Dalleau
79c836ec6a 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.
2011-11-03 00:29:00 +05:30
Frédéric Dalleau
2f24a6e627 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.
2011-11-03 00:21:43 +05:30
Frédéric Dalleau
2c213607e2 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.
2011-11-03 00:21:39 +05:30
Frédéric Dalleau
54f3b9a6fa 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.
2011-11-03 00:21:35 +05:30
Frédéric Dalleau
3f6aa03912 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.
2011-11-03 00:18:49 +05:30
Arun Raghavan
041f255c9d doc: Fix some old 0pointer.de references 2011-11-02 23:44:55 +05:30
Maarten Bosmans
bca44b7700 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.
2011-11-02 23:44:55 +05:30
Maarten Bosmans
07dd717bc0 tests: Rename voltest to volume-test 2011-11-02 19:26:23 +05:30
Maarten Bosmans
681aaf7a9a 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.
2011-11-02 19:26:23 +05:30
Maarten Bosmans
6be5515e6a 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.
2011-11-02 19:26:23 +05:30
Maarten Bosmans
c2b5a8e694 tests: refactor ipacl-test
Common test code is moved to a separate function.
2011-11-02 19:26:23 +05:30
Tanu Kaskinen
6f148787e0 sink, source: Join two ifs with the same condition.
Changes in v2:
 * Moved the comment in source.c to the right place.
2011-11-02 19:17:17 +05:30
Arun Raghavan
e310f4853e 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.
2011-11-01 18:20:43 +05:30
Arun Raghavan
23ce9a4f79 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.
2011-11-01 18:20:32 +05:30
Johan Hedberg
8c0cca7905 bluetooth: sbc: Reduce for-loop induced indentation in sbc_unpack_frame 2011-10-28 15:43:56 +02:00