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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
This commit is contained in:
Sebastian Dröge 2025-05-05 18:35:03 +03:00 committed by GStreamer Marge Bot
parent d98df47e53
commit 18db5538a0

View File

@ -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;