pulse-server: use pulse.fix.* keys

Use a different key than the usual one to select an audio format when we
are fixating a stream format to avoid confusion.

So pulse.fix.rate, pulse.fix.format, pulse.fix.channels are now used to
force a specific format when the stream has the FIX_ stream flags.
This commit is contained in:
Wim Taymans 2023-02-23 08:56:25 +01:00
parent 15e4b3d500
commit 4163991a97

View file

@ -1699,19 +1699,19 @@ static int do_create_playback_stream(struct client *client, uint32_t command, ui
rate = ss.rate; rate = ss.rate;
if (fix_format) { if (fix_format) {
if ((str = pw_properties_get(props, SPA_KEY_AUDIO_FORMAT)) != NULL) if ((str = pw_properties_get(props, "pulse.fix.format")) != NULL)
sfix.format = format_name2id(str); sfix.format = format_name2id(str);
else else
sfix.format = SPA_AUDIO_FORMAT_UNKNOWN; sfix.format = SPA_AUDIO_FORMAT_UNKNOWN;
} }
if (fix_rate) { if (fix_rate) {
if ((str = pw_properties_get(props, SPA_KEY_AUDIO_RATE)) != NULL) if ((str = pw_properties_get(props, "pulse.fix.rate")) != NULL)
sfix.rate = atoi(str); sfix.rate = atoi(str);
else else
sfix.rate = 0; sfix.rate = 0;
} }
if (fix_channels) { if (fix_channels) {
if ((str = pw_properties_get(props, SPA_KEY_AUDIO_CHANNELS)) != NULL) if ((str = pw_properties_get(props, "pulse.fix.channels")) != NULL)
sfix.channels = atoi(str); sfix.channels = atoi(str);
else else
sfix.channels = 0; sfix.channels = 0;
@ -1962,19 +1962,19 @@ static int do_create_record_stream(struct client *client, uint32_t command, uint
rate = ss.rate; rate = ss.rate;
if (fix_format) { if (fix_format) {
if ((str = pw_properties_get(props, SPA_KEY_AUDIO_FORMAT)) != NULL) if ((str = pw_properties_get(props, "pulse.fix.format")) != NULL)
sfix.format = format_name2id(str); sfix.format = format_name2id(str);
else else
sfix.format = SPA_AUDIO_FORMAT_UNKNOWN; sfix.format = SPA_AUDIO_FORMAT_UNKNOWN;
} }
if (fix_rate) { if (fix_rate) {
if ((str = pw_properties_get(props, SPA_KEY_AUDIO_RATE)) != NULL) if ((str = pw_properties_get(props, "pulse.fix.rate")) != NULL)
sfix.rate = atoi(str); sfix.rate = atoi(str);
else else
sfix.rate = 0; sfix.rate = 0;
} }
if (fix_channels) { if (fix_channels) {
if ((str = pw_properties_get(props, SPA_KEY_AUDIO_CHANNELS)) != NULL) if ((str = pw_properties_get(props, "pulse.fix.channels")) != NULL)
sfix.channels = atoi(str); sfix.channels = atoi(str);
else else
sfix.channels = 0; sfix.channels = 0;