Commit graph

2014 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
Tanu Kaskinen
485106d560 device-restore: When restoring volume, print the restored volume to the log. 2012-11-04 10:07:31 +01:00
Tanu Kaskinen
0a8634f03e match: Use the SINK_INPUT_FIXATE hook instead of NEW.
The callback relies on the sample spec being finalized, which is not
true with the NEW hook.

In case you're wondering about the "hook EARLY - 1, to match before
stream-restore" comment that was not changed even though the code that
the comment concerned was changed: the comment was apparently written
at a time when module-stream-restore used the NEW hook too, and later
stream-restore has been changed to use the FIXATE hook. So, the
comment was wrong/nonsensical before this patch. Since these two
modules now use the same hook again, the comment makes sense again.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=55135
2012-10-30 16:32:34 +02:00
Tanu Kaskinen
0da87df4ec combine: Keep the timer active in the null mode only when running.
Previously thread_func() used PA_SINK_IS_OPENED() to check whether
some data should be rendered. process_render_null() used a different
check: it would return immediately if the sink was not in the RUNNING
state. This caused a busy loop when the sink was in the IDLE state,
because process_render_null() didn't update the timestamp, and
thread_func() still kept the timer active using the old timestamp.
pa_rtpoll_run() would return immediately because of the old timestamp.

This is fixed by using the same check in both thread_func() and
process_render_null(). Since the checks are the same, it's actually
redundant to have the check in process_render_null(), so it is now an
assertion.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=54779
2012-10-30 16:30:08 +02:00
Tanu Kaskinen
3adbb5ad03 virtual-surround-sink: Fix setting max_request and max_rewind.
The sink has different frame size than the sink input, so
the max_request and max_rewind values of the sink input need
to be converted when setting the sink max_request and
max_rewind values.

The conversion is already done correctly in
sink_input_update_max_request_cb() and
sink_input_update_max_rewind_cb().
2012-10-30 16:28:48 +02:00
Tanu Kaskinen
1fc2cf8425 loopback: Don't fix the source output format/rate/channels.
Once the sink input has been routed in pa_sink_input_new(),
the sample spec and channel map have already become fixed.
The sink input and source output must use the same stream
format, because the data is copied as-is.
2012-10-30 16:27:17 +02:00
Tanu Kaskinen
a68652a42c loopback: Use the real sample spec once it's known.
When module-loopback is loaded without arguments, the ss and
map variables are initialized with dummy values. This caused
a problem, because also pa_memblockq_new() was called with
the dummy values, making it work incorrectly. The base was
set to 1 instead of the real frame size, which in turn
caused alignment related crashes.
2012-10-30 16:26:06 +02:00
Mikel Astiz
d0be10191e bluetooth: Add hook to announce late UUIDs
UUIDs might be announced at any time, so a hook is needed to notify any
interested module. In practice, the UUIDs are quite stable with the
exception of the pairing procedure, where the UUIDs are reported by
BlueZ as soon as they are discovered.
2012-10-25 13:17:06 +03:00
David Henningsson
63ddc0e426 alsa-mixer: Don't let "Mic Jack Mode" alone create a "Line In" path
The IDT/Sigmatel codec driver often creates a "Mic Jack Mode" for
every mic jack, so it can change functionality between Mic and Line In.

However, as the "Mic Jack" is the standard naming, our current solution
does not make the Line In port unavailable when nothing is plugged in.

This patch makes the "Line In" port not to be created just because there
is a "Mic Jack Mode" that could be set to "Line". This makes the behaviour
consistent with e g "Dock Mic Jack Mode", "Front Mic Jack Mode" etc, where
we don't create a "Dock Line" or "Dock Mic" port either.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-10-24 12:40:26 +02:00
Peter Meerwald
2a33b07d69 rtp: Fix warning using pa_assert_not_reached()
modules/rtp/module-rtp-recv.c:462:8: warning: 'r' may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2012-10-24 12:24:57 +03:00
Niels Ole Salscheider
7448ef14ba virtual-surround: Limit the number of hrir samples.
v2: better log message
2012-10-24 12:13:29 +03:00
Niels Ole Salscheider
e32a408b3c virtual-surround: Add silence to hrir if necessary.
Otherwise, the hrir might be too short to get completely resampled

v2: take different sample rates into account
2012-10-24 12:11:54 +03:00
Tanu Kaskinen
82e44a9f45 rtp: Fix rtp_port reading.
pa_atou() return value was not checked, and the cast of a
16-bit variable pointer to a 32-bit variable pointer could
corrupt cseq.
2012-10-23 13:29:59 +03:00
Mikel Astiz
bb038f76af bluetooth: Refactor code to create profile ports
Put the created ports in a hashmap, but not necessarily inside a struct
pa_card_new_data.
2012-10-23 11:56:13 +03:00