diff --git a/doc/dox/internals/protocol.dox b/doc/dox/internals/protocol.dox index 7a62247a8..a0390e108 100644 --- a/doc/dox/internals/protocol.dox +++ b/doc/dox/internals/protocol.dox @@ -1130,6 +1130,8 @@ follows: |<----------------------------------------| | ClientNode::PortSetMixInfo | mixer inputs for each linked port |<----------------------------------------| + | ClientNode::PortSetParam | PeerCapability of the ports + |<----------------------------------------| | ClientNode::PortSetParam | Latency of the ports |<----------------------------------------| | ClientNode::SetActivation | activation of port peers diff --git a/src/examples/video-play.c b/src/examples/video-play.c index 64c68c874..bb293289e 100644 --- a/src/examples/video-play.c +++ b/src/examples/video-play.c @@ -277,6 +277,7 @@ static void parse_peer_capability(struct data *data, const struct spa_pod *param struct spa_peer_param_info info; void *state = NULL; + fprintf(stderr, "peer capability\n"); while (spa_peer_param_parse(param, &info, sizeof(info), &state) == 1) { struct spa_param_dict_info di; diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index dca27278e..20b9e90f2 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -146,6 +147,7 @@ struct stream { struct spa_callbacks rt_callbacks; + unsigned int have_peer_capability:1; unsigned int disconnecting:1; unsigned int disconnect_core:1; unsigned int draining:1; @@ -915,6 +917,21 @@ static int parse_latency(struct pw_stream *stream, const struct spa_pod *param, return 0; } +static void emit_dummy_peer_capability(struct stream *impl, bool empty) +{ + struct spa_pod *param = NULL; + uint8_t buffer[1024]; + if (!empty) { + struct spa_pod_frame f; + struct spa_pod_builder b; + spa_pod_builder_init(&b, buffer, sizeof(buffer)); + spa_peer_param_build_start(&b, &f, SPA_PARAM_PeerCapability); + spa_peer_param_build_add_param(&b, SPA_ID_INVALID, NULL); + param = spa_peer_param_build_end(&b, &f); + } + emit_param_changed(impl, SPA_PARAM_PeerCapability, param); +} + static int impl_port_set_param(void *object, enum spa_direction direction, uint32_t port_id, uint32_t id, uint32_t flags, @@ -922,7 +939,7 @@ static int impl_port_set_param(void *object, { struct stream *impl = object; struct pw_stream *stream = &impl->this; - uint32_t user, fl = 0; + uint32_t user = 0, fl = 0; int res; const struct spa_pod *params[1]; uint32_t n_params = 0; @@ -942,7 +959,12 @@ static int impl_port_set_param(void *object, n_params = param ? 1 : 0; switch (id) { + case SPA_PARAM_PeerCapability: + impl->have_peer_capability = true; + break; case SPA_PARAM_Latency: + if (!impl->have_peer_capability) + emit_dummy_peer_capability(impl, param == NULL); parse_latency(stream, param, &fl); break; }