mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
media-session: check stream move after configuring a new node
When a new node is configured, check if existing streams might need to be moved to it. This fixes the case where a stream has a target node set to some bluetooth device and it starts playing to the default device because the bluetooth device is not connected. When the BT device is then connected and configured, the stream is moved to the new BT device.
This commit is contained in:
parent
43603dd75d
commit
92f1a24849
1 changed files with 22 additions and 0 deletions
|
|
@ -123,6 +123,8 @@ struct node {
|
|||
unsigned int virtual:1;
|
||||
};
|
||||
|
||||
static int check_new_target(struct impl *impl, struct node *target);
|
||||
|
||||
static bool find_format(struct node *node)
|
||||
{
|
||||
struct impl *impl = node->impl;
|
||||
|
|
@ -210,6 +212,9 @@ static int configure_node(struct node *node, struct spa_audio_info *info, bool f
|
|||
|
||||
node->configured = true;
|
||||
|
||||
if (node->type == NODE_TYPE_DEVICE)
|
||||
check_new_target(impl, node);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -970,6 +975,23 @@ static int handle_move(struct impl *impl, struct node *src_node, struct node *ds
|
|||
return do_move_node(src_node, src_node->peer, dst_node);
|
||||
}
|
||||
|
||||
static int check_new_target(struct impl *impl, struct node *target)
|
||||
{
|
||||
struct node *node;
|
||||
const char *str = get_device_name(target);
|
||||
|
||||
spa_list_for_each(node, &impl->node_list, link) {
|
||||
pw_log_debug(NAME" %p: node %d target '%s' find:%s", impl,
|
||||
node->id, node->obj->target_node, str);
|
||||
|
||||
if (node->obj->target_node != NULL &&
|
||||
strcmp(node->obj->target_node , str) == 0) {
|
||||
handle_move(impl, node, target);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int metadata_property(void *object, uint32_t subject,
|
||||
const char *key, const char *type, const char *value)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue