From fff260f1aab8fb39991f8603431d0a2a72356648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 6 May 2025 15:47:30 +0300 Subject: [PATCH] qtdemux: Don't configure any channel-mask in fallback case with 1 channel For mono we don't set any channel mask. Setting 0 would mean an unpositioned layout with a single channel. Part-of: --- .../gst-plugins-good/gst/isomp4/qtdemux.c | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c b/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c index 5e74dc0b86..20a849cce0 100644 --- a/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c +++ b/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c @@ -13134,15 +13134,17 @@ qtdemux_parse_chnl (GstQTDemux * qtdemux, GstByteReader * br, error: { - // Set a default channel mask on errors - guint64 default_mask = - gst_audio_channel_get_fallback_mask (entry->n_channels); - GST_WARNING_OBJECT (qtdemux, "Configuring default channel mask for %u channels", entry->n_channels); - gst_caps_set_simple (entry->caps, "channel-mask", GST_TYPE_BITMASK, - default_mask, NULL); + if (entry->n_channels > 1) { + // Set a default channel mask on errors + guint64 default_mask = + gst_audio_channel_get_fallback_mask (entry->n_channels); + + gst_caps_set_simple (entry->caps, "channel-mask", GST_TYPE_BITMASK, + default_mask, NULL); + } } } @@ -14468,15 +14470,17 @@ qtdemux_parse_chan (GstQTDemux * qtdemux, GstByteReader * br, error: { - // Set a default channel mask on errors - guint64 default_mask = - gst_audio_channel_get_fallback_mask (entry->n_channels); - GST_WARNING_OBJECT (qtdemux, "Configuring default channel mask for %u channels", entry->n_channels); - gst_caps_set_simple (entry->caps, "channel-mask", GST_TYPE_BITMASK, - default_mask, NULL); + if (entry->n_channels > 1) { + // Set a default channel mask on errors + guint64 default_mask = + gst_audio_channel_get_fallback_mask (entry->n_channels); + + gst_caps_set_simple (entry->caps, "channel-mask", GST_TYPE_BITMASK, + default_mask, NULL); + } } } @@ -16902,16 +16906,18 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak, guint32 * mvhd_matrix) qtdemux_parse_chan (qtdemux, &br, stream, entry); } } else { - // Set a default channel mask if all is unknown - guint64 default_mask = - gst_audio_channel_get_fallback_mask (entry->n_channels); - GST_DEBUG_OBJECT (qtdemux, "Configuring default channel mask for %u channels", entry->n_channels); - gst_caps_set_simple (entry->caps, "channel-mask", - GST_TYPE_BITMASK, default_mask, NULL); + if (entry->n_channels > 1) { + // Set a default channel mask if all is unknown + guint64 default_mask = + gst_audio_channel_get_fallback_mask (entry->n_channels); + + gst_caps_set_simple (entry->caps, "channel-mask", + GST_TYPE_BITMASK, default_mask, NULL); + } } break; }