isomp4: Fix (E)AC-3 channel count handling

The muxer used a fixed value of 2 channels because the TR 102 366 spec
says they're to be ignored. However, the demuxer still trusted them,
resulting in bad caps.

Make the muxer fill in the correct channel count anyway (FFmpeg already
does) and make the demuxer ignore the value.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4739>
This commit is contained in:
Jan Alexander Steffens (heftig) 2023-05-30 15:10:11 +02:00 committed by GStreamer Marge Bot
parent 7fd1145419
commit 93699123b4
2 changed files with 13 additions and 3 deletions

View file

@ -6087,9 +6087,9 @@ gst_qt_mux_audio_sink_set_caps (GstQTMuxPad * qtpad, GstCaps * caps)
} else if (strcmp (mimetype, "audio/x-ac3") == 0) { } else if (strcmp (mimetype, "audio/x-ac3") == 0) {
entry.fourcc = FOURCC_ac_3; entry.fourcc = FOURCC_ac_3;
/* Fixed values according to TS 102 366 but it also mentions that /* TS 102 366 mentions that these fields should be ignored,
* they should be ignored */ * but be friendly and fill in the channel count like FFmpeg does */
entry.channels = 2; entry.channels = channels;
entry.sample_size = 16; entry.sample_size = 16;
/* AC-3 needs an extension atom but its data can only be obtained from /* AC-3 needs an extension atom but its data can only be obtained from

View file

@ -13205,6 +13205,16 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
entry->bytes_per_packet = entry->bytes_per_sample; entry->bytes_per_packet = entry->bytes_per_sample;
break; break;
} }
/* According to TS 102 366, the channel count in
* a (E)AC3SampleEntry box is to be ignored */
case 0x20736d:
case GST_MAKE_FOURCC ('e', 'c', '-', '3'):
case GST_MAKE_FOURCC ('s', 'a', 'c', '3'): // Nero Recode
case FOURCC_ac_3:
entry->n_channels = 0;
break;
default: default:
break; break;
} }