Merge branch 'milan-crf-fix' into 'master'

milan-avb: CRF connection leading to crash

See merge request pipewire/pipewire!2843
This commit is contained in:
hackerman-kl 2026-05-28 18:06:23 +02:00
commit 2a67f207fc
3 changed files with 18 additions and 10 deletions

View file

@ -34,6 +34,7 @@ static struct descriptor *es_buidler_desc_stream_general_prepare(struct server *
if (type == AVB_AEM_DESC_STREAM_INPUT) { if (type == AVB_AEM_DESC_STREAM_INPUT) {
struct aecp_aem_stream_input_state_milan_v12 *w; struct aecp_aem_stream_input_state_milan_v12 *w;
const struct avb_aem_desc_stream *body = ptr; const struct avb_aem_desc_stream *body = ptr;
struct avb_aem_stream_format_info fi;
desc = server_add_descriptor(server, type, index, desc = server_add_descriptor(server, type, index,
sizeof(*w), size, ptr); sizeof(*w), size, ptr);
@ -46,13 +47,13 @@ static struct descriptor *es_buidler_desc_stream_general_prepare(struct server *
/* Milan v1.2 Section 5.3.8.7: started/stopped state defaults to started. */ /* Milan v1.2 Section 5.3.8.7: started/stopped state defaults to started. */
w->stream_in_sta.started = true; w->stream_in_sta.started = true;
struct avb_aem_stream_format_info fi;
avb_aem_stream_format_decode(body->current_format, &fi); avb_aem_stream_format_decode(body->current_format, &fi);
if (fi.kind == AVB_AEM_STREAM_FORMAT_KIND_CRF)
return desc;
stream = &w->stream_in_sta.common.stream; stream = &w->stream_in_sta.common.stream;
direction = SPA_DIRECTION_INPUT; direction = SPA_DIRECTION_INPUT;
stream->is_crf = (fi.kind == AVB_AEM_STREAM_FORMAT_KIND_CRF);
if (stream->is_crf)
pw_log_info("stream %u: CRF clock-reference, no audio data plane", index);
} else if (type == AVB_AEM_DESC_STREAM_OUTPUT) { } else if (type == AVB_AEM_DESC_STREAM_OUTPUT) {
struct aecp_aem_stream_output_state_milan_v12 *w; struct aecp_aem_stream_output_state_milan_v12 *w;

View file

@ -593,6 +593,7 @@ struct stream *server_create_stream(struct server *server, struct stream *stream
if (stream->stream == NULL) if (stream->stream == NULL)
goto error_free; goto error_free;
if (!stream->is_crf)
pw_stream_add_listener(stream->stream, pw_stream_add_listener(stream->stream,
&stream->stream_listener, &stream->stream_listener,
direction == SPA_DIRECTION_INPUT ? direction == SPA_DIRECTION_INPUT ?
@ -625,7 +626,8 @@ struct stream *server_create_stream(struct server *server, struct stream *stream
params[n_params++] = spa_format_audio_raw_build(&b, params[n_params++] = spa_format_audio_raw_build(&b,
SPA_PARAM_EnumFormat, &stream->info.info.raw); SPA_PARAM_EnumFormat, &stream->info.info.raw);
if ((res = pw_stream_connect(stream->stream, if (!stream->is_crf &&
(res = pw_stream_connect(stream->stream,
pw_direction_reverse(direction), pw_direction_reverse(direction),
PW_ID_ANY, PW_ID_ANY,
PW_STREAM_FLAG_MAP_BUFFERS | PW_STREAM_FLAG_MAP_BUFFERS |
@ -877,6 +879,10 @@ static void on_socket_data(void *data, int fd, uint32_t mask)
(struct avb_packet_iec61883 *)ph, (struct avb_packet_iec61883 *)ph,
len - (int)sizeof(*h)); len - (int)sizeof(*h));
break; break;
case AVB_SUBTYPE_CRF:
/* CRF clock-reference stream: no audio data plane.
* Consume and ignore (clock recovery is future work). */
break;
default: default:
pw_log_warn("unsupported subtype 0x%02x", ph->subtype); pw_log_warn("unsupported subtype 0x%02x", ph->subtype);
break; break;

View file

@ -37,6 +37,7 @@ struct stream {
struct spa_source *source; struct spa_source *source;
struct spa_source *flush_timer; struct spa_source *flush_timer;
uint64_t flush_last_ns; uint64_t flush_last_ns;
bool is_crf;
int prio; int prio;
int mtt; int mtt;
int t_uncertainty; int t_uncertainty;