This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/pipewire.git#8efa647705d110709be5e8742e3cd6138889dfbb
68 lines
2.1 KiB
Diff
68 lines
2.1 KiB
Diff
From edf102a6659b4eb58eebf055d459e182508a521c Mon Sep 17 00:00:00 2001
|
|
From: Wim Taymans <wtaymans@redhat.com>
|
|
Date: Fri, 19 Mar 2021 15:51:17 +0100
|
|
Subject: [PATCH 03/10] 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.
|
|
---
|
|
src/examples/media-session/policy-node.c | 22 ++++++++++++++++++++++
|
|
1 file changed, 22 insertions(+)
|
|
|
|
diff --git a/src/examples/media-session/policy-node.c b/src/examples/media-session/policy-node.c
|
|
index 966da2fe3..7ed73e9a5 100644
|
|
--- a/src/examples/media-session/policy-node.c
|
|
+++ b/src/examples/media-session/policy-node.c
|
|
@@ -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)
|
|
{
|
|
--
|
|
2.26.3
|
|
|