Commit graph

7114 commits

Author SHA1 Message Date
Tanu Kaskinen
e05c12f28b bluetooth: Fix too late assertion
u was dereferenced before the assertion that checks that u isn't NULL.
2013-06-19 18:25:56 +03:00
Tanu Kaskinen
0e9baa429e combine: Fix crash in output freeing
The outputs are removed from the idxset before output_free() is
called. Trying to remove them again in output_free(), and asserting
that it should succeed caused crashing whenever outputs were freed.

This bug was introduced in commit
061878b5a4.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=65901
2013-06-19 18:21:36 +03:00
Arun Raghavan
e1e154c737 zeroconf: Fix pa_mainloop_api_once usage
We need the mainloop lock to be taken around pa_mainloop_api_once() to
prevent an assert due to the defer event creation and setting of the
destroy callback not being performed atomically.
2013-06-18 08:20:05 +05:30
Arun Raghavan
9a0dd11342 mainloop: Document need for mainloop lock around pa_mainloop_api_once
This needs us to expose a bit of implementation detail, but this seems
to be the cleanest way without an API change.

The specific problem is that pa_mainloop_api_once() needs to first
create a defer event and then set its destroy callback. If the defer
event is completed before the callback is set, an assert will be
trigerred.
2013-06-18 08:20:05 +05:30
David Henningsson
b2792d7837 pstream: Fixup hangs caused by recent iochannel patch
Now that we don't *always* get a callback after having written
something, make sure we can continue writing as long as it fully
succeeds.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2013-06-17 08:52:07 +02:00
Arun Raghavan
2c1dceeb58 sink-input: Log format negotiation better
This provides more details on format negotiation success and failure to
make debugging problems easier.
2013-06-15 09:42:57 +05:30
Arun Raghavan
4e05333a93 iochannel: Document modified pa_iochannel_write return value 2013-06-14 17:12:44 +05:30
David Henningsson
9c4dcffca5 iochannel: Avoid unnecessary wakeup after successful write
To save some CPU (in low latency scenarios), don't re-enable the
"writable" event after it has succeeded. It is very likely the next
write will succeed right away too.

This means that we always need to handle EAGAIN/EWOULDBLOCK as a
successful write of 0 bytes, so I also verified that all callers to
pa_iochannel_write handled this correctly.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2013-06-14 13:45:57 +03:00
David Henningsson
e2d1421f61 alsa: Fix "Scheduling delay of..." message
The tsched_watermark is in bytes, not in usecs. Fix this by introducing
a new variable, and also use that variable in some places for optimisation.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2013-06-13 13:07:42 +03:00
Arun Raghavan
f6291d974a doc: Fix building doxygen docs out of tree 2013-06-12 18:41:08 +05:30
Tanu Kaskinen
1e42a289d4 native: Don't enable prebuffering when draining
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=64284
2013-06-11 13:46:44 +03:00
David Henningsson
ecf3ab2b57 alsa-mixer: Add "Line Out" path
If there is a "Line Out" jack present, then add this path. The fallback
analog-output will be a subset of this path and removed.

I only use the "Line Out Jack" or "Line Out Front Jack" for actual jack
detection - without anything connected to the front jack, it makes little
sense to enable the port.
(Another option could perhaps be to use different paths for stereo line out
and surround line outs, but that could be a possible future improvement.)
2013-06-10 17:03:02 +03:00
Arun Raghavan
22aac4e9fd alsa-mixer: Disable headphones when playing to speakers
Assume that the headphone port volume is lower than the speaker volume.
When plugging in headphones, if the path is active, while the jack is
being inserted and before it is actually detected as being plugged in,
it will still receive the signal being played (which is at a higher
volume than it will be when plugged in completely). The volume
difference manifests as a volume spike when the headphones are plugged
in, before the final volume is set.

This patch is required to prevent such a volume spike when plugging in
headphones. The problem is not fixed completely, but the spike is
shortened. To be fixed completely, we need to apply the port volume
before unmuting the new path.
2013-06-10 17:01:53 +03:00
Jan Alexander Steffens (heftig)
07290d9da7 core-util: Clamp RLIMIT_RTTIME to what RealtimeKit accepts
In the default configuration, PulseAudio's rlimit-rttime is set to
1000000 (100%), which is higher than what RealtimeKit requires from
its clients (200000, 20%).

Make an attempt to still get realtime scheduling by clamping the
current RLIMIT_RTTIME to what RealtimeKit accepts. Warn about doing
this.
2013-06-10 16:52:44 +03:00
Tanu Kaskinen
baee32f2ee .gitignore: Add lo-latency-test 2013-06-06 13:56:30 +03:00
Javier Jardón
7179e7565f build-sys: Do not AC_SUBST *_CFLAGS and *_LIBS
PKG_CHECK_MODULES() already do that for us
2013-06-06 13:30:10 +03:00
Javier Jardón
c58bb9bd62 build-sys: Use build-aux directory to store autogenerated files 2013-06-06 10:10:19 +03:00
Javier Jardón
5b0aaecb0b build-sys: Use autoreconf in bootstrap.sh 2013-06-06 10:03:03 +03:00
Arun Raghavan
c6df40a539 tests: Make loopback latency test more accurate
This makes sure that we always take the timing at the point when we
write out the pulse, making the overall latency measurement more
accurate.
2013-06-04 00:38:44 +05:30
Arun Raghavan
e001cc1424 tests: Factor out loopback setup code
This moves over setup code for the loopback latency test into a private
library so that we can easily write more tests using the same framework.
2013-06-04 00:38:44 +05:30
Arun Raghavan
36bdd720aa tests: Adjust latency test calibration
This makes the test more robust by:

1. Decreasing the '1' threshold during calibration - the RMS value for
   the sine wave will be 0.5, so the previous code was making us take
   the ALSA mixer past 0dB.

2. Using the difference rather than absolute value for 0->1 transitions,
   so that we're somewhat independent noise in our calculations.
2013-06-04 00:38:44 +05:30
Arun Raghavan
3f16c7100b tests: Make loopback latency test run with rt priority 2013-06-04 00:38:44 +05:30
Arun Raghavan
0862a281aa tests: Add a latency measurement test
This test is intended to measure real latency by playing a sample to a
sink and capturing that over a loopback interface. The loopback can
either be physical (cable running from headphone out to line in) or
virtual (monitor source or module loopback).

Also included in this is calibration code to make sure that volumes are
sufficiently adjusted to be able to detect the played back signal (and
that there aren't false positives due to line noise).

One of the objectives of all this is to later factor out the setup code
to allow us to easily write more loopback tests for various
functionality (volumes, resampling, mixing, etc.).
2013-06-04 00:38:44 +05:30
Tanu Kaskinen
50af14bd5b bluetooth: Fix input port description 2013-06-04 00:38:43 +05:30
Arun Raghavan
5ae5dee75e zeroconf: Make Avahi usage in m-z-publish async
This pushes all avahi-client code to a threaded mainloop from the PA
mainloop context. We need to do this because avahi-client makes blocking
D-Bus calls, and we don't want to block the mainloop for that long.

The only exception to this now that I don't see a workaround for is
during module unload time. However, this shouldn't be a huge problem
since in most cases, this will only happen at server shutdown time.

The bulk of the change is partitioning the data so that PA core objects
only (well, mostly) get accessed in the PA mainloop and Avahi calls
happen only in the Avahi threaded mainloop.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=58758
2013-06-04 00:38:43 +05:30
Arun Raghavan
8d129977ca mainloop: Add API to set thread name for threaded mainloop 2013-06-04 00:38:43 +05:30
Arun Raghavan
1b0136be44 pulsecore: Fix assert in pa_msgobject creation
Allows for creation of derived types that don't have any other fields.
2013-06-04 00:38:43 +05:30
poljar (Damir Jelić)
126a80f3b9 shell-completion: Add list-cards to the pacmd completion.
The list-cards command was missing for both of the shell completions.
This fixes it.
2013-06-04 00:38:43 +05:30
Peter Meerwald
b0ee51e19e rescue-streams: Fix wording of module description
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2013-06-04 00:38:43 +05:30
Peter Meerwald
73b816d6ac intended-roles: Fix typo in module description
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2013-06-04 00:38:43 +05:30
Peter Meerwald
83c3cf0a65 pactl: Use colon to separate priority in profiles output
for example:
  Profiles:
	input:analog-stereo: Analog Stereo Input (sinks: 0, sources: 1, priority. 60)
	output:analog-stereo: Analog Stereo Output (sinks: 1, sources: 0, priority. 6000)

it should be "priority: xxx", not "priority. xxx"

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2013-06-04 00:38:43 +05:30
Mitchell Fang
2dcf052e13 thread-mainloop: Fix bug in example code
Checking the operation state caused a deadlock, because the state
won't change before my_drain_callback() returns, and it doesn't
return before my_drain_stream_func() calls
pa_threaded_mainloop_accept().
2013-06-04 00:38:43 +05:30
Peter Meerwald
9c11749258 cli: Fix plural in caption of source-outputs list
$ pacmd list-source-outputs
>>> 4 source outputs(s) available.

outputs(s) makes no sense

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2013-06-04 00:38:42 +05:30
Mikel Astiz
0e4c16e120 bluetooth: Support transport auto-release
With BlueZ 5, if the remote device suspends the audio, the transport
state will change to "idle" and the endpoint is not required to release
the transport, since this could introduce race conditions. Therefore,
ignore the call to pa_bluetooth_transport_release() if the transport is
not acquired any more.
2013-06-04 00:38:42 +05:30
Mikel Astiz
9615def4b9 bluetooth: Update to new BlueZ 5 transport acquire/release API
The new D-Bus API doesn't support access rights, which weren't used by
PulseAudio anyway, but it does solve a race condition: now optional
acquires can be implemented by bluetooth-util atomically using the D-Bus
TryAcquire() method.
2013-06-04 00:38:42 +05:30
Mikel Astiz
6fdf2b05b8 bluetooth: Support media transport's State property
BlueZ 5 exposes a 'State' property in the media transport interface.
With regard to PA, this replaces the profile-specific interfaces, since
they were being used to know if the audio was streaming or not.
2013-06-04 00:38:42 +05:30
Mikel Astiz
2f79fb580a bluetooth: Parse media transport's properties
Add the code to parse the properties of the media transport object when
a PropertiesChanged signal is received.

Note that the transport might have an owner other than BlueZ, and thus
the property changes would be emitted from arbitrary senders. For
performance reasons, the installed match considers the interface name
where the property has changed.

It could be possible to install and remove the D-Bus matches dynamically
when a new owner is registered/unregistered, but filtering based on the
interface name seems good enough already.
2013-06-04 00:38:42 +05:30
Mikel Astiz
235611a7d1 bluetooth: Support Properties.PropertiesChanged signal
Install matches for signal Properties.PropertiesChanged and process the
properties corresponding to the tracked devices.
2013-06-04 00:38:42 +05:30
Mikel Astiz
114edb0696 bluetooth: Support ObjectManager interface add/remove
Install matches for signals ObjectManager.InterfacesAdded and
ObjectManager.InterfacesRemoved, and process the devices that are
registered and unregistered dynamically.
2013-06-04 00:38:42 +05:30
Arun Raghavan
ab37be46f6 core: Add an "internal" suspend cause
This lets us suspend devices from within the core for short periods
without having to overload one of the existing suspend causes.

https://bugs.freedesktop.org/show_bug.cgi?id=64118
2013-06-04 00:38:42 +05:30
Nikolay Amiantov
8cc4e7786f pactl: Flush stdout buffer when printing subscribe events.
"pactl subscribe" is running continuously, and without flushing its output is
not usable for "process-on-arrival" per-line tasks, such as grepping. This
patch should fix this. For example, now:
pactl subscribe | grep 'server'
should print only server events as they arrive.
2013-06-04 00:38:41 +05:30
Mikel Astiz
cfb96b2530 bluetooth: BlueZ 5 interface rename to org.bluez.MediaTransport1
Use the new interface name if BlueZ 5 has been detected.
2013-06-04 00:38:41 +05:30
Mikel Astiz
61e8fd8854 bluetooth: BlueZ 5 interface rename to org.bluez.Media1
Use the new interface name if BlueZ 5 has been detected.
2013-06-04 00:38:41 +05:30
Mikel Astiz
d22ea7ff76 bluetooth: BlueZ 5 interface rename to org.bluez.MediaEndpoint1
Use the new interface name if BlueZ 5 has been detected.
2013-06-04 00:38:41 +05:30
Tanu Kaskinen
d9ed42c40f bluetooth: Fix error checking style 2013-06-04 00:38:41 +05:30
Mikel Astiz
c4bd51a345 bluetooth: Parse the tree returned by ObjectManager
Parse the result of ObjectManager.GetManagedObjects(), which includes
all objects registered, their interfaces and the corresponding
properties per interface.
2013-06-04 00:38:41 +05:30
Mikel Astiz
2247b18739 bluetooth: Detect BlueZ 5
Check the existence of ObjectManager to detect the version of the
running daemon. If the interface exists, it should be BlueZ 5.
2013-06-04 00:38:41 +05:30
Tanu Kaskinen
aacac20e76 module: Assign the index before calling init()
Any code that runs inside the init() callback sees an invalid module
index. Sometimes init() does things that cause hooks to be fired. This
means that any code that uses hooks may see an invalid module index.
Fix this by assigning the module index before init() is called.

There are no known issues in the upstream code base where an invalid
module index would be used, but an out-of-tree module
(module-murphy-ivi) had a problem with this.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=63923
2013-06-04 00:38:41 +05:30
João Paulo Rechi Vita
6cc974844e bluetooth: Remove the 'bluez.name' property
The 'Name' property of the Device interface became optional in BlueZ 5
and may not be present anymore (that happens when testing against the
PTS 4.7.0), so it's better not to expose it to clients so they don't
rely on its existence.
2013-06-04 00:38:41 +05:30
João Paulo Rechi Vita
5b48062f94 bluetooth: Use 'Alias' value as the device description
The 'Alias' property should be preffered over the 'Name' property,
according to the BlueZ API documentation.
2013-06-04 00:38:40 +05:30