Commit graph

6735 commits

Author SHA1 Message Date
Mikel Astiz
1db09d3013 reserve: Fix leaking NameLost signals after release+acquire
The use of the pseudo-blocking D-Bus calls leads to the problem that
NameLost signals are received after the reply to ReleaseName().

The problem with this is that a later acquisition of the same audio
device can potentially receive the NameLost signal corresponding to
the previous instance, due to the fact that the signal hasn't been
popped from the D-Bus message queue.

The simplest approach to solve this problem is to poll the actual name
owner from the D-Bus daemon, in order to make sure that we did really
lose the name.

The proposal uses a blocking call to GetNameOwner to avoid incosistent
states in the internal APIs: it would otherwise be possible to have a
"busy" device before the reservation has been lost, in the unlikely
case if some other process acquires the name before we got the
confirmation that the NameLost was actually true.
2013-02-18 19:35:28 +02:00
Mikel Astiz
88a7b31ca7 reserve: Move get_name_owner() to the public rd_device API
The function is interesting for both rd_device and rd_monitor so make
it part of the rd_device public API to avoid duplicated code.

The decision to move the function to reserve.c is motivated by the fact
that other projects (i.e. jack) use reserve.c only. Therefore, adding a
reserve->reserve-monitor dependency should be avoided.
2013-02-18 19:35:19 +02:00
Tanu Kaskinen
b1691402be Initialize monitor's busy status to false if we own the device.
Bug found by David Henningsson.
2013-01-17 11:45:38 +01:00
Tanu Kaskinen
e02e290d7c Call change_cb() only when there's an actual change.
Calling change_cb() whenever anything happens in the ownership of the
bus name caused trouble in PulseAudio in this scenario:

1. PulseAudio is using a device and owns the corresponding service
   name.
2. Another application requests device release.
3. PulseAudio releases the device.
4. Change in the bus name ownership: PulseAudio gives up the
   ownership, and nobody owns the name.
5. reserve-monitor notices that, and notifies PulseAudio.
6. Since reserve-monitor reports the device as "not busy", PulseAudio
   decides to reserve the bus name immediately back to itself and
   opens the device again.

The other application will forcibly take the bus name to itself, as
it should according to the protocol, but the other application may
have trouble opening the device if it tries to do that before
PulseAudio has had time to react to the NameLost signal.

This can be solved by not calling change_cb() if there are no changes
in the device busy status. In this scenario the device is considered
"not busy" while PulseAudio is owning the bus name, so PulseAudio gets
no notification when the ownership changes from PulseAudio to nobody.
2013-01-17 11:45:27 +01:00
Tanu Kaskinen
3ffa0bc62a build: Don't enable BlueZ if libbluetooth is not found.
Previously, if libsbc was available but libbluetooth was not, BlueZ
would get incorrectly enabled.
2012-12-20 12:36:17 +05:30
Tanu Kaskinen
e5155b4f50 man: Update log-target documentation. 2012-12-20 12:36:17 +05:30
David Henningsson
299e32b767 alsa-mixer: Fix the analog-output-speaker-always path
A left over "required-any" made this path useless for most people.
While we're at it, also add "Front Headphone" like for the normal
speaker path.

Tested-by: Colin Guthrie <gmane@colin.guthr.ie>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-12-20 12:33:24 +05:30
Arun Raghavan
fc2f741f61 build-sys: Bump soname 2012-12-17 14:30:09 +05:30
David Henningsson
0f6bbcc3a5 alsa-mixer: Add device.icon-name property for some common ports
If we expose this information, UIs can use this to make better
decisions about what icon to display.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-12-07 16:37:23 +01:00
Arun Raghavan
18b79d2e13 build-sys: Bump soname 2012-12-07 09:00:50 +05:30
David Henningsson
0f865da0e2 alsa-mixer: Add Dell Inspiron One 2020 to mic whitelist
BugLink: https://bugs.launchpad.net/bugs/1073420
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-12-05 14:34:54 +01:00
David Henningsson
2ee864970c alsa udev quirks: Add some more Dell devices to speaker whitelist
Added Dell Inspiron 3420, 3520 and Vostro 2420, 2520.

Note that this is only necessary for kernels 3.3 to 3.5, as 3.6
has phantom jack support.

