media-session: rework device reservation

Monitor the device reservation objects and mark the device available.
Don't select nodes from devices that are not available.
Acquire the device reservation when a device starts.
Release the device reservation when we suspend the device again.
This commit is contained in:
Wim Taymans 2020-02-19 18:15:57 +01:00
parent 11086f23ea
commit d3634aca7e
6 changed files with 188 additions and 59 deletions

View file

@ -92,6 +92,8 @@ static void idle_timeout(void *data, uint64_t expirations)
remove_idle_timeout(node);
pw_node_send_command((struct pw_node*)node->obj->obj.proxy, cmd);
sm_object_release(&node->obj->obj);
}
static void add_idle_timeout(struct node *node)
@ -118,6 +120,7 @@ static int on_node_idle(struct impl *impl, struct node *node)
static int on_node_running(struct impl *impl, struct node *node)
{
pw_log_debug(NAME" %p: node %d running", impl, node->id);
sm_object_acquire(&node->obj->obj);
remove_idle_timeout(node);
return 0;
}