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); 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); n->info = pw_node_info_update(n->info, info);
switch (info->state) { if (info->change_mask & PW_NODE_CHANGE_MASK_STATE) {
case PW_NODE_STATE_IDLE: switch (info->state) {
on_node_idle(impl, n); case PW_NODE_STATE_IDLE:
break; on_node_idle(impl, n);
case PW_NODE_STATE_RUNNING: break;
on_node_running(impl, n); case PW_NODE_STATE_RUNNING:
break; on_node_running(impl, n);
case PW_NODE_STATE_SUSPENDED: break;
break; case PW_NODE_STATE_SUSPENDED:
default: break;
break; default:
break;
}
} }
} }