Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
The current set of bluetooth modules only support up to BlueZ 4. Since
the BlueZ API when through a big change with the release of BlueZ 5 the
modules will be forked into a new set for BlueZ 5.
This commit also fixes the spelling of Bluetooth (it's a trademark which
should always be spelled with capital B) and the spelling of my name,
and also update the copyright note dates throughout the Bluetooth
modules.
|
|
This reverts commit 9615def4b96f0bab365ddc03f6c003f382a54752.
This is part of the reversion of BlueZ 5 support so it can be added back
in a separate set of modules. This makes the code easier to maintain and
decrease PulseAudio's binary size.
|
|
|
|
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.
|
|
u was dereferenced before the assertion that checks that u isn't NULL.
|
|
|
|
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.
|
|
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.
|
|
The 'Alias' property should be preffered over the 'Name' property,
according to the BlueZ API documentation.
|
|
|
|
Port creation is now slightly different. It is now similar to how
other objects are created (e.g. sinks/sources/cards).
This should become more useful in the future when we move more stuff to
the ports.
Functionally nothing has changed.
|
|
|
|
Commit 17b3cb954b179392e80b0a46d8f2ba4693aec386 merged Bluetooth ports
into two ports (one for input, one for output) but the association
between ports and profiles was lost.
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=64713
|
|
Both operations are currently independent and their order can therefore
be swapped.
|
|
If we find a microphone output port, it is probably something else
than a microphone. Therefore label it "Bluetooth output" instead of
"Microphone".
Same goes for Headphones and Speakers, but in the other direction.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
|
|
Use the information provided by the form factor to decide which name and
description should be used during port creation.
|
|
Avoid using strings only to represent form factors in the bluetooth-util
API and instead use a new dedicated enum type: pa_bt_form_factor_t.
|
|
The card profile availability flag already provides all the necessary
information and therefore all Bluetooth ports can be merged, leaving
the two generic ones only: "bluetooth-input" and "bluetooth-output". The
availability of these port now represents whether the device is
streaming audio, with the following mapping:
- PA_AVAILABLE_UNKNOWN: some profile connected but not streaming
- PA_AVAILABLE_NO: no profiles connected
- PA_AVAILABLE_YES: some profile streaming (regardless of which)
Each port's flag represents the profiles with the corresponding I/O
capabilities (pa_direction_t).
|
|
Use the transport's state to not only update the ports availability, but
also to update the card profile availability flag. The interpretation is
as follows:
- PA_AVAILABLE_UNKNOWN: BT profile is connected but no audio streaming
- PA_AVAILABLE_NO: BT profile disconnected
- PA_AVAILABLE_YES: BT profile connected and audio streaming
|
|
Generalize the availability flag in order to be used beyond the scope of
ports.
However, pa_port_availability_t is left unchanged to avoid modifying the
protocol and the client API. This should be replaced by pa_available_t
after a validation phase of this new generic enum type.
|
|
thread_mq.outq may contain some unprocessed messages, which should be
dispatched before unreffing the sink and source. If the sink and
source are unreffed before all messages to them have been dispatched,
the unreffing won't free the sink and source, and that in turn will
likely cause problems with things getting freed in a wrong order.
|
|
A transport should be considered connected only after the connection
procedure is complete, as expressed in audio_state_to_transport_state().
module-bluetooth-device should be loaded only after at least one
transport is not only created (during configuration), but also
connected.
This fixes the issue of premature acquire attempts sometimes experienced
when a headset is connected (issue not present in v3.0 though).
|
|
|
|
While reading from the SCO socket, there is no guarantee regarding the
resulting packet size. In some rare cases, it might not even match the
alignment expected in pa_source_post(), resulting in an assertion
failure inside pa_volume_memchunk():
I: [alsa-sink] module-loopback.c: Could not peek into queue
I: [alsa-sink] module-loopback.c: Could not peek into queue
I: [alsa-sink] module-loopback.c: Could not peek into queue
E: [bluetooth] sample-util.c: Assertion 'pa_frame_aligned(c->length, spec)' failed at pulsecore/sample-util.c:725, function pa_volume_memchunk(). Aborting.
Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffda98f700 (LWP 8058)]
0x00007ffff6177935 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install alsa-lib-1.0.26-1.fc17.x86_64 dbus-libs-1.4.10-7.fc17.x86_64 flac-1.2.1-9.fc17.x86_64 glibc-2.15-58.fc17.x86_64 gsm-1.0.13-6.fc17.x86_64 json-c-0.10-2.fc17.x86_64 libICE-1.0.8-1.fc17.x86_64 libSM-1.2.1-1.fc17.x86_64 libX11-1.5.0-2.fc17.x86_64 libXau-1.0.6-3.fc17.x86_64 libXext-1.3.1-1.fc17.x86_64 libXi-1.6.1-1.fc17.x86_64 libXtst-1.2.0-3.fc17.x86_64 libogg-1.3.0-1.fc17.x86_64 libsndfile-1.0.25-2.fc17.x86_64 libtool-ltdl-2.4.2-3.1.fc17.x86_64 libudev-182-3.fc17.x86_64 libuuid-2.21.2-3.fc17.x86_64 libvorbis-1.3.3-1.fc17.x86_64 libxcb-1.9-1.fc17.x86_64 speex-1.2-0.14.rc1.fc17.x86_64
|
|
The assertion in hsp_process_render() assumes that, if a memory block is
already set by the time the function is reached, its size matches
write_block_size.
This can however fail if a transport has been released and acquired
back, in the unlikely case where the MTU has changed in the meantime,
assuming the memory block wasn't released.
|
|
|
|
Use lowercase true/false instead of TRUE/FALSE for pa_bool_t.
|
|
pa__done() calls stop_thread(), and stop_thread() already
frees the smoother. The duplicate freeing is not strictly
a bug, but static analyzers (in this case Coverity) may
complain about double-freeing, because when pa__done()
"frees" the smoother (which doesn't actually ever happen),
the pointer is not nulled. pa__done() then calls
bt_transport_release(), which will also free the smoother
if it's not NULL.
The analyzer complaint could be silenced also by nulling
the pointer in pa__done(), but since this is clearly
redundant code, I chose to remove it.
|
|
Make the internal function bt_transport_acquire() consistent with the
API in bluetooth-util by replacing the old 'start' parameter with
exactly the opposite: 'optional'.
Therefore, all calls to the function need to negate the second
parameter.
Note also that the name is more accurate now that setup_stream() is not
called inside bt_transport_acquire().
|
|
Do not call setup_stream() automatically inside bt_transport_acquire().
Instead, the caller is responsible to use both functions as necessary.
As a first trivial step, setup_stream() is now called manually after
all calls to bt_transport_acquire(u, TRUE), with the exception of
setup_transport() where the thread is still about to start and thus
setup_stream() will be called later on from thread_func().
|
|
All D-Bus infrastructure is now unused after bluetooth-util has covered
the pieces that were pending. Therefore, all D-Bus related code in
module-bluetooth-device can be safely removed.
|
|
The transport state also reflects the state of the audio interface. The
state redundancy can thus be minimized by always using the first one,
and avoiding the use of profile-specific states with the exception of
finding out the initial state of a transport.
|
|
The function body is now trivial and can thus be inlined.
|
|
Transports can be acquired with different access rights, but in practice
"rw" was always used inside module-bluetooth-device. In addition, this
feature is removed in BlueZ 5.0 and therefore it is convenient to
abstract all this inside bluetooth-util.
|
|
Use transport state to calculate the corresponding port availability,
and while doing so use bluetooth-util to receive profile state updates
instead of directly parsing D-Bus PropertyChanged signals.
|
|
Split filter_cb() to separate the parsing of the D-Bus message from
the internal logic handling the new state.
|
|
Move the function to the utility library where the enum is defined. At
same time avoid using the default clause in order to make sure the
compiler will complain if the enum type gets extended.
|
|
Use the new abstraction in bluetooth-util to both receive volume updates
and request them.
|
|
The microphone gain represents the volume of the incoming audio stream
from the headset. This can be nicely abstracted inside the transport
object in bluetooth-util, so the modules don't have to take care about
the D-Bus details.
|
|
Move the connection of sink/source-related hooks to module
initialization and shutdown, to group all of them together. There is
no need to connect them every time the card profile is changed.
|
|
The hook has been recently moved to pa_bluetooth_hook_t, so make use
of the new version.
|
|
The hook is now deprecated so avoid using it and instead use the
recently introduced PA_BLUETOOTH_HOOK_TRANSPORT_STATE_CHANGED which also
reports the disconnection event.
|
|
Refactor the code to use an array of states instead of independent
member fields, avoiding duplicated code and improving readability.
|
|
Centralize the Bluetooth hooks in one single place, starting with
the device hooks, while removing the duplicated ones (in this case
PA_BLUETOOTH_DEVICE_HOOK_REMOVED).
|
|
Add the infrastructure to support several hooks inside
pa_bluetooth_discovery, while using hook names that describe more
accurately their purpose.
|
|
The hook PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED gets fired also
when a device is being removed, so there is actually no need to have
this duplicated hook.
|
|
With the use of an array to represent a device's transpors, the function
becomes trivial and thus can be removed.
|
|
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.
|
|
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.
|