Commit graph

6945 commits

Author SHA1 Message Date
Mikel Astiz
ccc9a58dd0 bluetooth: Use round() to convert PA<->BT volumes
The code can be simplified since it's just trying to round the result of
the division. Note that the resulting behavior is slightly different,
specially when the volume is 0. In this case, it will remain at 0,
instead of being set to 1.
2012-12-19 12:31:47 +02:00
Mikel Astiz
b36686ea9a bluetooth: Add device pointer to transport
Transports always have an associated device, so add the pointer as a
member to the structure, and remove the discovery pointer since it
already exists in the device object.
2012-12-19 12:31:47 +02:00
Mikel Astiz
80dd7c1070 bluetooth: Remove unused pa_bluetooth_discovery_get_transport()
The function is not used and it also exposes D-Bus-related information
in the internal API, which is in general undesired.
2012-12-19 12:31:47 +02:00
Mikel Astiz
28251e7243 bluetooth: Make pa_bluetooth_transport_parse_property() private
The function is not being used outside bluetooth-util and thus can be
made private.
2012-12-19 12:31:47 +02:00
Mikel Astiz
3f41a4a538 bluetooth: Fix condition to load module
d->hfgw_state is just another profile that should be considered exactly
as the rest inside device_audio_is_ready(), which is being used to
decide if the discovery hook gets triggered.

Therefore, there seems to be no reason to make an exception for this
profile and skip checking if the condition d->audio_state !=
PA_BT_AUDIO_STATE_INVALID holds true.

This change makes no practical difference but delaying the load of the
module also for HFGW until Audio.State is received. The benefit is
that the behavior and the code are more consistent across profiles.
2012-12-19 12:31:47 +02:00
Flavio Ceolin
f9beb8e867 modargs: Adding pa_modargs_get_value_volume()
This function gets a pa_volume_t from a string.
2012-12-19 12:31:47 +02:00
Flavio Ceolin
9e2b6a0b5c sink-input: New volume_factor system
Implement setting of more than one volume factor.  The
real value of the volume_factor will be the multiplication of these
values.
2012-12-19 12:31:47 +02:00
Tanu Kaskinen
bf962a2600 card-restore: Log the restored profile name. 2012-12-19 12:31:47 +02:00
Tanu Kaskinen
0f44b1e820 Log the reason for every suspend/resume.
I was looking at a log that showed that a suspend happened (at
a strange time), but the log didn't tell me why the suspend was done.
This patch tries to make sure that that won't happen again.
2012-12-19 12:31:47 +02:00
Tanu Kaskinen
28c49a12fc esound: Suspend/resume also sources on STANDBY/RESUME commands. 2012-12-19 12:31:47 +02:00
Tanu Kaskinen
3ee3b0f49b mainloop: Check pa_write() return value. 2012-12-19 12:31:47 +02:00
Tanu Kaskinen
7e94a03e0c mainloop: Remove redundant wakeup_pipe validity checks.
The pipe is opened when creating the mainloop and closed
when freeing the mainloop. The pipe fds can never be less
than zero.
2012-12-19 12:31:47 +02:00
Luiz Augusto von Dentz
31d905aaae bluetooth: Add support for transport created by external profile
With BlueZ 5 it is possible to have profile registered by a third party
process which does not share the same bus id as bluetoothd so it is
necessary to store the sender of the transport to be able to talk to it.

Note that this is backward compatible.
2012-12-19 12:31:47 +02:00
Mikel Astiz
d4368aa608 bluetooth: Handle UUIDs announced later
In some cases (typically during pairing) UUIDs might be reported by
BlueZ incrementally, that is, as soon as they have been discovered. At
this point module-bluetooth-device might already be loaded, so the late
UUID announcements need to be handled and additional card profiles
might need to be created accordingly.
2012-12-19 12:31:47 +02:00
Mikel Astiz
ebfd656fc9 dbus: Add signal org.PulseAudio.Core1.Card.NewProfile
Add a new D-Bus signal to report profiles that have been dynamically
created for already existing cards.
2012-12-19 12:31:47 +02:00
Mikel Astiz
9c703f4e2d dbus: Support dynamically created card profiles
Use the recently added core hook to detect when new profiles are added
to a card, and update the D-Bus object accordingly.
2012-12-19 12:31:47 +02:00
David Henningsson
a703451811 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-19 11:24:33 +01:00
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