XXX push upstream?
Raw SPA audio streams carry interleaved samples but the sink pad
template accepts ANY caps, so upstream elements preferring the
non-interleaved layout get their planar buffers misinterpreted as
interleaved, garbling the audio. Declare the supported media types in
the pad template with raw audio constrained to the interleaved layout
so that every negotiation path converges on interleaved, prefer it
when fixating, and fail set_caps cleanly when no usable format
remains.

Index: src/gst/gstpipewiresink.c
--- src/gst/gstpipewiresink.c.orig
+++ src/gst/gstpipewiresink.c
@@ -102,8 +102,20 @@ static GstStaticPadTemplate gst_pipewire_sink_template
 GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS_ANY
-    );
+    GST_STATIC_CAPS (
+        "video/x-raw(memory:DMABuf); "
+        "video/x-raw; "
+        /* raw SPA audio streams carry interleaved samples */
+        "audio/x-raw, layout = (string) interleaved; "
+        "image/jpeg; "
+        "video/x-jpeg; "
+        "video/x-h264; "
+        "video/x-h265; "
+        "audio/x-mulaw; "
+        "audio/x-alaw; "
+        "audio/mpeg; "
+        "audio/x-flac"
+    ));
 
 #define gst_pipewire_sink_parent_class parent_class
 G_DEFINE_TYPE (GstPipeWireSink, gst_pipewire_sink, GST_TYPE_BASE_SINK);
@@ -425,6 +437,7 @@ gst_pipewire_sink_sink_fixate (GstBaseSink * bsink, Gs
           "progressive", NULL);
   } else if (gst_structure_has_name (structure, "audio/x-raw")) {
     gst_structure_fixate_field_string (structure, "format", "S16LE");
+    gst_structure_fixate_field_string (structure, "layout", "interleaved");
     gst_structure_fixate_field_nearest_int (structure, "channels", 2);
     gst_structure_fixate_field_nearest_int (structure, "rate", 44100);
   } else if (gst_structure_has_name (structure, "audio/mpeg")) {
@@ -891,6 +904,10 @@ gst_pipewire_sink_setcaps (GstBaseSink * bsink, GstCap
   spa_dll_set_bw(&pwsink->stream->dll, SPA_DLL_BW_MIN, 4096, rate);
 
   possible = gst_caps_to_format_all (caps);
+  if (possible->len == 0) {
+    GST_ERROR_OBJECT (pwsink, "no usable formats in %" GST_PTR_FORMAT, caps);
+    return FALSE;
+  }
 
   pw_thread_loop_lock (pwsink->stream->core->loop);
   state = pw_stream_get_state (pwsink->stream->pwstream, &error);
