[Bug 737127] New: interleave: interleaving does not respect the channel positions default order

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Mon Sep 22 09:10:53 PDT 2014


https://bugzilla.gnome.org/show_bug.cgi?id=737127
  GStreamer | gst-plugins-good | git

           Summary: interleave: interleaving does not respect the channel
                    positions default order
    Classification: Platform
           Product: GStreamer
           Version: git
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gst-plugins-good
        AssignedTo: gstreamer-bugs at lists.freedesktop.org
        ReportedBy: ao2 at ao2.it
         QAContact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---


Created an attachment (id=286823)
 --> (https://bugzilla.gnome.org/attachment.cgi?id=286823)
examples to show how interleave ignores the channel positions default ordering

Hi,

this report results from some investigation I did with regards to bug 735673
(and maybe bug 708988 is connected too).

First some background.

With the two following pipelines I was getting exactly the same file (despite
the swapped channel-mask properties):

gst-launch-1.0 interleave name=i ! audioconvert ! wavenc ! filesink
location=audio-interleave-test_1.wav audiotestsrc wave=0 num-buffers=100 !
audioconvert ! "audio/x-raw,channels=1,channel-mask=(bitmask)0x1" ! queue !
i.sink_0 audiotestsrc wave=2 num-buffers=100 ! audioconvert !
"audio/x-raw,channels=1,channel-mask=(bitmask)0x2" ! queue ! i.sink_1

gst-launch-1.0 interleave name=i ! audioconvert ! wavenc ! filesink
location=audio-interleave-test_2.wav audiotestsrc wave=0 num-buffers=100 !
audioconvert ! "audio/x-raw,channels=1,channel-mask=(bitmask)0x2" ! queue !
i.sink_0 audiotestsrc wave=2 num-buffers=100 ! audioconvert !
"audio/x-raw,channels=1,channel-mask=(bitmask)0x1" ! queue ! i.sink_1

I would have expected the channels to be swapped in the second file.

The same behaviour can be obtained by setting the channel-positions property in
code, with a different order; see the attached archive with two examples with
switched channel positions.

This is the diff between the two example programs:

--- interleave_wav_left-right.c 2014-09-22 13:30:10.878415269 +0200
+++ interleave_wav_right-left.c 2014-09-22 13:31:04.774844535 +0200
@@ -73,7 +73,7 @@ make_n_channel_wav (const gint channels,

   filesink = gst_element_factory_make ("filesink", NULL);
   fail_unless (filesink != NULL);
-  g_object_set (G_OBJECT (filesink), "location", "left-right.wav", NULL);
+  g_object_set (G_OBJECT (filesink), "location", "right-left.wav", NULL);
   gst_bin_add (GST_BIN (pipeline), filesink);
   fail_unless (gst_element_link (wavenc, filesink));

@@ -112,10 +112,10 @@ GST_START_TEST (test_encode_stereo)

   arr = g_value_array_new (2);
   g_value_init (&val, GST_TYPE_AUDIO_CHANNEL_POSITION);
-  g_value_set_enum (&val, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT);
+  g_value_set_enum (&val, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT);
   g_value_array_append (arr, &val);
   g_value_reset (&val);
-  g_value_set_enum (&val, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT);
+  g_value_set_enum (&val, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT);
   g_value_array_append (arr, &val);
   g_value_unset (&val);

They also produce the exact same file.

AFAIU a "channel position" in this context is meant to indicate the loudspeaker
position in the "physical" sense, it's not about the positions of the channel
in the wav stream, however this still affects the order of channels in the
stream: according to
http://msdn.microsoft.com/en-us/library/windows/hardware/dn653308%28v=vs.85%29.aspx
the "Default Channel Ordering" together with dwChannelMask are enough to
represent a complete mapping between channel position and loudspeaker position.

Right now, the interleave element is able to retrieve the info about channel
positions correctly (even when passing channel-mask via caps in the source
pads), but then it ignores it when actually interleaving the samples.

So I think the interleave element should interleave the samples reordering the
channels to follow the Default Ordering.

To be more explicit, in the example above, if sink_0 is RIGHT and sink_1 is
LEFT, the interleave_N() functions should put samples from sink_1 _before_
samples from sink_0 in order to re-enforce the "Default Ordering" from the
specification above. Right now, the interleaving is done following the sink
order, not the "channel position order".

Please let me know if I was not able to elaborate well enough.

I'll try to some up with a proof of concept patch if you agree with the
reasoning above.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list