From 18db5538a05e27a4606193e4a6d67d68b165c9fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 5 May 2025 18:35:03 +0300 Subject: [PATCH] qtdemux: Don't parse audio sample entry a second time in mp4a fallback case These values were all passed a few hundred lines above already and can directly be re-used here. The offset for the sample rate was also wrong. Part-of: --- .../gst-plugins-good/gst/isomp4/qtdemux.c | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c b/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c index c938f4c2f5..f1076db465 100644 --- a/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c +++ b/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c @@ -16841,32 +16841,15 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak, guint32 * mvhd_matrix) case FOURCC_mp4a: { /* mp4a atom withtout ESDS; Attempt to build codec data from atom */ - gint len = QT_UINT32 (stsd_entry_data); - guint16 sound_version = 0; /* FIXME: Can this be determined somehow? There doesn't seem to be - * anything in mp4a atom that specifis compression */ + * anything in mp4a atom that specifies compression */ gint profile = 2; guint16 channels = entry->n_channels; - guint32 time_scale = (guint32) entry->rate; + guint32 sample_rate = (guint32) entry->rate; gint sample_rate_index = -1; - if (len >= 34) { - sound_version = QT_UINT16 (stsd_entry_data + 16); - - if (sound_version == 1) { - channels = QT_UINT16 (stsd_entry_data + 24); - time_scale = QT_UINT32 (stsd_entry_data + 30); - } else { - GST_FIXME_OBJECT (qtdemux, "Unhandled mp4a atom version %d", - sound_version); - } - } else { - GST_DEBUG_OBJECT (qtdemux, "Too small stsd entry data len %d", - len); - } - sample_rate_index = - gst_codec_utils_aac_get_index_from_sample_rate (time_scale); + gst_codec_utils_aac_get_index_from_sample_rate (sample_rate); if (sample_rate_index >= 0 && channels > 0) { guint8 codec_data[2]; GstBuffer *buf;