BugLink: https://bugs.launchpad.net/bugs/1076840
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-12-05 14:08:30 +01:00
Arun Raghavan
2a48c2d66f alsa: Try to support non-standard rates in alsa-sink/source
We inadvertantly stopped supporting non-standard rates when the
passthrough work was done. This makes sure that if no standard rates are
supported, we try to fallback to whatever ALSA gives us.
2012-12-05 09:11:27 +05:30
Mikel Astiz
5a791f8a16 bluetooth: Fix unacquired transports during sink resume
The sink can be resumed while the source is still in PA_SOURCE_INIT.
This is the case if a module such as module-stream-restore routes the
audio to the sink during pa_sink_put(), leading to an inconsistent
state: the sink stays RUNNING but the transport is not actually
acquired.
2012-12-05 09:11:27 +05:30
Mikel Astiz
bbb47c67bb bluetooth: Request headset audio during profile switch
When a headset is having a profile switch, we can either leave the
SCO state unmodified (as it was before this patch) or we can
alternatively request it (as older versions of PA).

This patch tries to avoid a potential regression in case a module
such as module-suspend-on-idle is not present, due to the provided
resume-on-running policy. Without this patch, and without such a policy,
the sink and sources would stay suspended until the user manually
performed another profile switch (i.e. hsp->off->hsp).

There are several other solutions currently being discussed as a longer
term solution, some of which require extendind the core. This patch is
therefore proposed as a short-term workaround to avoid the regression.
2012-12-04 03:11:23 +02:00
Mikel Astiz
01435e6134 bluetooth: Do not setup stream before thread starts
bt_transport_acquire() might get called from the main thread, in case
the IO thread hasn't been started yet. In this case, we should not call
setup_stream() since this is going to be called in the beginning of
thread_func().
2012-12-04 03:08:57 +02:00
Mikel Astiz
1dcdb96ee5 bluetooth: Trivially refactor to call setup_stream() directly
If the transport is already acquired and the stream needs to be started,
call setup_stream() directly instead of bt_transport_acquire(u, TRUE).
Both calls are identical in these conditions, with the exception of the
log trace which has now been moved to setup_stream().
2012-12-04 03:07:44 +02:00
Mikel Astiz
6ef23eb4af conf: Load bluetooth-policy module by default
Headset use-cases shouldn't get affected by this module and the support
for A2DP source is interesting, therefore load the module by default.
2012-11-29 05:39:30 +02:00
Mikel Astiz
71bd458bd1 bluetooth: Disable profile auto-switch policy for headsets
Given that headsets have just one single port exposing whether the
audio is streaming (playing) or not, it's not possible that
module-bluetooth-policy would distinguish A2DP/HSP cases, and thus
the automatic selection of the card profile is not deterministic.

For this reason, disable the policy entirely for headsets and focus
only on HFGW and A2DP source profiles.
2012-11-29 05:37:45 +02:00
Mikel Astiz
40329acc1a bluetooth: Merge headset ports into one
Merge the former "hsp-output" and "a2dp-output" ports into one single
port, in order to fix the regression of having several independent
entries in the UI.
2012-11-29 05:36:01 +02:00
Niels Ole Salscheider
523af5b302 virtual-surround: check if resampled memblock is not equal to input
Since commit e32a408b3c, we silence the
input memblock in order to give the resampler enough input samples, if
necessary.
But if there is no need to resample the hrir, the resampled memblock is
actually the same as the input memblock. Thus, we have to make sure that
we do not silence it in this case.
2012-11-29 05:28:39 +02:00
Tanu Kaskinen
41055145d7 bluetooth: Unload device module when no audio profiles connected
Without this patch, device modules will be left around after the
device has been disconnected and when they are reconnected, the
discovery module will load duplicate device module instances.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=57239
2012-11-23 00:18:06 +02:00
Mikel Astiz
0bd428df04 bluetooth: Run the discovery hook only when necessary
This is a minor optimization too, but the main benefit is that it's
makes the code easier to understand (I hope), since run_callback()
won't be called at times when it's not needed.
2012-11-23 00:17:55 +02:00
Tanu Kaskinen
ebf5f29bb3 bluetooth: Add helper pa_bluetooth_device_any_audio_connected()
The new helper function makes it easier to check whether any audio
profiles are connected. That information is needed by the discovery
module for deciding whether a new device module should be loaded. The
device module should use this information too to unload itself at the
right time, but that's currently not implemented.
2012-11-23 00:04:17 +02:00
Mikel Astiz
59c8476d64 bluetooth: Rename former device_is_audio()
Use a more accurate name for the function since it doesn't just check
if it is an audio device (which can be detected quite early), but it
also checks if the most relevant properties (device info, etc.) have
been received.

