stream: normalize volumes when monitoring

This commit is contained in:
Wim Taymans 2020-10-07 12:45:28 +02:00
parent 9054cfcd8b
commit 5c048500cc
2 changed files with 11 additions and 0 deletions

View file

@ -1181,6 +1181,7 @@ impl_init(const struct spa_handle_factory *factory,
{
struct impl *this;
struct port *port;
const char *str;
spa_return_val_if_fail(factory != NULL, -EINVAL);
spa_return_val_if_fail(handle != NULL, -EINVAL);
@ -1198,6 +1199,15 @@ impl_init(const struct spa_handle_factory *factory,
spa_hook_list_init(&this->hooks);
if (info != NULL) {
if ((str = spa_dict_lookup(info, "channelmix.normalize")) != NULL &&
(strcmp(str, "true") == 0 || atoi(str) != 0))
this->mix.options |= CHANNELMIX_OPTION_NORMALIZE;
if ((str = spa_dict_lookup(info, "channelmix.mix-lfe")) != NULL &&
(strcmp(str, "true") == 0 || atoi(str) != 0))
this->mix.options |= CHANNELMIX_OPTION_MIX_LFE;
}
this->node.iface = SPA_INTERFACE_INIT(
SPA_TYPE_INTERFACE_Node,
SPA_VERSION_NODE,

View file

@ -1534,6 +1534,7 @@ pw_stream_connect(struct pw_stream *stream,
if ((str = pw_properties_get(props, PW_KEY_STREAM_MONITOR)) &&
pw_properties_parse_bool(str)) {
pw_properties_set(props, "resample.peaks", "true");
pw_properties_set(props, "channelmix.normalize", "true");
}
follower = pw_context_create_node(impl->context, pw_properties_copy(props), 0);