it's useless to get the same SF_FORMAT_INFO three times, just compare the
name/extention in the same loop.
Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
I noticed that the doxygen API (http://freedesktop.org/software/pulseaudio/doxygen)
does not include ext-device-manager.h. The following patch adds ext-device-manager.h
and ext-device-restore.h to the list of files processed by doxygen.
It doesn't matter if the function fails (I'm not sure if
it's even possible), because the read data isn't used for
anything and the daemon will terminate in any case. The
void cast should get rid of a Coverity warning.
Removing the whole pa_read() call should be ok too, but I
guess it's nice to clean up the pipe before terminating...
Coverity warned about an ignored return value. I'm not sure
if there's something that should be done if writing fails;
at least I couldn't think of anything. Would logging an
error be acceptable here?
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.
This fixes bug 38728 [1]. When equalizer features are unavailable in running
pulseaudio daemon, try to load relevant module. If this fails, following error
is printed on stderr instead of a confusing traceback:
It seems that running pulseaudio does not support equalizer features and
loading module-equalizer-sink module failed. Exiting...
[1] https://bugs.freedesktop.org/show_bug.cgi?id=38728
Signed-off-by: Matěj Laitl <matej@laitl.cz>
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 state of this interface is needed for one single reason: we need to
wait until all profiles have been connected (or more precisely, until
are connection attempts are finished). This can be made more explicit in
the code by just checking the CONNECTING state (and not loading
module-bluetooth-device during that state), but otherwise treating all
transport types equally.
Ideally, audio_state should be completely removed but it's left there to
avoid an issue with module-card-restore, as documented in the source
code's comments.
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.
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.
Similarly to the microphone gain, the speaker gain can be abstracted
inside the transport object, even though the actual D-Bus interface in
BlueZ differs.
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.
memcpy() of the null implementation's run() copied data for only one
channel. Set the number of channels to 1 in init() in order to guarantee
this.
Signed-off-by: Stefan Huber <s.huber@bct-electronic.com>
Acked-by: Peter Meerwald <p.meerwald@bct-electronic.com>
apply_diff_time() fails when dropping bytes from the playback stream
and the sample spec of sink and source differ as source's sample spec is
used. Fix this by using sink's sample spec.
Signed-off-by: Stefan Huber <s.huber@bct-electronic.com>
Acked-by: Peter Meerwald <p.meerwald@bct-electronic.com>
This module works pretty similar to the module-role-cork.
It should be used as an alternative to that module. Basically
it decreases the volume of the streams specified in ducking_roles
in the presence of at least one stream specified in trigger_roles.
Also, it's possible to choice the volume that will be used in the
ducking streams and if it should operates in all devices or not.
For basic reference: http://en.wikipedia.org/wiki/Ducking
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 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.
Add the transport-handling hooks to the centralized list of hooks in
pa_bluetooth_hook_t. These are intended to replace the now deprecated
transport-specific hook list in pa_bluetooth_transport_hook_t.
Transport objects have an associated state even though it's not
explicitly exposed in BlueZ's D-Bus API (prior to 5.0). Instead, the
state is implicitly represented in the profile-specific D-Bus interface
(i.e. org.bluez.Headset, org.bluez.AudioSink, etc.) but it can be
convenient that bluetooth-util would abstract this separation.
The old implementation is limited to parsing the profile state, but
the D-Bus API actually exposes many more properties that are currently
not being considered, specially within org.bluez.Headset.
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).
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.
Devices will have zero or one transports per profile, and besides the
typical lookup is also profile-based. Therefore, replace the old hashmap
(which used the transport path as key) with a simple array which holds
a transport pointer per profile.
Path-based transport lookups are required in a discovery basis, before
the associated device is known. Therefore, it makes more sense to
maintain a hashmap in the discovery structure itself, instead of
iterating all devices.