Besides, add the const qualifier to the pointer since it's not going to
be modified.
2012-11-22 23:51:17 +02:00
Tanu Kaskinen
6545cc77f4 bluetooth: Ignore Device.Connected
The Device.Connected was only used for tracking whether a device module
should be loaded, but that information is already included in the
individual profile state properties. The property can therefore be
completely ignored without any loss in functionality.
2012-11-22 23:43:06 +02:00
Tanu Kaskinen
55baf5424e bluetooth: Add a pa_bluetooth_discovery pointer to pa_bluetooth_device.
This simplifies some function argument lists.
2012-11-22 15:04:26 +02:00
Juho Hämäläinen
868158f115 stream-restore: Add missing method handler argument.
Stream-restore DBus API method argument list is missing last boolean
argument apply_immediately, causing assert to fail in AddEntry handling.

Signed-off-by: Juho Hämäläinen <jusa@hilvi.org>
2012-11-20 11:57:21 +02:00
Arun Raghavan
968c9c45ac core: Remove bad free() call
The string created when trying to use XDG_RUNTIME_DIR is freed before it
is used in a debug message, and is freed again.

https://bugs.freedesktop.org/show_bug.cgi?id=57280
2012-11-19 21:32:18 +05:30
Arun Raghavan
3effdfc16f sink-input, source-output: Check rate update success for passthrough
This makes sure we don't try to plug in a passthrough stream if the
final sink/source sample spec doesn't match what we want. In the future,
we might want to change rate updates to try a full sample spec update
for passthrough streams.

https://bugs.freedesktop.org/show_bug.cgi?id=50951
2012-11-19 13:10:36 +05:30
Arun Raghavan
da4163a85e source-output: Fix volume fixup for rate update
The could that should have been after the rate update ended up being
before, which is incorrect.
2012-11-19 12:56:33 +05:30
Arun Raghavan
93836989e6 build-sys: Drop ChangeLog generation
This drops ChangeLog generation from git. It does not make sense to
distribute 500 kB of ChangeLog given how easy it is these days to browse
history with git.

We might replace this with a release-annoucement-esque high-level
summary of changes.
2012-11-17 10:55:05 +05:30
Arun Raghavan
9b0dff3a58 build-sys: Bump soname 2012-11-17 10:54:16 +05:30
Arun Raghavan
87e89ac4eb build-sys: Bump BlueZ dependency to 4.99
Since the old UNIX fd IPC mechanism was removed and we rely on the D-Bus
based API, this is the oldest version that is known to reliably work.
2012-11-16 23:16:05 +05:30
Arun Raghavan
e5953fb0dd modules: Micro-optimisation for rewind_requested paths
Since some devices can be chatty with regards to how often they return
from poll(), this adds a PA_UNLIKELY() to all the the rewind_requested
checks in our sink modules to make the general case (no rewind was
requested) the fast path.
2012-11-16 23:16:05 +05:30
Tanu Kaskinen
29f064aa3d sink: Process rewind requests also when suspended.
When a rewind is requested on a sink input, the request parameters are
stored in the pa_sink_input struct. The parameters are reset during
rewind processing, and if the sink decides to ignore the rewind
request due to being suspended, stale parameters are left in
pa_sink_input. It's particularly problematic if the rewrite_bytes
parameter is left at -1, because that will prevent all future rewind
processing on that sink input. So, in order to avoid stale parameters,
every rewind request needs to be processed, even if the sink is
suspended.

Reported-by: Uoti Urpala
2012-11-16 23:16:05 +05:30
Arun Raghavan
cd1102cce0 sink, source: Prevent unnecessary rate update attempts
We don't need to try a rate update if the desired sample rate is the
same as the one the sink or source is already using.
2012-11-16 23:16:04 +05:30
David Henningsson
0a0189d972 alsa-mixer: Prefer "Digital Input Source:Digital Mic 1"
...over "Digital Input Source:Analog Input". It makes life a little
easier for users of Dell xps m1330.

