From f85106b86ae10ff276b0ff46371e0dd591c54025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Mon, 19 Jun 2023 16:26:57 +0200 Subject: [PATCH] mp4, fmp4: fix byte order for opus extension MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 `write_dops`, `to_le_bytes` variants were used. Related to [2]. [1] https://opus-codec.org/docs/opus_in_isobmff.html#4.3.2 [2] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4875 Part-of: --- mux/fmp4/src/fmp4mux/boxes.rs | 6 +++--- mux/mp4/src/mp4mux/boxes.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mux/fmp4/src/fmp4mux/boxes.rs b/mux/fmp4/src/fmp4mux/boxes.rs index 720c823e..9d84158e 100644 --- a/mux/fmp4/src/fmp4mux/boxes.rs +++ b/mux/fmp4/src/fmp4mux/boxes.rs @@ -1502,9 +1502,9 @@ fn write_dops(v: &mut Vec, caps: &gst::Caps) -> Result<(), Error> { // Version number v.push(0); v.push(channels); - v.extend(pre_skip.to_le_bytes()); - v.extend(rate.to_le_bytes()); - v.extend(output_gain.to_le_bytes()); + v.extend(pre_skip.to_be_bytes()); + v.extend(rate.to_be_bytes()); + v.extend(output_gain.to_be_bytes()); v.push(channel_mapping_family); if channel_mapping_family > 0 { v.push(stream_count); diff --git a/mux/mp4/src/mp4mux/boxes.rs b/mux/mp4/src/mp4mux/boxes.rs index 9dd37aea..c1fa7791 100644 --- a/mux/mp4/src/mp4mux/boxes.rs +++ b/mux/mp4/src/mp4mux/boxes.rs @@ -1319,9 +1319,9 @@ fn write_dops(v: &mut Vec, caps: &gst::Caps) -> Result<(), Error> { // Version number v.push(0); v.push(channels); - v.extend(pre_skip.to_le_bytes()); - v.extend(rate.to_le_bytes()); - v.extend(output_gain.to_le_bytes()); + v.extend(pre_skip.to_be_bytes()); + v.extend(rate.to_be_bytes()); + v.extend(output_gain.to_be_bytes()); v.push(channel_mapping_family); if channel_mapping_family > 0 { v.push(stream_count);