mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-18 06:46:28 -04:00
module-avb: fix ACMP error responses sent with wrong message type
In handle_connect_tx_command() and handle_disconnect_tx_command(), AVB_PACKET_ACMP_SET_MESSAGE_TYPE() is called after the goto done target. When find_stream() fails and jumps to done, the response is sent with the original command message type (e.g., CONNECT_TX_COMMAND) instead of the correct response type (CONNECT_TX_RESPONSE). Also fix pending_destroy() which used < PENDING_CONTROLLER instead of <= PENDING_CONTROLLER, skipping cleanup of pending controller requests on shutdown. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e57ec894e5
commit
a5c16955d7
1 changed files with 5 additions and 4 deletions
|
|
@ -82,7 +82,7 @@ static void pending_free(struct acmp *acmp, struct pending *p)
|
||||||
static void pending_destroy(struct acmp *acmp)
|
static void pending_destroy(struct acmp *acmp)
|
||||||
{
|
{
|
||||||
struct pending *p, *t;
|
struct pending *p, *t;
|
||||||
for (uint32_t list_id = 0; list_id < PENDING_CONTROLLER; list_id++) {
|
for (uint32_t list_id = 0; list_id <= PENDING_CONTROLLER; list_id++) {
|
||||||
spa_list_for_each_safe(p, t, &acmp->pending[list_id], link) {
|
spa_list_for_each_safe(p, t, &acmp->pending[list_id], link) {
|
||||||
pending_free(acmp, p);
|
pending_free(acmp, p);
|
||||||
}
|
}
|
||||||
|
|
@ -174,13 +174,14 @@ static int handle_connect_tx_command(struct acmp *acmp, uint64_t now, const void
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
memcpy(buf, m, len);
|
memcpy(buf, m, len);
|
||||||
|
AVB_PACKET_ACMP_SET_MESSAGE_TYPE(reply, AVB_ACMP_MESSAGE_TYPE_CONNECT_TX_RESPONSE);
|
||||||
|
|
||||||
stream = find_stream(server, SPA_DIRECTION_OUTPUT, ntohs(reply->talker_unique_id));
|
stream = find_stream(server, SPA_DIRECTION_OUTPUT, ntohs(reply->talker_unique_id));
|
||||||
if (stream == NULL) {
|
if (stream == NULL) {
|
||||||
status = AVB_ACMP_STATUS_TALKER_NO_STREAM_INDEX;
|
status = AVB_ACMP_STATUS_TALKER_NO_STREAM_INDEX;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVB_PACKET_ACMP_SET_MESSAGE_TYPE(reply, AVB_ACMP_MESSAGE_TYPE_CONNECT_TX_RESPONSE);
|
|
||||||
reply->stream_id = htobe64(stream->id);
|
reply->stream_id = htobe64(stream->id);
|
||||||
|
|
||||||
stream_activate(stream, ntohs(reply->talker_unique_id), now);
|
stream_activate(stream, ntohs(reply->talker_unique_id), now);
|
||||||
|
|
@ -251,14 +252,14 @@ static int handle_disconnect_tx_command(struct acmp *acmp, uint64_t now, const v
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
memcpy(buf, m, len);
|
memcpy(buf, m, len);
|
||||||
|
AVB_PACKET_ACMP_SET_MESSAGE_TYPE(reply, AVB_ACMP_MESSAGE_TYPE_DISCONNECT_TX_RESPONSE);
|
||||||
|
|
||||||
stream = find_stream(server, SPA_DIRECTION_OUTPUT, ntohs(reply->talker_unique_id));
|
stream = find_stream(server, SPA_DIRECTION_OUTPUT, ntohs(reply->talker_unique_id));
|
||||||
if (stream == NULL) {
|
if (stream == NULL) {
|
||||||
status = AVB_ACMP_STATUS_TALKER_NO_STREAM_INDEX;
|
status = AVB_ACMP_STATUS_TALKER_NO_STREAM_INDEX;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVB_PACKET_ACMP_SET_MESSAGE_TYPE(reply, AVB_ACMP_MESSAGE_TYPE_DISCONNECT_TX_RESPONSE);
|
|
||||||
|
|
||||||
stream_deactivate(stream, now);
|
stream_deactivate(stream, now);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue