Commit graph

2631 commits

Author SHA1 Message Date
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
Mikel Astiz
e3d3a232e3 bluetooth: Refactor code to create card profiles
Use a helper function to create the card profiles, given an UUID.
2012-10-23 11:43:19 +03:00
Peter Meerwald
2070ec97d3 echo-cancel: Fix false warning in webrtc AEC.
CXX      libwebrtc_util_la-webrtc.lo
modules/echo-cancel/webrtc.cc: In function 'pa_bool_t pa_webrtc_ec_init(pa_core*, pa_echo_canceller*, pa_sample_spec*, pa_channel_map*, pa_sample_spec*, pa_channel_map*, uint32_t*, const char*)':
modules/echo-cancel/webrtc.cc:196:9: warning: 'rm' may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2012-10-23 11:10:58 +03:00
Mikel Astiz
0b72a87c26 bluetooth: Hold device pointer while module loaded
Instead of repeatedly asking the discovery API to find a device given
our device path, let's hold a pointer to the device and make sure we
remove the reference when the hook is fired reporting that the device
has been removed. This makes the code easier to follow and slightly
more efficient.
2012-10-22 19:01:42 +03:00
Mikel Astiz
ea45f2c795 bluetooth: Self unload module-bluetooth-device
If the device has been removed, unload the module without depending on
module-bluetooth-discovery.
2012-10-22 18:51:19 +03:00
Mikel Astiz
97bdeaaacd bluetooth: Add hook to tell device was removed
Add a hook to report that the device was removed, and thus references to
it should be released.
2012-10-22 18:44:54 +03:00
Mikel Astiz
24c1892a1f bluetooth: Remove const qualifier for device
The internal API in bluetooth-util should not use the const qualifier
for operations involving a device object. After all, the structure
contains many pointers and thus the const qualifier provides no real
protection.
2012-10-22 18:37:35 +03:00
David Henningsson
3bb0b88beb alsa-sink/source: Warn for scheduling delays
Sometimes the kernel does not schedule us in due time, thus causing
an underrun. Adding a detection and a debug message will be a helpful
step in determining the cause of an underrun.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-10-22 18:08:23 +03:00
Mikel Astiz
1b83e3fe5f bluetooth: Hold transport pointer while profile set
Instead of repeatedly asking the discovery API to find a transport given
our transport path, let's hold a pointer to the transport and make sure
we remove the reference when the hook is fired reporting that the
transport has been removed. This makes the code easier to follow and
slightly more efficient.
2012-10-19 18:36:48 +03:00
Mikel Astiz
3ddff2f3e5 bluetooth: Set to off instead of failing module load
If the profile setup fails during module load, the fallback should be
setting the profile to off, exactly as it is done in card_set_profile().
2012-10-19 18:32:24 +03:00
Mikel Astiz
9b9e53d144 bluetooth: Set to off if transport removed
The recently added hook can be used to detect that the transport being
used has been removed. In this case, the profile needs to be set to off.

