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 727757 - atdec: Fails to decode multichannel streams
atdec: Fails to decode multichannel streams
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Mac OS
: Normal major
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 719988 727756 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2014-04-07 14:38 UTC by Andoni Morales
Modified: 2018-11-03 13:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-atdec-fix-support-for-multi-channels-streams.patch (7.44 KB, patch)
2014-04-17 16:21 UTC, Andoni Morales
none Details | Review
atdec: fix channel layout map (3.42 KB, patch)
2014-07-03 00:23 UTC, Thiago Sousa Santos
needs-work Details | Review
atdec: fix support for multichannel audio (6.32 KB, patch)
2015-04-19 18:10 UTC, Yujin Lee
needs-work Details | Review

Description Andoni Morales 2014-04-07 14:38:23 UTC
Fails to decode http://mirror.bigbuckbunny.de/peach/bigbuckbunny_movies/big_buck_bunny_720p_h264.mov
Marked as a regression since it's the default decoder in OS X

iMac:Commands$ LC_ALL=C GST_DEBUG=*atdec*:5 ./gst-launch-1.0 playbin uri=file:///Users/fluendo/Downloads/big_buck_bunny_720p_h264.mov 
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
0:00:00.189682000 54717    0x101079320 DEBUG                  atdec atdec.c:181:gst_atdec_start:<atdec0> start
0:00:00.189928000 54717    0x101079320 DEBUG                  atdec atdec.c:271:gst_atdec_set_format:<atdec0> set_format
0:00:00.193547000 54717    0x101079320 ERROR                default audio-channels.c:355:gst_audio_channel_positions_from_mask: Invalid channel mask 0x0000000000000003 for 6 channels
0:00:00.193624000 54717    0x101079320 ERROR                default audio-info.c:286:gst_audio_info_from_caps: Invalid channel mask 0x0000000000000003 for 6 channels
2014-04-07 16:36:49.133 gst-launch-1.0[54717:1403] 16:36:49.133 ERROR:     [0x102195000] >aqme> MESubmixGraph.h:218: SetMixerChannelLayout: (0x8d5bd060): scope 2, element 0, tag=0x650002: error -10851
0:00:00.199654000 54717    0x101079320 WARN                   atdec atdec.c:331:gst_atdec_set_format:<atdec0> error: AudioQueueSetOfflineRenderFormat returned error: 560226676
ERROR: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstATDec:atdec0: The stream is in the wrong format.
Additional debug info:
atdec.c(331): gst_atdec_set_format (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstATDec:atdec0:
AudioQueueSetOfflineRenderFormat returned error: 560226676
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
Comment 1 Andoni Morales 2014-04-17 16:19:25 UTC
*** Bug 727756 has been marked as a duplicate of this bug. ***
Comment 2 Andoni Morales 2014-04-17 16:21:18 UTC
Created attachment 274615 [details] [review]
0001-atdec-fix-support-for-multi-channels-streams.patch

I will be away for the next weeks, please push it once it's reviewed
Comment 3 Andoni Morales 2014-04-17 17:54:03 UTC
*** Bug 719988 has been marked as a duplicate of this bug. ***
Comment 4 Andoni Morales 2014-04-20 11:47:20 UTC
Note that this patch does downmixing and channels reordering without the need of an audio converter element, but it's still not configuring the channel mask correctly when it needs to output the same channels layout as the input stream.
Comment 5 Sebastian Dröge (slomo) 2014-06-23 18:45:55 UTC
Why is this a blocker?
Comment 6 Andoni Morales 2014-06-23 23:36:25 UTC
It's a regression, now that atdec has the highest priority it's chosen by playbin and this pipeline that was working in 1.2 does not work anymore in 1.3:

gst-launch-1.0 playbin uri=http://mirror.bigbuckbunny.de/peach/bigbuckbunny_movies/big_buck_bunny_720p_h264.mov
Comment 7 Sebastian Dröge (slomo) 2014-06-24 06:48:50 UTC
Right, if nobody is going to fix that before 1.4.0 we will lower the rank of the element to NONE or MARGINAL again (something lower than gst-libav).
Comment 8 Sebastian Dröge (slomo) 2014-06-28 14:33:54 UTC
Andoni, are you working on this or should we lower the rank instead?
Comment 9 Andoni Morales 2014-07-02 00:13:14 UTC
I won't have time to work on this sorry
Comment 10 Thiago Sousa Santos 2014-07-03 00:23:05 UTC
Created attachment 279806 [details] [review]
atdec: fix channel layout map

Fix on top of Andoni's patch to use the output caps channel-mask to set
the output on the AudioToolbox object.

Please review and test this carefuly as this AudioToolbox API is new to me
and I didn't have much time to test this properly.
Comment 11 Sebastian Dröge (slomo) 2014-07-03 08:21:59 UTC
Review of attachment 279806 [details] [review]:

So let's summarize these change. What this means is that we check if downstream wants a specific channel layout. If it does we tell AT about that and it will produce output with exactly that channel layout in that order? So if we have a 2 channel MP3 but downstream wants 5.1, AT will upmix for us?

::: sys/applemedia/atdec.c
@@ +411,3 @@
+  if (gst_structure_get (s, "channel-mask", GST_TYPE_BITMASK,
+          &channel_mask, NULL)) {
+    gst_audio_channel_positions_from_mask (channels, channel_mask, pos);

The channel mask can have more bits set than the number of channels, even after fixating the caps. That's a dependency between the channels and channel-mask fields we currently can't express with our caps.

You have to check for that here, and just drop some bits (ideally on the correct side, don't drop front left and front right but the less important channels)

@@ +413,3 @@
+    gst_audio_channel_positions_from_mask (channels, channel_mask, pos);
+  } else {
+    memset (pos, 0, sizeof (GstAudioChannelPosition) * 64);

Note that undefined channel positions is GST_CHANNEL_POSITION_NONE and not 0
Comment 12 Thiago Sousa Santos 2014-07-10 14:11:29 UTC
I did some experiments out of gstreamer and it seems that AudioQueue can only produce 1 or 2 channels output, whenever I request it to do anything else it seems to silently error and produce silence. I didn't find confirmation on the docs for this and using CoreAudio I can ask the system what formats it supports and if I give it a 6 channels input it says it can produce a 6 chanenls decoded output.

So, either we are missing something about AudioQueue or there is some other object in AudioToolbox to allow us to properly decode this.
Comment 13 Sebastian Dröge (slomo) 2014-07-11 07:44:20 UTC
commit 2b63783c9498e96c2f3b176564e0c733aafae0d0
Author: Sebastian Dröge <sebastian@centricular.com>
Date:   Fri Jul 11 09:43:44 2014 +0200

    atdec: Change rank to MARGINAL until it can properly handle multichannel audio
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727757
Comment 14 Yujin Lee 2015-04-19 18:10:17 UTC
Created attachment 301941 [details] [review]
atdec: fix support for multichannel audio

I noticed that multichannel audio couldn't be supported last week. When I tried to play following two streams, below error messages displayed.
This patch makes channel-mask by channel number properly. And channel layout is also chosen for AAC 5.1CH. I think that this patch cannot support all of multichannel audio streams. But if we can figure out channel layout mapping additionally, it will be able to support more multichannel audio streams. I also checked that the multichannel audio stream was down-mixed in audio converter. And I also tried to check regressions. As I see, there is no regression. But I am still afraid if I don't know something.
Thanks.

(stream#1)
bash-3.2$ gst-launch-1.0 playbin uri=http://dash.edgesuite.net/digitalprimates/fraunhofer/480p_video/heaac_5_1_with_video/6chId/6chId_480p_heaac5_1.mpd
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Got context from element 'sink': gst.gl.GLDisplay=context, gst.gl.GLDisplay=(GstGLDisplay)"\(GstGLDisplayCocoa\)\ gldisplaycocoa0";
Redistribute latency...
0:00:00.244952000 20762 0x7fd94c0772d0 ERROR                default audio-info.c:287:gboolean gst_audio_info_from_caps(GstAudioInfo *, const GstCaps *): no channel-mask property given
2015-04-20 01:50:15.264 gst-launch-1.0[20762:81074] 01:50:15.264 ERROR:     >aqme> MESubmixGraph.h:220: SetMixerChannelLayout: (0x8511a069): scope 2, element 0, tag=0x650002: error -10851
ERROR: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstDashDemux:dashdemux0: GStreamer encountered a general stream error.
Additional debug info:
gstadaptivedemux.c(1498): _src_chain (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstDashDemux:dashdemux0:
stream stopped, reason not-negotiated
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline …

(stream#2)
bash-3.2$ gst-launch-1.0 playbin uri=http://mirror.cs.umn.edu/blender.org/peach/trailer/trailer_720p.mov
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
0:00:01.440573000 20760 0x7f7fab082940 ERROR                default audio-info.c:287:gboolean gst_audio_info_from_caps(GstAudioInfo *, const GstCaps *): no channel-mask property given
2015-04-20 01:50:05.891 gst-launch-1.0[20760:80970] 01:50:05.890 ERROR:     >aqme> MESubmixGraph.h:220: SetMixerChannelLayout: (0x85118069): scope 2, element 0, tag=0x650002: error -10851
Got context from element 'sink': gst.gl.GLDisplay=context, gst.gl.GLDisplay=(GstGLDisplay)"\(GstGLDisplayCocoa\)\ gldisplaycocoa0";
Redistribute latency...
ERROR: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstSoupHTTPSrc:source: Internal data flow error.
Additional debug info:
gstbasesrc.c(2949): void gst_base_src_loop(GstPad *) (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstSoupHTTPSrc:source:
streaming task paused, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
Comment 15 Sebastian Dröge (slomo) 2015-04-26 18:29:39 UTC
Review of attachment 301941 [details] [review]:

::: sys/applemedia/atdec.c
@@ +288,3 @@
 
+static gint
+gst_atdec_get_channel_mask (gint channels)

Where do you get these channel layouts from?
Comment 16 Yujin Lee 2015-04-27 07:08:25 UTC
I got the channel layouts information from gst_flite_test_src_fixate() function in gstflitetestsrc.c file(http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/ext/flite/gstflitetestsrc.c). Could you please let me know if I am mistaken?
Comment 17 Sebastian Dröge (slomo) 2015-04-27 08:02:06 UTC
You have to use whatever AudioToolbox tells you instead of using a random channel layout. See the patch done by Thiago in comment 10.
Comment 18 GStreamer system administrator 2018-11-03 13:22:10 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/137.