mxfdemux: Always calculate BlockAlign of raw audio
authorSeungha Yang <seungha@centricular.com>
Mon, 8 Aug 2022 14:37:11 +0000 (23:37 +0900)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 12 Aug 2022 19:26:08 +0000 (19:26 +0000)
Workaround for nBlockAlign and nBitsPerSample mismatch. Always
use the formula described in the specification for BlockAlign value

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2864>

subprojects/gst-plugins-bad/gst/mxf/mxfaes-bwf.c

index d828233ff3a595ccc2f750aa67a248ba76a3b50a..ca59a662a4b4eb9f0fb92fd65e54854beacf417b 100644 (file)
@@ -1270,12 +1270,13 @@ mxf_bwf_create_caps (MXFMetadataTimelineTrack * track,
       GST_ERROR ("Invalid descriptor");
       return NULL;
     }
-    if (wa_descriptor && wa_descriptor->block_align != 0)
-      block_align = wa_descriptor->block_align;
-    else
-      block_align =
-          (GST_ROUND_UP_8 (descriptor->quantization_bits) *
-          descriptor->channel_count) / 8;
+
+    /* XXX: block align value can be carried via audio essential descriptor but
+     * there are some files with broken block align value.
+     * Calculates the value always */
+    block_align =
+        (GST_ROUND_UP_8 (descriptor->quantization_bits) *
+        descriptor->channel_count) / 8;
 
     audio_format =
         gst_audio_format_build_integer (block_align !=
@@ -1302,12 +1303,12 @@ mxf_bwf_create_caps (MXFMetadataTimelineTrack * track,
       return NULL;
     }
 
-    if (wa_descriptor && wa_descriptor->block_align != 0)
-      block_align = wa_descriptor->block_align;
-    else
-      block_align =
-          (GST_ROUND_UP_8 (descriptor->quantization_bits) *
-          descriptor->channel_count) / 8;
+    /* XXX: block align value can be carried via audio essential descriptor but
+     * there are some files with broken block align value.
+     * Calculates the value always */
+    block_align =
+        (GST_ROUND_UP_8 (descriptor->quantization_bits) *
+        descriptor->channel_count) / 8;
 
     audio_format =
         gst_audio_format_build_integer (block_align !=