After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 533817 - [audioconvert] Can't use default 7 channel layout / only support for a limited number of layouts
[audioconvert] Can't use default 7 channel layout / only support for a limite...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: 0.10.20
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-05-19 08:06 UTC by Sebastian Dröge (slomo)
Modified: 2008-05-29 11:34 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sebastian Dröge (slomo) 2008-05-19 08:06:13 UTC
With latest CVS audioconvert doesn't set channel positions when converting from 1 channel to >6 channels.

gst-launch-0.10 audiotestsrc ! audioconvert ! "audio/x-raw-int,channels=6" ! fakesink

=> works without warnings

gst-launch-0.10 audiotestsrc ! audioconvert ! "audio/x-raw-int,channels=7" ! fakesink

=>
** (gst-launch-0.10:10612): WARNING **: Found conflicting channel positions 4/5 and 3

** (gst-launch-0.10:10612): WARNING **: Failed to retrieve channel layout from caps. This usually means there is a GStreamer element that does not implement multichannel audio correctly. Please file a bug.

** (gst-launch-0.10:10612): WARNING **: Failed to retrieve channel layout from caps. This usually means there is a GStreamer element that does not implement multichannel audio correctly. Please file a bug.
Comment 1 Sebastian Dröge (slomo) 2008-05-19 08:27:03 UTC
Ok, one problem is, that for 7 channels the default layout is:
  {
        GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
        GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
        GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
        GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
        GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
        GST_AUDIO_CHANNEL_POSITION_LFE,
        GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
  }

multichannel.c doesn't allow rear center to be used together with rear left or rear right (wav for example allows this though).


For 8 channels the problem is, that no layout is set at all, probably a broken check somewhere.

For >= 9 channels it simply doesn't link unless you provide a channel layout. We should probably just set a NONE layout then.
Comment 2 Michael Smith 2008-05-19 17:05:15 UTC
Is there a good reason to not allow rear L+R+C, or is this just something that needs fixing? For 8 channels, there's probably a standard layout we can use that makes sense (front L+R+C, side L+R, rear L+R, LFE?); guess that just needs fixing.

Setting a NONE layout for >=9 channels is probably not sensible. Audioconvert actually has to _do_ something with the channels as well as selecting a channel layout - what semantics were you thinking of to go with this?
Comment 3 Sebastian Dröge (slomo) 2008-05-20 07:52:36 UTC
Tim suggested to use 
        GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
        GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
        GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
        GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
        GST_AUDIO_CHANNEL_POSITION_LFE,
        GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
        GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT
for 7 channels.

MPEG defines L R C LFE Ls Rs Cs for 6.1 according to some Apple page, WAVExt allows rear left/right together with rear center and front right/left of center together with front center.

So it might be that the checks in gst_audio_check_channel_positions() are wrong.
Comment 4 Sebastian Dröge (slomo) 2008-05-20 08:25:41 UTC
Fix for 8 channels is in CVS:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_fixate_channels):
Correctly set the default channel positions when converting to 8
channels.

For >8 channels using NONE layouts doesn't solve anything, right. The best would be to have more default channel layouts but I couldn't find anything above 7.1 so let's wait for this until it's needed.

Leaves the conflicting channel positions in the default 7 channel layout and when using RIFF files or something else that declares conflicting positions (which are valid in those formats).
Comment 5 Tim-Philipp Müller 2008-05-20 09:28:53 UTC
> Setting a NONE layout for >=9 channels is probably not sensible. Audioconvert
> actually has to _do_ something with the channels as well as selecting a channel
> layout - what semantics were you thinking of to go with this? 

If I'm not mistaken, in the case of more than 8 channels, audioconvert will only convert, but not do any mixing at all. So the number of input channels will always be number of output channels in that case, and the input layout will be the same as the output layout.

It might make sense to allow the special case of mono input => N channel output for N > 8 as well (with output layout of all NONE), but I don't think we do that yet.
Comment 6 Sebastian Dröge (slomo) 2008-05-20 11:08:12 UTC
So the conversion matrix when using channel-positions=(GstAudioChannelPosition)< GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, GST_AUDIO_CHANNEL_POSITION_REAR_LEFT, GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT, GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER, GST_AUDIO_CHANNEL_POSITION_LFE, GST_AUDIO_CHANNEL_POSITION_REAR_CENTER > is:

Matrix for 1 -> 7: { { 1,000000, 1,000000, -0,707107, 0,000000, 0,707107, 1,000000, 0,707107 } }

IMHO REAR_LEFT and REAR_CENTER should be exchanged in the matrix...


Tim, I don't think conversions to >8 channels make sense right now unless we add default layouts for those.
Comment 7 Sebastian Dröge (slomo) 2008-05-29 11:34:57 UTC
2008-05-29  Sebastian Dröge  <slomo@circular-chaos.org>

        * gst-libs/gst/audio/multichannel.c:
        (gst_audio_check_channel_positions),
        (gst_audio_set_structure_channel_positions_list),
        (gst_audio_fixate_channel_positions):
        Allow rear center together with rear left/right and other previously
        conflicting channel positions. The reason why they weren't allowed
        was the channel mixing implementation in audioconvert.
        Also take this into account when fixing channel layouts.

        Allow setting channel positions for 1/2 channels when using
        gst_audio_set_structure_channel_position().

        * gst/audioconvert/gstchannelmix.c:
        (gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
        (gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
        (gst_channel_mix_fill_special), (gst_channel_mix_fill_matrix):
        Major rewrite of the channel mixing.

        We now allow previously conflicting channel positions to appear
        together (rear center and rear left/right for example).
        Fixes bug #533817.

        Rework the way channels are mixed together to take more possible
        channel positions into account, properly mix from/to side channels
        and don't assume that either center, left&right or nothing of a
        specific position is available anymore.

        * tests/check/elements/audioconvert.c: (GST_START_TEST):
        Adjust unit tests with non-standard 1/2 channel layouts to the more
        correct new behaviour.

        Add a unit test for 5.1->Stereo downmixing.