This allows our a2dp-source (sink endpoint) to report delay to the
remote source endpoint. Setting the "Delay" property is already
implemented, but by failing to configure DelayReporting, bluez rejects
the property change.
Partially revert 86af9de739
The PortParam does not give enough information to derive the direction
of the converter. If the converter is configured in convert/convert
there is just no way to know when to output a quantum or not.
Fix this by doing a quick probe of the follower and then pass the
direction to the converter.
See !2227
Report the "fractional" part of the resampler delay in
spa_io_rate_match::delay_frac, in nanosamples (1/1e9 sample) at node
rate.
The delay values are best reported in units where it is clear what the
clock domain is, so report the value in fractional samples instead of
nanoseconds. Conversion to ns is also just dividision by the appropriate
rate.
Resampler without prefill was sometime outputting with different delay
than with prefill. Adjust initial history by 1 which seems to bring it
more in line.
The resampler phase also appears to depend on how many samples remain in
history which leads to possibly unexpected +-1 variation. Take this into
account in reported phase.
These changes make the resampler delay tests pass.
Both changes are sort of empirical --- I don't fully understand why
these would fix things but they seem to be needed to make the delay
calculations agree with what the resampler outputs.
The delay is always expressed in samples at the output rate of the
resampler. For input streams we need to convert this to the expected
input rate.
Make the delay reporting in playback streams more accurate.
The resampler delay was off by one sample, so remove the corresponding
fudge factor here. This matters for BAP output synchronization.
The resampler has also some fractional delay, so there can still be
sub-sample offset between the original and resampled timelines. This is
not currently taken into account.
Resampler delay for N taps is N/2-1 input samples.
Add test that checks this.
When input rate is varying, the resampler also accumulates additional
sub-sample delay. The resampler does not currently have API to report
the instantaneous sub-sample delay. Add knownfail test for it.
In timestamps, support different clocks and local time as formats.
Local real time timestamps are useful when trying to correlate logs from
different sources.
When setting Route param, check that the route actually is part of the
active profile.
Also, check that the device given corresponds to the given route, before
setting properties. acp_device_set_port() also checks this, but we
shouldn't allow updating properties of Routes in non-active profiles.
Setting ports or applying props on devices not part of the profile can
do unexpected things e.g. alter mixer settings.
Don't mix endpoint and transport paths, they're generally different.
If ASHA transport already existed, free the old one but not the device,
as the ASHA device existence should track how it appears in DBus.
G722 codec id for ASHA is chosen arbitrarily to be different from
A2DP and BAP codec IDs. ASHA spec does not specify a codec ID like
A2DP/BAP.
In places where codec_id comparisons are done, ensure that the check
is done against the codec of the right type viz. A2DP/BAP/ASHA.
Make sure we only make the buffer for the follower larger when we
downsample because then we need to ask for more data from the follower
to fill up a quantum.
Never try to make the follower buffer smaller than the quantum limit.
The reason is that the graph rate could be decreased dynamically and
then we would end up with too small buffers.
See #4490
Load multiple graphs with audioconvert.filter-graph.N where N is the
order where the graph is inserted/replaced. Run the graphs before the
channelmixer.
Graphs can be added and removed at runtime.
Instead of recalculating what to do every cycle, we can prepare a
static schedule and just run that. We only need to reevaluate it when
something changes.
For input streams, first run the resampler and then the channelmix. This
ensures that the channelmix is run with the rate of the graph instead
of the rate of the input. This is nicer because rate and quantum align
with the graph and the sample accurate volume ramps will work as
intended.
For output streams, leave the resampler after the channelmix for the same
reasons.
Remove the chunk and add separate arrays with data and n_samples. This aligns
better with other methods and makes it possible to more easily reuse
arrays of pointers as input and output.