Just an old Ubuntu delta I never upstreamed until now.
The patch was originally written by Daniel T Chen <crimsun@ubuntu.com>.

BugLink: https://bugs.launchpad.net/bugs/453966
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-11-16 13:20:34 +01:00
Tanu Kaskinen
872f56dc7e mainloop: Don't care about the mainloop state variable when waking up the mainloop.
If the mainloop is just about to enter polling, but m->state
is not POLLING yet when some other thread calls
pa_mainloop_wakeup(), the mainloop will not be woken up.
It's safe to write to the wakeup pipe at any time, so let's
just remove the check.
2012-11-15 17:57:51 +02:00
Tanu Kaskinen
58de999a31 mainloop: Change wakeup_requested type from pa_bool_t to pa_atomic_t.
The variable is accessed from multiple threads, so it should
be atomic.
2012-11-15 17:52:22 +02:00
David Henningsson
387681d417 alsa-mixer: Add "CLFE" and "Bass Speaker" names
These are sometimes being used in the HDA driver and we should
support them.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-11-14 13:14:08 +01:00
Arun Raghavan
ead5447231 man: Correction for how sample rate switching is disabled
Setting to 0 in the parser causes daemon startup to fail.
2012-11-12 22:24:52 +05:30
Sjoerd Simons
706e7aeb25 build-sys: Correct bluez support error if sbc is missing 2012-11-12 10:25:55 +05:30
David Henningsson
2b26793f0f alsa-mixer: Add a few more machines to internal mic whitelist
Based on feedback in the bug below (comments 128, 129, 131).

BugLink: https://bugs.launchpad.net/bugs/946232
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-11-09 12:14:18 +01:00
Tanu Kaskinen
dfd44036b5 pulse: Fix hole handling in pa_stream_peek().
Previously, if there was a hole in a recording stream,
pa_stream_peek() would crash. Holes could be handled silently inside
pa_stream_peek() by generating silence (wouldn't work for compressed
streams, though) or by skipping any holes. However, I think it's
better to let the caller decide how the holes should be handled, so
in case of holes, pa_stream_peek() will return NULL data pointer and
the length of the hole in the nbytes argument.

This change is technically an interface break, because previously the
documentation didn't mention the possibility of holes that need
special handling. However, since holes caused crashing anyway in the
past, it's not a regression if applications keep misbehaving due to
not handing holes properly.

Some words about when holes can appear in recording streams: I think
it would be reasonable behavior if overruns due to the application
reading data too slowly would cause holes. Currently that's not the
case - overruns will just cause audio to be skipped. But the point is
that this might change some day. I'm not sure how holes can occur
with the current code, but as the linked bug shows, they can happen.
It's most likely due to recording from a monitor source where the
thing being monitored has holes in its playback stream.

BugLink: http://bugs.launchpad.net/bugs/1058200
2012-11-08 15:38:32 +01:00
Arun Raghavan
38c650dca9 introspect: Minor documentation fix
s/pa_latency_info/pa_timing_info
2012-11-08 14:57:48 +05:30
Pierre-Louis Bossart
635eef9981 alsa: get avail, delay, timestamps in a single kernel call
Refactor code to fetch avail, delay and timestamp values
in a single call to snd_pcm_status().
The information reported is exactly the same as before,
however it is extracted in a more atomic manner to
improve timer-based scheduling.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2012-11-07 08:20:19 +01:00
Arun Raghavan
700cd890a9 Revert "tests: modify alsa-time-test to use 'check' framework"
This reverts commit 1569601864.

Rethinking this, it makes more sense to not add this to the check
framework. This is mostly useful for exposing ALSA driver issues, and
it's handy to be able to build this as a standalone executable.
2012-11-05 17:48:20 +05:30
Arun Raghavan
7d97fe56c7 alsa: Drop verbosity on UCM message
We don't need to log an error-level message for missing UCM config.
2012-11-05 17:48:20 +05:30
Deng Zhengrong
7ce7464c16 build: fix Mac OS X configure process
The original header file doesn't exist on Lion (10.7.4).
2012-11-04 10:07:31 +01:00