Tanu Kaskinen [Fri, 15 Nov 2013 14:29:41 +0000 (16:29 +0200)]
bluetooth: Set device_info_valid to -1 when the device's adapter disappears
When parsing device properties, missing adapter will result in
device_info_valid being set to -1. It is then logical that if the
adapter goes missing at a later point, device_info_valid gets set to
-1 also in that situation.
Tanu Kaskinen [Fri, 15 Nov 2013 14:29:40 +0000 (16:29 +0200)]
bluetooth: Remove device_remove_all()
The function did two things: set device_info_valid to -1 and called
device_free() for each device in the hashmap. Setting
device_info_valid to -1 was unnecessary. The main purpose of that was
to fire DEVICE_CONNECTION_CHANGED as a side effect, but that hook is
fired anyway in device_free(), as a side effect of removing all
transports. Calling device_free() can be delegated to pa_hashmap, when
freeing or emptying it.
Tanu Kaskinen [Fri, 15 Nov 2013 14:29:39 +0000 (16:29 +0200)]
bluetooth: Fire DEVICE_CONNECTION_CHANGED in set_device_info_valid()
Normally DEVICE_CONNECTION_CHANGED is fired when the first transport
becomes connected, but it may happen that the first transport becomes
connected already before the device properties have been received. In
that case the hook should be fired at the time the device properties
are received. This patch makes the hook to be fired at the right time.
Tanu Kaskinen [Fri, 15 Nov 2013 14:29:38 +0000 (16:29 +0200)]
bluetooth: Don't mark device valid before it has an adapter
At this point this doesn't make any other practical difference than
making the code more logical, but in the next patch I'll fire the
DEVICE_CONNECTION_CHANGED hook in set_device_info_valid(), and at that
point it's important that the device isn't marked valid too early,
because otherwise external code would see "valid" devices that however
don't have the adapter set.
Pierre Ossman [Fri, 20 Sep 2013 08:10:50 +0000 (10:10 +0200)]
core: make sure win32 sockets remain blocking
Commit 7e344b5 hade the side effect of forcing every socket to
be non-blocking on Windows. This is because of a (documented)
side effect of WSAEventSelect(). So we need to make sure to restore
blocking behaviour afterwards for relevant sockets.
Alexander Couzens [Mon, 16 Sep 2013 12:08:14 +0000 (14:08 +0200)]
tunnel-new: add cookie module argument
When connecting to a remote server your local generated authentication
cookie is used. If remote server's cookie is different from your local
one you aren't allowed to connect. You can use the cookie argument
or define a wider acl in remote server configuration for
module-native-protocol.
Tanu Kaskinen [Thu, 14 Nov 2013 08:53:44 +0000 (10:53 +0200)]
sink-input, source-output: Don't assume that proplist has been initialized in free()
It's bad form to assume in free() that any member of the struct has
been initialized. I ran into problems with this when I reordered
things in pa_sink_input_new() and pa_source_output_new().
Peter Meerwald [Sun, 21 Jul 2013 21:14:40 +0000 (23:14 +0200)]
resampler: Change interface, resampler may return the number of leftover frames
some resampler implementations (e.g. libsamplerate and ffmpeg) do not consume
the entire input buffer; the impl_resample() function now has a return value
returning the number of frames in the input buffer not processed
these frames must be saved in appropriate buffer and presented together with
new input data
also change the parameter names from in_samples, out_samples to in_n_frames,
out_n_frames, respectively (n_frames = samples / channels)
Luiz Augusto von Dentz [Sun, 3 Nov 2013 13:05:34 +0000 (15:05 +0200)]
card: Only set active_profile with available profile
When a card is being created and no profile has been assigned
pa_card_new will attempt to select one from the list but it does that
without checking the available flag which can lead to select profiles
not available.
The size of pa_card_profile_info cannot change even if it just a field
appended to end because each entry is appended to a contiguous memory
and accessed by offset this may lead clients to access invalid data.
To fix a new struct called pa_card_profile_info2 is introduced and shall
be used for now on while pa_card_profile_info shall be considered
deprecated but it is still mantained for backward compatibility.
A new field called profiles2 is introduced to pa_card_info, this new field
is an array of pointers to pa_card_profile_info2 so it should be possible
to append new fields to the end of the pa_card_profile_info2 without
breaking binary compatibility as the entries are not accessed by offset.
The code got removed by accident during the cleanup in commit 9c438bcac671. So
this patch is needed to bring it back and make things work like documented.
Tanu Kaskinen [Fri, 4 Oct 2013 10:39:40 +0000 (13:39 +0300)]
simple: Improve pa_simple_read() documentation
There was a question in IRC about whether pa_simple_read() blocks or
not. It's already documented on the simple API overview page, but it's
good to say it also in the function reference. As a bonus, I added
some additional details to the documentation too.
The function was redundant, because all it did was call adapter_free()
for each adapter in the hashmap, and that can be delegated to
pa_hashmap when freeing or emptying it.
Ben Brewer [Thu, 25 Jul 2013 12:44:29 +0000 (13:44 +0100)]
mainloop, glib-mainloop: time_restart could cause incorrect event ordering
This fixes a bug where calling time_restart can leave the current event
in the cache, even though the restart scheduled the event in the future.
This would cause the event to get executed more frequently than it should.
João Paulo Rechi Vita [Mon, 14 Oct 2013 19:18:03 +0000 (16:18 -0300)]
bluetooth: Track discovery modules by index
Previously module-bluez5-discover and module-bluez4-discover were being
tracked using their pa_module pointer. But during daemon shutdown these
modules are unloaded before module-bluetooth-discover, leaving stale
pointers in module-bluetooth-discover's userdata. To avoid this problem
this commit makes module-bluetooth-discover keep track of
module-bluez5-discover and module-bluez4-discovery by their indexes.
Kiran Krishnappa [Thu, 10 Oct 2013 06:30:09 +0000 (23:30 -0700)]
sndfile-util: fix format for 24bit depth wav files
PA_SAMPLE_24NE generated in pa_sndfile_read_sample_spec is not
handled in pa_sndfile_readf and writef function. paplay/parecord
used to get aborted for 24bit depth wav files
Alexander Couzens [Mon, 16 Sep 2013 11:06:27 +0000 (13:06 +0200)]
tunnel-sink-new: Fix a possible crash
When the creation of u->thread fails, then pa_thread_mq_done() in
pa__done() will crash, because pa_thread_mq_init() was never called.
Allocating the thread_mq object separately, instead of embedding it
in the userdata struct, allows pa__done() to call pa_thread_mq_done()
only when necessary.
David Henningsson [Fri, 27 Sep 2013 08:22:53 +0000 (10:22 +0200)]
default/system.pa: Do not load module-dbus-protocol
The author of this module, Tanu Kaskinen, has said that this module
"is not suitable for general use". Also, it is still causing crashes
on card removal (see bug 69871).
Qpaeq, and possibly other tools, use this module - but they can load
the module manually if they still wish to use it.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
João Paulo Rechi Vita [Tue, 24 Sep 2013 22:45:59 +0000 (19:45 -0300)]
bluetooth: Revive module-bluetooth-discover
Create a wrapper module called module-bluetooth-discover to avoid
breaking backward-compatibility of default.pa. This wrapper may
eventually be dropped altoghether with BlueZ 4 support.
João Paulo Rechi Vita [Tue, 24 Sep 2013 22:45:56 +0000 (19:45 -0300)]
bluetooth: Fail to load driver if discovery module is not loaded
For quite some time now the device driver module doesn't work well
without the discovery module, so for the BlueZ 5 support we'll prevent
the device driver module to be loaded if the discovery module is not
loaded.
João Paulo Rechi Vita [Tue, 24 Sep 2013 22:45:51 +0000 (19:45 -0300)]
bluetooth: Create I/O thread function for BlueZ 5 cards
Create the thread function, the render and push functions for A2DP, the
process message function for communication between the I/O thread and
the main thread, and other helper functions related to them.
João Paulo Rechi Vita [Tue, 24 Sep 2013 22:45:41 +0000 (19:45 -0300)]
bluetooth: Get BlueZ 5 device object
Get the remote device information stored in pa_bluetooth_discovery. This
also creates the mandatory parameter 'path' for module-bluez5-device,
which is used to inform the object path of the remote device in BlueZ on
the module load.
João Paulo Rechi Vita [Tue, 24 Sep 2013 22:45:36 +0000 (19:45 -0300)]
bluetooth: Protect from a misbehaving bluetoothd
bluetoothd always send the GetManagedObjects() reply messages with the
objects array argument following an in-depth order starting from the
root. That means parents will always be known at the time their children
objects are parsed, if clients parse the objects in the same order they
appear in the array, as we do in PulseAudio.
This commit tries to protect PulseAudio in the case bluetoothd changes
that behavior for some reason. It hasn't been tested, since this
situation never occurs.
João Paulo Rechi Vita [Tue, 24 Sep 2013 22:45:22 +0000 (19:45 -0300)]
bluetooth: Create pa_bluetooth_transport for BlueZ 5 support
Create the pa_bluetooth_transport structure to store information about
the bluetooth transport and utility functions to manipulate this
structure. The acquire() and release() operations are function pointers
in the pa_bluetooth_transport structure to make possible for different
transport backends to provide different implementations of these
operations. Thre is also a userdata field for the transport backend
provide data for the acquire/release functions.
This commit also creates a new function
pa_bluetooth_device_any_transport_connected() to check if there is any
audio connection between the host and a remote device.
João Paulo Rechi Vita [Fri, 16 Aug 2013 12:30:41 +0000 (09:30 -0300)]
bluetooth: Remove module-bluetooth-proximity
module-bluetooth-proximity has not worked for quite a while, since it
uses pre-BlueZ4 APIs. Nobody complained since then, which is a good
indication that it doesn't have much users. Even the original commit
message refers to it more as a toy than as something of great use: "add
new fun module that automatically mutes your audio devices when you
leave with your bluetooth phone, and unmutes when you come back"
Removing it we completely remove the dependency on libbluetooth.