This will be aligned to the fake sample spec corresponding to the
format, but that is correct and will prevent breakage in libpulse and
the server where we have aligned-ness expectations.
pa_sink_is_passthrough() might not be true at the time of unsuspend, so
we can't count on it to set the AES bits. Let's just remember
passthrough state from reconfiguration and use that.
We should only reconfigure monitor sources when the corresponding sink
is reconfigured (and when it is, we should unconditionally set it to the
requested spec/map of whatever the sink got reconfigured to).
The previous logic was incorrect on all 3 counts.
This is needed at the moment for passthrough support of high bitrate
formats (such as DTS-HD and Dolby TrueHD), which, in addition to setting
a higher sample rate also set channel count to 8. It would be clunky to
require users to reset the HDMI profile based on the format being
played, so for consistency we continue to only allow setting formats on
the stereo profile, and reconfigure channels as needed for the duration
of pakssthrough playback.
We implement the source side as well for consistency.
This adds a --encoding argument to allow specifying a non-PCM format for
playback. This is expected to be useful for testing support for
compressed formats.
This adds functions to allow changing the channel map on a sink or
source. We make module-null-sink use this function instead of changing
the channel map manually to allow for logging and notifications.
The source function is currently unused but we add it to maintain
symmetry with the sink.
This code can be reused for other tests that need to connect to the PA
server and load a NULL sink. The idea is to grow this out with basic
primitives that various tests need to make it easier to add more unit
tests for various situations.
This generalises the avoid-resampling concept (don't resample for any
rate above the default/alternate sample rate) to include channel count
and sample format as well. The rationale for this is that users who wish
to send out their data untouched by processing in PulseAudio can do so.
In addition to this, there are opportunities for certain hardware (such
as systems with a DSP connected to a codec) to offload processing to the
DSP (providing potential cost savings).
Finally, this also enables modules that might be able to perform
transformations of (ANY -> sink format), and this allows us to implement
such transformations.
This moves over the saving+resetting/restoring of volumes and source
suspending/unsuspending while entering/leaving passthrough mode into
reconfigure functions. This makes it easier to reason about exactly what
behaviour occurs at the time, as well as avoids loss of precision during
the remapping of the internal volume values in this case.
For the passthrough case, we allow the entire sink sample spec to be
changed in reconfigure. This will be needed for high bitrate formats. We
duplicate this for sources to keep things in sync as well.
Relatedly, we also restore the original spec on leaving passthrough
mode. We were getting away with not doing so in the past as, while
incorrect, not restoring the rate was not disastrous. With the ability
to change channel count, not restoring breaks the meaning of profiles
entirely. The saving and restoration logic is restricted to sink/source
reconfiguration code to allow it to be self-contained and easier to
reason about.
All this also applies to the channel map. We don't actually explicitly
reconfigure the channel map at the moment, but since
pa_sink/source_reconfigure() can now change the channel count, it seems
to make sense to include the channel map along with that API change for
future use.
Add libatomic_ops dependencies to libraries/modules that showed a
failure on an arch that does not have native atomic operations support.
Not all optional dependencies were tested, so it is possible that
some optional modules are still missing libatomic_ops dependencies.
Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/732>