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
|
@ -39,7 +39,6 @@ struct props {
|
|||
uint32_t format;
|
||||
uint32_t channels;
|
||||
uint32_t rate;
|
||||
uint32_t n_pos;
|
||||
uint32_t pos[SPA_AUDIO_MAX_CHANNELS];
|
||||
char clock_name[64];
|
||||
unsigned int debug:1;
|
||||
|
@ -51,7 +50,6 @@ static void reset_props(struct props *props)
|
|||
props->format = 0;
|
||||
props->channels = 0;
|
||||
props->rate = 0;
|
||||
props->n_pos = 0;
|
||||
strncpy(props->clock_name, DEFAULT_CLOCK_NAME, sizeof(props->clock_name));
|
||||
props->debug = false;
|
||||
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),
|
||||
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_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]);
|
||||
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)
|
||||
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 &&
|
||||
this->props.n_pos < SPA_AUDIO_MAX_CHANNELS) {
|
||||
this->props.pos[this->props.n_pos++] = channel_from_name(v);
|
||||
this->props.channels < SPA_AUDIO_MAX_CHANNELS) {
|
||||
this->props.pos[this->props.channels++] = channel_from_name(v);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -993,9 +991,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
"%s", s);
|
||||
}
|
||||
}
|
||||
if (this->props.n_pos > 0)
|
||||
this->props.channels = this->props.n_pos;
|
||||
|
||||
spa_log_info(this->log, "%p: initialized", this);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue