Commit graph

2631 commits

Author SHA1 Message Date
Tanu Kaskinen
60f1e695fd loopback: Increase the maximum allowed latency
Currently the biggest possible sink latency is 10 seconds. The total
latency of the loopback is divided evenly for the source, an
intermediate buffer and the sink, so if I want to test 10 s sink
latency, the total needs to be three times that, i.e. 30 seconds.
2013-07-29 10:43:12 +03:00
David Henningsson
908deb136c alsa-ucm: Make combination ports have lower priority
Usually, you want to use one input or output at a time: e g,
you expect your speaker to mute when you plug in headphones.

Therefore, the headphones+speaker port should have lower priority
and both headphones and speaker.

A practical formula to do this is 1/x = 1/xa + 1/xb + .. + 1/xn.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2013-07-26 14:30:08 +02:00
Tanu Kaskinen
7c3d31abe7 dbus: Fix invalid dbus_bool_t values
libdbus doesn't like it if it's passed a boolean whose value is not 0
nor 1.
2013-07-17 23:17:23 +03:00
Tanu Kaskinen
b76b9c32d9 ucm: Fix an incorrect log message
The log message didn't match the code, so one of them was wrong. It's
entirely possible that the code is wrong, but I didn't have the
motivation to study the code enough to understand what the code is
supposed to do.
2013-07-15 17:09:07 +03:00
João Paulo Rechi Vita
ed4d0d989c bluetooth: Fix coding style 2013-07-15 13:08:20 +03:00
João Paulo Rechi Vita
4359647841 bluetooth: Remove unused DBusError 2013-07-15 13:08:16 +03:00
Tanu Kaskinen
705d3c28f2 tunnel: Fix reading state from wrong variable
u->sink->state is not yet updated, so the state must be read from
u->sink->thread_info.state. This makes pausing and resuming of the
smoother happen at the right time.

Thanks to Pierre Ossman for the patch.
2013-07-14 13:39:32 +03:00
Pierre Ossman
e55f4edaad alsa: Support ALSA without a use case manager
The ALSA use case manager is a fairly recent addition,
so make sure the ALSA modules can be used on systems that
have an older version of ALSA.
2013-07-11 14:30:06 +03:00
Tanu Kaskinen
ee5e245afa Use pa_(c)volume_snprint_verbose() everywhere
All pa_cvolume_snprint(), pa_volume_snprint(),
pa_sw_cvolume_snprint_dB() and pa_sw_volume_snprint_dB() calls have
been replaced with pa_cvolume_snprint_verbose() and
pa_volume_snprint_verbose() calls, making the log output more
informative and the code sometimes simpler.
2013-07-09 17:37:04 +03:00
Mikel Astiz
8c81f4d0bd loopback: Fix cork state not updated after move
The source output and sink inputs should be corked if the corresponding
sink/source is suspended, as handled during module initialization. This
also needs to be handled during stream move, because the suspend state
of the destination sink/source might be different to the previous one.

This fixes the issue with an infinite number of "Requesting rewind due
to end of underrun" traces after a stream move.
2013-07-08 17:53:28 +03:00
poljar (Damir Jelić)
b358aea89b Revert dbus_bool_t variables to use TRUE/FALSE instead of true/false 2013-07-04 12:25:47 +03:00
poljar (Damir Jelić)
408f0ba783 Fix alignment issues introduced by the pa_bool -> bool conversion 2013-07-04 12:25:40 +03:00
poljar (Damir Jelić)
d806b19714 Remove pa_bool_t and replace it with bool.
commands used for this (executed from the pulseaudio/src directory):
    find . -regex '\(.*\.[hc]\|.*\.cc\|.*\.m4\)' -not -name 'macro.h' \
        -a -not -name 'reserve.[ch]' -a -not -name 'reserve-monitor.[ch]' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'poll-win32.c' -a -not -name 'thread-win32.c' \
        -a -not -name 'dllmain.c' -a -not -name 'gconf-helper.c' \
        -exec sed -i -e 's/\bpa_bool_t\b/bool/g' \
        -e 's/\bTRUE\b/true/g' -e 's/\bFALSE\b/false/g' {} \;

and:
    sed -i -e '181,194!s/\bpa_bool_t\b/bool/' \
        -e '181,194!s/\bTRUE\b/true/' -e \
        '181,194!s/\bFALSE\b/false/' pulsecore/macro.h
