mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-16 07:00:00 -05:00
treewide: remove some obsolete channel checks
The spa_audio_info can not be parsed with too many channels so there is always enough space for the positions.
This commit is contained in:
parent
78219471ff
commit
aa0272f6f3
8 changed files with 50 additions and 64 deletions
|
|
@ -761,7 +761,7 @@ static int make_stream_ports(struct stream *s)
|
|||
struct port *port = s->ports[i];
|
||||
char channel[32];
|
||||
|
||||
snprintf(channel, sizeof(channel), "AUX%u", n_channels % MAX_CHANNELS);
|
||||
snprintf(channel, sizeof(channel), "AUX%u", n_channels);
|
||||
|
||||
switch (port->stream_type) {
|
||||
case ffado_stream_type_audio:
|
||||
|
|
@ -1229,7 +1229,7 @@ static int probe_ffado_device(struct impl *impl)
|
|||
}
|
||||
if (impl->source.info.channels != n_channels) {
|
||||
uint32_t n_pos = SPA_MIN(n_channels, SPA_N_ELEMENTS(impl->source.info.position));
|
||||
impl->source.info.channels = n_channels;
|
||||
impl->source.info.channels = n_pos;
|
||||
for (i = 0; i < n_pos; i++)
|
||||
impl->source.info.position[i] = SPA_AUDIO_CHANNEL_AUX0 + i;
|
||||
}
|
||||
|
|
@ -1256,7 +1256,7 @@ static int probe_ffado_device(struct impl *impl)
|
|||
}
|
||||
if (impl->sink.info.channels != n_channels) {
|
||||
uint32_t n_pos = SPA_MIN(n_channels, SPA_N_ELEMENTS(impl->sink.info.position));
|
||||
impl->sink.info.channels = n_channels;
|
||||
impl->sink.info.channels = n_pos;
|
||||
for (i = 0; i < n_pos; i++)
|
||||
impl->sink.info.position[i] = SPA_AUDIO_CHANNEL_AUX0 + i;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1691,8 +1691,7 @@ static void copy_position(struct spa_audio_info_raw *dst, const struct spa_audio
|
|||
{
|
||||
if (SPA_FLAG_IS_SET(dst->flags, SPA_AUDIO_FLAG_UNPOSITIONED) &&
|
||||
!SPA_FLAG_IS_SET(src->flags, SPA_AUDIO_FLAG_UNPOSITIONED)) {
|
||||
uint32_t i, n_pos = SPA_MIN(src->channels, SPA_N_ELEMENTS(dst->position));
|
||||
for (i = 0; i < n_pos; i++)
|
||||
for (uint32_t i = 0; i < src->channels; i++)
|
||||
dst->position[i] = src->position[i];
|
||||
SPA_FLAG_CLEAR(dst->flags, SPA_AUDIO_FLAG_UNPOSITIONED);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,16 +215,16 @@ static const struct spa_audio_layout_info layouts[] = {
|
|||
{ SPA_AUDIO_LAYOUT_7_1 },
|
||||
};
|
||||
|
||||
static void default_layout(uint32_t channels, uint32_t *position, uint32_t max_position)
|
||||
static void default_layout(uint32_t channels, uint32_t *position)
|
||||
{
|
||||
SPA_FOR_EACH_ELEMENT_VAR(layouts, l) {
|
||||
if (l->n_channels == channels) {
|
||||
for (uint32_t i = 0; i < l->n_channels && i < max_position; i++)
|
||||
for (uint32_t i = 0; i < l->n_channels; i++)
|
||||
position[i] = l->position[i];
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (uint32_t i = 0; i < channels && i < max_position; i++)
|
||||
for (uint32_t i = 0; i < channels; i++)
|
||||
position[i] = SPA_AUDIO_CHANNEL_AUX0 + i;
|
||||
}
|
||||
|
||||
|
|
@ -278,10 +278,10 @@ struct vban_stream *vban_stream_new(struct pw_core *core,
|
|||
pw_log_error("can't parse format: %s", spa_strerror(res));
|
||||
goto out;
|
||||
}
|
||||
if (SPA_FLAG_IS_SET(impl->info.info.raw.flags, SPA_AUDIO_FLAG_UNPOSITIONED))
|
||||
default_layout(impl->info.info.raw.channels,
|
||||
impl->info.info.raw.position,
|
||||
SPA_N_ELEMENTS(impl->info.info.raw.position));
|
||||
if (SPA_FLAG_IS_SET(impl->info.info.raw.flags, SPA_AUDIO_FLAG_UNPOSITIONED)) {
|
||||
default_layout(impl->info.info.raw.channels, impl->info.info.raw.position);
|
||||
SPA_FLAG_CLEAR(impl->info.info.raw.flags, SPA_AUDIO_FLAG_UNPOSITIONED);
|
||||
}
|
||||
impl->stream_info = impl->info;
|
||||
impl->format_info = find_audio_format_info(&impl->info);
|
||||
if (impl->format_info == NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue