mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
pulse-server: improve fix_* handling
When we have a fix_* flag set, make an extra format description with the wildcards. This makes it possible for the session manager to fall back to something when selecting a target and format. Also only advertize the valid pulseaudio formats for the wildcards. Fixes #1912
This commit is contained in:
parent
12cc3b34b1
commit
de12e8dd2c
2 changed files with 79 additions and 23 deletions
|
|
@ -1045,7 +1045,8 @@ static void stream_param_changed(void *data, uint32_t id, const struct spa_pod *
|
|||
return;
|
||||
}
|
||||
|
||||
pw_log_info("[%s] got rate:%u channels:%u", stream->client->name,
|
||||
pw_log_info("[%s] got format:%s rate:%u channels:%u", stream->client->name,
|
||||
format_id2name(stream->ss.format),
|
||||
stream->ss.rate, stream->ss.channels);
|
||||
|
||||
stream->frame_size = sample_spec_frame_size(&stream->ss);
|
||||
|
|
@ -1518,13 +1519,22 @@ static int do_create_playback_stream(struct client *client, uint32_t command, ui
|
|||
}
|
||||
}
|
||||
if (sample_spec_valid(&ss)) {
|
||||
if (fix_format)
|
||||
ss.format = SPA_AUDIO_FORMAT_UNKNOWN;
|
||||
if (fix_rate)
|
||||
ss.rate = 0;
|
||||
if (fix_channels)
|
||||
ss.channels = 0;
|
||||
|
||||
if (fix_format || fix_rate || fix_channels) {
|
||||
struct sample_spec sfix = ss;
|
||||
if (fix_format)
|
||||
sfix.format = SPA_AUDIO_FORMAT_UNKNOWN;
|
||||
if (fix_rate)
|
||||
sfix.rate = 0;
|
||||
if (fix_channels)
|
||||
sfix.channels = 0;
|
||||
if (n_params < MAX_FORMATS &&
|
||||
(params[n_params] = format_build_param(&b,
|
||||
SPA_PARAM_EnumFormat, &sfix,
|
||||
sfix.channels > 0 ? &map : NULL)) != NULL) {
|
||||
n_params++;
|
||||
n_valid_formats++;
|
||||
}
|
||||
}
|
||||
if (n_params < MAX_FORMATS &&
|
||||
(params[n_params] = format_build_param(&b,
|
||||
SPA_PARAM_EnumFormat, &ss,
|
||||
|
|
@ -1773,13 +1783,22 @@ static int do_create_record_stream(struct client *client, uint32_t command, uint
|
|||
volume_set = false;
|
||||
}
|
||||
if (sample_spec_valid(&ss)) {
|
||||
if (fix_format)
|
||||
ss.format = SPA_AUDIO_FORMAT_UNKNOWN;
|
||||
if (fix_rate)
|
||||
ss.rate = 0;
|
||||
if (fix_channels)
|
||||
ss.channels = 0;
|
||||
|
||||
if (fix_format || fix_rate || fix_channels) {
|
||||
struct sample_spec sfix = ss;
|
||||
if (fix_format)
|
||||
sfix.format = SPA_AUDIO_FORMAT_UNKNOWN;
|
||||
if (fix_rate)
|
||||
sfix.rate = 0;
|
||||
if (fix_channels)
|
||||
sfix.channels = 0;
|
||||
if (n_params < MAX_FORMATS &&
|
||||
(params[n_params] = format_build_param(&b,
|
||||
SPA_PARAM_EnumFormat, &sfix,
|
||||
sfix.channels > 0 ? &map : NULL)) != NULL) {
|
||||
n_params++;
|
||||
n_valid_formats++;
|
||||
}
|
||||
}
|
||||
if (n_params < MAX_FORMATS &&
|
||||
(params[n_params] = format_build_param(&b,
|
||||
SPA_PARAM_EnumFormat, &ss,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue