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) {
struct aecp_aem_stream_input_state_milan_v12 *w;
const struct avb_aem_desc_stream *body = ptr;
struct avb_aem_stream_format_info fi;
desc = server_add_descriptor(server, type, index,
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. */
w->stream_in_sta.started = true;
struct avb_aem_stream_format_info 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;
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) {
struct aecp_aem_stream_output_state_milan_v12 *w;

View file

@ -593,12 +593,13 @@ struct stream *server_create_stream(struct server *server, struct stream *stream
if (stream->stream == NULL)
goto error_free;
pw_stream_add_listener(stream->stream,
&stream->stream_listener,
direction == SPA_DIRECTION_INPUT ?
&source_stream_events :
&sink_stream_events,
stream);
if (!stream->is_crf)
pw_stream_add_listener(stream->stream,
&stream->stream_listener,
direction == SPA_DIRECTION_INPUT ?
&source_stream_events :
&sink_stream_events,
stream);
{
uint16_t desc_type = (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,
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_ID_ANY,
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,
len - (int)sizeof(*h));
break;
case AVB_SUBTYPE_CRF:
/* CRF clock-reference stream: no audio data plane.
* Consume and ignore (clock recovery is future work). */
break;
default:
pw_log_warn("unsupported subtype 0x%02x", ph->subtype);
break;

View file

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