qtmux: fix byte order for opus extension

The "Encapsulation of Opus in ISO Base Media File Format" [1] specifications,
§ 4.3.2 Opus Specific Box, indicates that data must be stored as big-endian.

In `build_opus_extension`, `gst_byte_writer_put*_le ()` variants were used,
causing audio streams conversion to Opus in mp4 to offset samples due to the
PreSkip field incorrect value (29ms early in our test cases).

[1] https://opus-codec.org/docs/opus_in_isobmff.html#4.3.2

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4875>
This commit is contained in:
François Laignel 2023-06-16 10:02:16 +02:00 committed by GStreamer Marge Bot
parent 0b981a216c
commit f3496ea3bf

View file

@ -5706,9 +5706,9 @@ build_opus_extension (guint32 rate, guint8 channels, guint8 mapping_family,
gst_byte_writer_init (&bw);
hdl &= gst_byte_writer_put_uint8 (&bw, 0x00); /* version number */
hdl &= gst_byte_writer_put_uint8 (&bw, channels);
hdl &= gst_byte_writer_put_uint16_le (&bw, pre_skip);
hdl &= gst_byte_writer_put_uint32_le (&bw, rate);
hdl &= gst_byte_writer_put_uint16_le (&bw, output_gain);
hdl &= gst_byte_writer_put_uint16_be (&bw, pre_skip);
hdl &= gst_byte_writer_put_uint32_be (&bw, rate);
hdl &= gst_byte_writer_put_uint16_be (&bw, output_gain);
hdl &= gst_byte_writer_put_uint8 (&bw, mapping_family);
if (mapping_family > 0) {
hdl &= gst_byte_writer_put_uint8 (&bw, stream_count);