bluez5: set node.rate for output streams

As AG, set node.rate for output streams that originate from remote
source, so that graph switches rate as needed.  This follows what
pipewire-pulse etc. do.

The patch is by Wim.
This commit is contained in:
Pauli Virtanen 2025-02-14 19:55:15 +02:00
parent 1c9b5fd258
commit 75243b7b02

View file

@ -970,7 +970,9 @@ static void emit_node_info(struct impl *this, bool full)
{
uint64_t old = full ? this->info.change_mask : 0;
char latency[64];
char rate[64];
char media_name[256];
struct port *port = &this->port;
spa_scnprintf(
media_name,
@ -987,10 +989,12 @@ static void emit_node_info(struct impl *this, bool full)
this->is_input ? "Audio/Source" : "Stream/Output/Audio" },
{ SPA_KEY_NODE_LATENCY, this->is_input ? "" : latency },
{ "media.name", media_name },
{ "node.rate", this->is_input ? "" : rate },
{ SPA_KEY_NODE_DRIVER, this->is_input ? "true" : "false" },
};
spa_scnprintf(latency, sizeof(latency), "%d/48000", this->node_latency);
spa_scnprintf(rate, sizeof(rate), "1/%d", port->current_format.info.raw.rate);
if (full)
this->info.change_mask = this->info_all;
@ -1273,6 +1277,9 @@ static int port_set_format(struct impl *this, struct port *port,
}
emit_port_info(this, port, false);
this->info.change_mask |= SPA_NODE_CHANGE_MASK_PROPS;
emit_node_info(this, false);
return 0;
}