Some non-standard A2DP codecs (FastStream/aptX-LL) have "voice duplex
channel" that can be used to provide an A2DP duplex mode.
Add support for duplex channels, accounting for the fact that the two
directions may be encoded with different actual codecs.
When we add a new listener to an object, it will emit the full state
of the object. For this it temporarily sets the change_mask to all
changes. Restore the previous state after this or else we might not
emit the right change_mask for the next listener.
Consider the case where one there are two listeners on an object.
The object emits a change and the first listener wants to enumerate the
changed params. For this is adds a new listener and then triggers the
enumeration. If we set the change_mask to 0 after adding the listener,
the second listener would get a 0 change_mask and fail to update
its state.
Initial Props value are parsed from device settings, further changes are triggered by 'set_param' on a2dp node.
Codec can then use props to tweak its transcoder.
Typically a source stops the connection when it has nothing to play
and this causes the transport to become "idle" and our A2DP source
also stops. However, the node is still present and "running" (if linked),
which causes the graph to underrun as it receives no data from this node.
This patch dynamically creates and destroys the a2dp source node depending
on the transport state. So, when the transport is idle, there is no node
in the graph at all.
This may avoid infinite loops if parameters are being set based on events
sent by parameter changes. It's also what alsa-acp devices do, so bluez5
should follow.
Release the transport if it went idle, ensuring that the fd is closed,
and add safeguards we won't double-acquire/release it.
This can occur if the device pauses the playback. The transport may also
activate again later on, and in this case we need to reacquire a new fd.
Not closing the old fd causes problems in this case.
However, apparently the BlueZ Release() call fails if the transport is
idle. We just ignore the error and downgrade the error message; it might
not be safe to not call Release() because the idle property update is
async.
Make a2dp clock advance at the correct rate.
Revert back to accumulating to a single buffer before sending it out.
What it did previously seemed hard to get to work properly with e.g.
aptx which produces block of varying sizes on decoding.
Since the data thread accesses the spa_bt_transport, its destroy event
needs to sync with data thread to avoid races.
Also check transport is present in places that need it.
Some codecs need the MTU as a parameter so wait until we acquire
with creating the codec context.
Make some method to enumerate the parameters from the transport
config and use that for the EnumFormat param.
Use codec methods. Init codec at start.
Remove rate match until we actually implement this
Add some buffering of packets before we hand them out.
Always simply fill a buffer and hand it out.
don't emit signals when we are following another driver.
Acquire transport as soon as it goes to PENDING.
This is more in line with wayland and it allows us to create new
interfaces in modules without having to add anything to the type
enum. It also removes some lookups to map type_id to readable
name in debug.