mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
spa: improve null-audio-sink channels
We can just update the channels in the props, we don't need an extra property that can go out of sync with the channels. See #3931
This commit is contained in:
parent
cddea858d9
commit
af310523db
1 changed files with 5 additions and 10 deletions
|
|
@ -39,7 +39,6 @@ struct props {
|
||||||
uint32_t format;
|
uint32_t format;
|
||||||
uint32_t channels;
|
uint32_t channels;
|
||||||
uint32_t rate;
|
uint32_t rate;
|
||||||
uint32_t n_pos;
|
|
||||||
uint32_t pos[SPA_AUDIO_MAX_CHANNELS];
|
uint32_t pos[SPA_AUDIO_MAX_CHANNELS];
|
||||||
char clock_name[64];
|
char clock_name[64];
|
||||||
unsigned int debug:1;
|
unsigned int debug:1;
|
||||||
|
|
@ -51,7 +50,6 @@ static void reset_props(struct props *props)
|
||||||
props->format = 0;
|
props->format = 0;
|
||||||
props->channels = 0;
|
props->channels = 0;
|
||||||
props->rate = 0;
|
props->rate = 0;
|
||||||
props->n_pos = 0;
|
|
||||||
strncpy(props->clock_name, DEFAULT_CLOCK_NAME, sizeof(props->clock_name));
|
strncpy(props->clock_name, DEFAULT_CLOCK_NAME, sizeof(props->clock_name));
|
||||||
props->debug = false;
|
props->debug = false;
|
||||||
props->driver = true;
|
props->driver = true;
|
||||||
|
|
@ -471,10 +469,10 @@ port_enum_formats(struct impl *this,
|
||||||
SPA_FORMAT_AUDIO_channels, SPA_POD_CHOICE_RANGE_Int(DEFAULT_CHANNELS, 1, INT32_MAX),
|
SPA_FORMAT_AUDIO_channels, SPA_POD_CHOICE_RANGE_Int(DEFAULT_CHANNELS, 1, INT32_MAX),
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
if (this->props.n_pos != 0) {
|
if (this->props.channels != 0) {
|
||||||
spa_pod_builder_prop(builder, SPA_FORMAT_AUDIO_position, 0);
|
spa_pod_builder_prop(builder, SPA_FORMAT_AUDIO_position, 0);
|
||||||
spa_pod_builder_array(builder, sizeof(uint32_t), SPA_TYPE_Id,
|
spa_pod_builder_array(builder, sizeof(uint32_t), SPA_TYPE_Id,
|
||||||
this->props.n_pos, this->props.pos);
|
this->props.channels, this->props.pos);
|
||||||
}
|
}
|
||||||
*param = spa_pod_builder_pop(builder, &f[0]);
|
*param = spa_pod_builder_pop(builder, &f[0]);
|
||||||
break;
|
break;
|
||||||
|
|
@ -890,10 +888,10 @@ static inline void parse_position(struct impl *this, const char *val, size_t len
|
||||||
if (spa_json_enter_array(&it[0], &it[1]) <= 0)
|
if (spa_json_enter_array(&it[0], &it[1]) <= 0)
|
||||||
spa_json_init(&it[1], val, len);
|
spa_json_init(&it[1], val, len);
|
||||||
|
|
||||||
this->props.n_pos = 0;
|
this->props.channels = 0;
|
||||||
while (spa_json_get_string(&it[1], v, sizeof(v)) > 0 &&
|
while (spa_json_get_string(&it[1], v, sizeof(v)) > 0 &&
|
||||||
this->props.n_pos < SPA_AUDIO_MAX_CHANNELS) {
|
this->props.channels < SPA_AUDIO_MAX_CHANNELS) {
|
||||||
this->props.pos[this->props.n_pos++] = channel_from_name(v);
|
this->props.pos[this->props.channels++] = channel_from_name(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -993,9 +991,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
"%s", s);
|
"%s", s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this->props.n_pos > 0)
|
|
||||||
this->props.channels = this->props.n_pos;
|
|
||||||
|
|
||||||
spa_log_info(this->log, "%p: initialized", this);
|
spa_log_info(this->log, "%p: initialized", this);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue