pulse-server: add option to disable fix_ flags

Document the pulse.fix properties.
Add an option to disable handling of the FIX flags when the pulse.fix.
property is set to an invalid value/0.

See #3317
This commit is contained in:
Wim Taymans 2023-07-03 16:37:45 +02:00
parent ff5f6d908b
commit c34a987076
2 changed files with 42 additions and 6 deletions

View file

@ -194,6 +194,32 @@
* VMs usually can't support the low latency settings that are possible on real
* hardware.
*
* ### Quirk options
*
*\code{.unparsed}
* pulse.fix.format = "S16LE"
*\endcode
*
* When a stream uses the FIX_FORMAT flag, fixate the format to this value.
* Normally the format would be fixed to the sink/source that the stream connects
* to. When an invalid format (null or "") is set, the FIX_FORMAT flag is ignored.
*
*\code{.unparsed}
* pulse.fix.rate = 48000
*\endcode
*
* When a stream uses the FIX_RATE flag, fixate the sample rate to this value.
* Normally the rate would be fixed to the sink/source that the stream connects
* to. When a 0 rate is set, the FIX_RATE flag is ignored.
*
*\code{.unparsed}
* pulse.fix.position = "[ FL FR ]"
*\endcode
*
* When a stream uses the FIX_CHANNELS flag, fixate the channels to this value.
* Normally the channels would be fixed to the sink/source that the stream connects
* to. When an invalid position (null or "") is set, the FIX_CHANNELS flag is ignored.
*
* ## Command execution
*
* As part of the server startup sequence, a set of commands can be executed.

View file

@ -243,24 +243,34 @@ void sample_spec_fix(struct sample_spec *ss, struct channel_map *map,
{
const char *str;
if (fix_ss->format != 0) {
if ((str = spa_dict_lookup(props, "pulse.fix.format")) != NULL)
ss->format = format_name2id(str);
if ((str = spa_dict_lookup(props, "pulse.fix.format")) != NULL) {
uint32_t val = format_name2id(str);
if (val != SPA_AUDIO_FORMAT_UNKNOWN)
ss->format = val;
}
else
ss->format = fix_ss->format;
/* convert back and forth to convert potential planar to packed */
ss->format = format_pa2id(format_id2pa(ss->format));
}
if (fix_ss->rate != 0) {
if ((str = spa_dict_lookup(props, "pulse.fix.rate")) != NULL)
ss->rate = atoi(str);
if ((str = spa_dict_lookup(props, "pulse.fix.rate")) != NULL) {
uint32_t val = atoi(str);
if (val != 0)
ss->rate = val;
}
else
ss->rate = fix_ss->rate;
ss->rate = SPA_CLAMP(ss->rate, 0u, RATE_MAX);
}
if (fix_ss->channels != 0) {
if ((str = spa_dict_lookup(props, "pulse.fix.position")) != NULL) {
channel_map_parse_position(str, map);
ss->channels = map->channels;
struct channel_map val;
channel_map_parse_position(str, &val);
if (val.channels > 0) {
ss->channels = val.channels;
*map = val;
}
} else {
ss->channels = fix_ss->channels;
*map = *fix_map;