Additionally, the change fixes a significant problem: without this
transition, the transport could be destroyed while the hook slots (i.e.
nrec_changed_slot) were still set. This led to a double free of these
objects in stop_thread().
2012-10-19 18:31:01 +03:00
Mikel Astiz
6e5f78e0af bluetooth: Add hook to tell transport was removed
Add a hook to report that the transport was removed from D-Bus, and thus
references to it should be released.
2012-10-19 18:27:04 +03:00
Mikel Astiz
640038cc28 bluetooth: Remove const qualifier for transports
The internal API in bluetooth-util should not use the const qualifier
for operations modifying the transport object. This is specially useful
in order to use the available hooks.
2012-10-19 18:24:22 +03:00
Mikel Astiz
e68712acb4 bluetooth: Check return value of start_thread()
The function can return an error, so in that case the profile change
should fail.
2012-10-19 18:22:51 +03:00
Mikel Astiz
fcfc0e536a bluetooth: Check return value of init_profile()
If profile could not be successfully initialized, the card should be
set to PROFILE_OFF automatically. If sinks or sources exist, they need
to be destroyed, therefore stop_thread() is called.
2012-10-19 18:21:18 +03:00
Mikel Astiz
8b1236531e bluetooth: Use assertions when setting off profile
Setting the card profile to off cannot fail, therefore assertions can be
used when calling pa_card_set_profile().
2012-10-19 18:18:51 +03:00
Mikel Astiz
2e303b8600 bluetooth: Remove stream moving code
Remove stream moving policies from module-bluetooth-device. It is not
clear if such policies are needed at all and in case yes, they should be
implemented in module-bluetooth-policy.
2012-10-18 20:01:52 +03:00
Mikel Astiz
fcaef8285a bluetooth: Unlink sink-sources in stop_thread()
Avoid duplicated code by moving the unlinking of sinks and sources to
stop_thread(). After all, they need to be unlinked when the thread is
stopped.
2012-10-14 19:31:43 +03:00
Mikel Astiz
8560b495bd bluetooth: Release transport in stop_thread()
Avoid duplicated code by releasing the transport inside stop_thread(),
along with the rest of the thread-related cleanup.
2012-10-14 19:31:40 +03:00
Mikel Astiz
0c5054e04a bluetooth: Don't find device if set profile is off
If the card is being set to off profile, it is not necessary to check
if the device exists. This could potentially happen during shutdown,
immediately before the module is unloaded.
2012-10-14 19:25:29 +03:00
Mikel Astiz
b76ee00873 bluetooth: Fix potential assertion failure
It might happen that a PropertyChanged signal is received but the
corresponding card profile has not been created, leading to an assertion
failure in filter_cb() due to inexistent ports. This can happen if BlueZ
misbehaves, or also if the UUIDs are reported later on (i.e. during
pairing discovery). In any case, the signal should just be ignored.
2012-10-14 19:20:58 +03:00
Mikel Astiz
94dbf25e81 bluetooth: Trivial function rename
Former setup_bt() was just setting up the transport, so it's easier to
follow if the function name makes this more explicit.
2012-10-14 19:17:01 +03:00
Mikel Astiz
67c0090556 bluetooth: Ignore Device.DisconnectRequested
Handling the signal DisconnectRequested should be unnecessary since the
profile-specific interfaces will be later disconnected, leading to
module unload.

Additionally, the signal is problematic: if an interface (i.e.
A2DP AudioSource) is playing at the time DisconnectRequested is
signaled, the following sequence can occur:

1. AudioSource is playing
2. DisconnectRequested is received
3. Module is unloaded due to DisconnectRequested
4. AudioSource state changes from playing to connected
5. module-bluetooth-discover loads the module
6. AudioSource state changes from connected to disconnected

Therefore the module is unnecessarily loaded, to be unloaded immediately
afterwards. This can easily be reproduced if a device is unpaired while
the audio is streaming.

The simplest solution to this consists of removing step 3, by just
ignoring the DisconnectRequested signal. This reverts commit
8169a6a6c9.
2012-10-14 19:16:21 +03:00
Chan-yeol Park
f0432ce6ae bluetooth: Remove ipc.[ch] files in the bluetooth module
These files are remove in the bluez project.
In case of definitions in the ipc files
we could use defintions in the a2dp-codecs.h
2012-10-06 14:38:59 +03:00
David Henningsson
ba0203c4c0 alsa-mixer: Remove analog-output-lfe-on-mono
Upstreamed from Debian: "Although in principle Ac '97 hardware has a
separate mono LFE pin nothing seems to use it. To make matters worse
it does confuse PulseAudio's port selection slightly which causes
audio in virtualbox not to work out of the box."

