media-session: start timeout only when something changed

This commit is contained in:
Wim Taymans 2021-01-28 14:36:29 +01:00
parent 072d3a191c
commit fc08c79dad
2 changed files with 8 additions and 6 deletions

View file

@ -314,9 +314,10 @@ static int handle_profile(struct device *dev)
return 0; return 0;
dev->active_profile = pr.index; dev->active_profile = pr.index;
pw_log_info("device '%s': active profile changed to '%s'", dev->name, pr.name); if (pw_properties_setf(impl->properties, dev->key, "{ \"name\": \"%s\" }", pr.name)) {
pw_properties_setf(impl->properties, dev->key, "{ \"name\": \"%s\" }", pr.name); pw_log_info("device '%s': active profile changed to '%s'", dev->name, pr.name);
add_idle_timeout(impl); add_idle_timeout(impl);
}
} }
return 0; return 0;
} }

View file

@ -412,10 +412,11 @@ static int handle_route(struct device *dev, struct route *r)
restore_route(dev, val, r->index, r->device_id); restore_route(dev, val, r->index, r->device_id);
} else if (r->props) { } else if (r->props) {
char *val = serialize_props(dev, r->props); char *val = serialize_props(dev, r->props);
pw_log_info("device %d: route properties changed %s %s", dev->id, key, val); if (pw_properties_set(impl->to_restore, key, val)) {
pw_properties_set(impl->to_restore, key, val); pw_log_info("device %d: route properties changed %s %s", dev->id, key, val);
add_idle_timeout(impl);
}
free(val); free(val);
add_idle_timeout(impl);
i->generation = dev->generation; i->generation = dev->generation;
} }
return 0; return 0;