media-session: only deal with state when it changed

Look at the change_mask and only deal with the state when it changed
or else we might start the idle timer again when something unrelated
changed.
This commit is contained in:
Wim Taymans 2019-10-18 21:52:24 +02:00
parent 92d5c179d6
commit 1eca773145

View file

@ -305,17 +305,19 @@ static void node_event_info(void *object, const struct pw_node_info *info)
pw_log_debug(NAME" %p: info for node %d type %d", impl, n->obj.id, n->type);
n->info = pw_node_info_update(n->info, info);
switch (info->state) {
case PW_NODE_STATE_IDLE:
on_node_idle(impl, n);
break;
case PW_NODE_STATE_RUNNING:
on_node_running(impl, n);
break;
case PW_NODE_STATE_SUSPENDED:
break;
default:
break;
if (info->change_mask & PW_NODE_CHANGE_MASK_STATE) {
switch (info->state) {
case PW_NODE_STATE_IDLE:
on_node_idle(impl, n);
break;
case PW_NODE_STATE_RUNNING:
on_node_running(impl, n);
break;
case PW_NODE_STATE_SUSPENDED:
break;
default:
break;
}
}
}