Credit: Sjoerd Simons <sjoerd@debian.org>
Credit: Martin-Éric Racine <martin-eric.racine@iki.fi>
BugLink: https://bugs.launchpad.net/bugs/1016969
BugLink: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=673847
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-10-04 13:32:35 +02:00
David Henningsson
2caafa7741 alsa-mixer: Cache failure to open inputs/output mappings
I was hoping this would improve bootup speed, but it doesn't seem
to do so here, at least not much. But at least it reduces the logs
a little.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-10-03 00:15:45 +03:00
Mikel Astiz
bf0a640cfd bluetooth: Add port availability transition policies
Handle availability changes in Bluetooth ports inside
module-bluetooth-policy. The implemented behavior is similar to how
module-switch-on-port-available behaves, but the conditions are more
relaxed and thus more profile changes are triggered.
2012-09-26 19:52:10 +08:00
Mikel Astiz
d84e36563c bluetooth: Let suspend-on-idle request audio in headset
When PA is doing gateway role, let module-suspend-on-idle resume the
audio stream automatically. This will work until the user (or the remote
side, which we also consider user-initiated) suspend the stream
manually.
2012-09-26 19:52:10 +08:00
Mikel Astiz
e492f2912e bluetooth: Do not switch to HFGW automatically
Card profile hfgw should be no different from the rest, and thus no
internal policy inside module-bluetooth-device should decide to switch
to its profile automatically.

This should be handled by policy modules.
2012-09-26 19:27:15 +08:00
Mikel Astiz
cb2a6d34f6 bluetooth: Release transport when not available
Handle the Playing->Connected transition gracefully by releasing the
transport and setting the sink and sources as suspended. This is
necessary since the IO thread might not encounter a HUP always.
2012-09-26 19:27:15 +08:00
Mikel Astiz
ebadda816d bluetooth: Acquire transport when becomes available
Try to acquire the transport as soon as the audio stream is started,
along with the availability flag update.
2012-09-26 19:27:14 +08:00
Mikel Astiz
b8fd6f869e bluetooth: Do not acquire transport during profile change
Until today, setting the card to some profile resulted in a transport
acquisition, leading to audio stream setup. This is generally not very
interesting and even undesireable for HFGW use-cases, where the
Gateway role (the remote end) would typically request the SCO link.

Nevertheless, there is no safe way to implement such check without race
conditions, since the BlueZ's state can change between the state report
and the call to Acquire(). The chances for this to reproduce are quite
low though, since interface state changes are relatively slow.

This race condition requires that BlueZ's API is extended in order to
perform the operation atomically, which has already been discussed and
ack-ed in the BlueZ mailing list.

Note that this patch does not introduce a new race condition, since it
already existed before (the PropertyChanged->Acquire race condition,
affecting HFGW use-cases). It is just more explicit now.
2012-09-26 19:27:14 +08:00
Mikel Astiz
884d1d46ca bluetooth: Set profile even if transport not acquired
If the acquisition of the transport fails, the profile should still be
set. In this case the audio is not actually streaming, so the sink and
source will be created but left suspended.

If the transport needs to be acquired later, for example because the
user wants to route the audio the remote device, the suspend flag should
have to be changed.
2012-09-26 19:27:14 +08:00
Mikel Astiz
dcc11dcbe9 bluetooth: Support port availability flag
Use the port availability flag to expose whether a certain profile is
connected and whether it's doing actual audio streaming.

The proposed mapping is the following:
- Profile disconnected: port is unavailable
- Profile is connected (but not streaming/playing): availability unknown
- Profile is streaming/playing: port is available

The availability-unknown is specially interesting: it involves that if
the sink/source exists (corresponding card profile set), it is currently
in suspended state.

For example, for SCO cases (HFGW or HSP), this means the SCO is down. A
policy module would typically not change this, unless someone is really
trying to use the sink/source. This situation would be nicely handled by
module-suspend-on-idle, which would automatically connect SCO.

On the other hand, if the user wants to control the status of the SCO,
it will still be possible by resuming the sink or source (suspend=0).
This works out-of-the-box since most UIs would show to the user ports
whose availability is unknown.
2012-09-26 19:27:14 +08:00