adapter: use slave as filter for adapter

This makes the converter choose the final param and not the
slave, which makes more sense.
This commit is contained in:
Wim Taymans 2019-07-03 11:01:12 +02:00
parent cb6b8e0d17
commit 98d10bbd1f

View file

@ -528,19 +528,7 @@ static int negotiate_format(struct impl *impl)
spa_log_debug(this->log, NAME "%p: negiotiate", impl); spa_log_debug(this->log, NAME "%p: negiotiate", impl);
state = 0; state = 0;
if ((res = spa_node_port_enum_params_sync(impl->adapter_mix, format = NULL;
SPA_DIRECTION_REVERSE(impl->direction),
impl->adapter_mix_port,
SPA_PARAM_EnumFormat, &state,
NULL, &format, &b)) != 1) {
debug_params(impl, impl->adapter_mix,
SPA_DIRECTION_REVERSE(impl->direction),
impl->adapter_mix_port,
SPA_PARAM_EnumFormat, NULL);
return -ENOTSUP;
}
state = 0;
if ((res = spa_node_port_enum_params_sync(impl->slave_node, if ((res = spa_node_port_enum_params_sync(impl->slave_node,
impl->direction, 0, impl->direction, 0,
SPA_PARAM_EnumFormat, &state, SPA_PARAM_EnumFormat, &state,
@ -550,6 +538,19 @@ static int negotiate_format(struct impl *impl)
return -ENOTSUP; return -ENOTSUP;
} }
state = 0;
if ((res = spa_node_port_enum_params_sync(impl->adapter_mix,
SPA_DIRECTION_REVERSE(impl->direction),
impl->adapter_mix_port,
SPA_PARAM_EnumFormat, &state,
format, &format, &b)) != 1) {
debug_params(impl, impl->adapter_mix,
SPA_DIRECTION_REVERSE(impl->direction),
impl->adapter_mix_port,
SPA_PARAM_EnumFormat, NULL);
return -ENOTSUP;
}
spa_pod_fixate(format); spa_pod_fixate(format);
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG)) if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
spa_debug_format(0, NULL, format); spa_debug_format(0, NULL, format);
@ -576,7 +577,7 @@ static int negotiate_buffers(struct impl *impl)
uint8_t buffer[4096]; uint8_t buffer[4096];
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer)); struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
uint32_t state; uint32_t state;
struct spa_pod *param = NULL; struct spa_pod *param;
int res, i; int res, i;
bool in_alloc, out_alloc; bool in_alloc, out_alloc;
int32_t size, buffers, blocks, align, flags; int32_t size, buffers, blocks, align, flags;
@ -591,6 +592,17 @@ static int negotiate_buffers(struct impl *impl)
if (impl->n_buffers > 0) if (impl->n_buffers > 0)
return 0; return 0;
state = 0;
param = NULL;
if ((res = spa_node_port_enum_params_sync(impl->slave_node,
impl->direction, 0,
SPA_PARAM_Buffers, &state,
param, &param, &b)) != 1) {
debug_params(impl, impl->slave_node, impl->direction, 0,
SPA_PARAM_Buffers, param);
return -ENOTSUP;
}
state = 0; state = 0;
if ((res = spa_node_port_enum_params_sync(impl->adapter_mix, if ((res = spa_node_port_enum_params_sync(impl->adapter_mix,
SPA_DIRECTION_REVERSE(impl->direction), SPA_DIRECTION_REVERSE(impl->direction),
@ -603,18 +615,6 @@ static int negotiate_buffers(struct impl *impl)
SPA_PARAM_Buffers, param); SPA_PARAM_Buffers, param);
return -ENOTSUP; return -ENOTSUP;
} }
if (res != 1)
param = NULL;
state = 0;
if ((res = spa_node_port_enum_params_sync(impl->slave_node,
impl->direction, 0,
SPA_PARAM_Buffers, &state,
param, &param, &b)) < 0) {
debug_params(impl, impl->slave_node, impl->direction, 0,
SPA_PARAM_Buffers, param);
return res;
}
spa_pod_fixate(param); spa_pod_fixate(param);