2013-07-04 12:25:30 +03:00
Tanu Kaskinen
944ffb0323 device-manager: Refuse to load empty descriptions 2013-07-02 17:49:17 +03:00
David Henningsson
242b8e5fd3 Revert "alsa-mixer: Add a couple of assertions"
This reverts commit 2613e4c747.

Please don't replace correct NULL pointer checks with assertions.
2013-06-28 16:16:22 +02:00
Tanu Kaskinen
67132eea1a device-manager: Add a sanity check for reading entries
There is code elsewhere that assumes that if user_set_description is
true, then the description is non-NULL.
2013-06-28 09:58:07 +03:00
Tanu Kaskinen
491c6a3a0b waveout: Simplify setting the device description 2013-06-28 09:57:05 +03:00
Tanu Kaskinen
2613e4c747 alsa-mixer: Add a couple of assertions
I checked the code to ensure that the assertions hold currently.
2013-06-27 19:18:36 +03:00
poljar (Damir Jelić)
97da92d894 Whitespace cleanup: Remove all multiple newlines
This patch removes all occurrences of double and triple
newlines.

Command used for this:
find .  -type d \( -name ffmpeg \) -prune -o \
        -regex '\(.*\.[hc]\|.*\.cc\)' \
        -a -not -name 'adrian-aec.*' -a -not \
        -name reserve.c -a -not -name 'rtkit.*' \
        -exec sed -i -e '/^$/{N;s/^\n$//}' {} \;

Two passes were needed to remove triple newlines.
The excluded files are mirrored files from external sources.
2013-06-24 16:56:24 +03:00
poljar (Damir Jelić)
e95d054e40 Style fix: Remove new lines from opening brackets
This patch replaces every occurrence of ')\n{' with ') {'.

Command used for this:
    find .  -type d \( -name ffmpeg \) -prune -o \
        -regex '\(.*\.[hc]\|.*\.cc\)' \
        -a -not -name core-util.c -a -not \
        -name adrian-aec.c -a -not -name g711.c \
        -exec sed -i -e '/)$/{N;s/)\n{$/) {/}' {} \;

The excluded files are mirrored files from external sources.
2013-06-24 16:56:24 +03:00
poljar (Damir Jelić)
cbd274676d Style fix: Add a space between the closing/opening bracket
This patch replaces every occurrence of '){' with ') {'.
The ffmpeg source tree was excluded since it will disappear anyways.

Command used for this:
    find . -type d \( -name ffmpeg \) -prune -o \
        -regex '\(.*\.[hc]\|.*\.cc\)' \
        -exec sed -i -e 's/){/) {/' {} \;
2013-06-24 16:56:24 +03:00
poljar (Damir Jelić)
faf991ce22 Style fix: Add a space betwen the if statement and the opening bracket
This patch replaces every occurrence of 'if(' with 'if ('.
The ffmpeg source tree was excluded since it will disappear anyways.

Command used for this:
    find . -type d \( -name ffmpeg \) -prune -o \
            -regex '\(.*\.[hc]\|.*\.cc\)' \
            -exec sed -i -e 's/ if(/ if (/' {} \;
2013-06-24 16:56:24 +03:00
poljar (Damir Jelić)
5e11ea06ef Whitespace cleanup: Fix broken indentation by hand
This patch fixes wrong indentation introduced by the last patch.

This was mostly done with vim-s retab feature.
2013-06-24 16:56:24 +03:00
poljar (Damir Jelić)
aab63a3499 Whitespace cleanup: Remove tabs
This patch removes all tabs hidden inside the source tree and replaces
them with 4 spaces.

Command used for this:
    find . -type d \( -name bluetooth \) -prune -o
    -regex '\(.*\.[hc]\|.*\.cc\)' -a -not -name 'reserve*.[ch]'
    -a -not -name 'gnt*.h' -a -not -name 'adrian*'
    -exec sed -i -e 's/\t/    /g' {} \;

The excluded files are mirrored files from external sources containing
tabs.
2013-06-24 16:56:24 +03:00
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
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
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
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
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
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
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
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
João Paulo Rechi Vita
6e73c05cbc bluetooth: Add 'bluez.alias' property 2013-06-04 00:38:40 +05:30