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 731038 - playbin downmixes 5.0 multichannel-audio to stereo
playbin downmixes 5.0 multichannel-audio to stereo
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.2.4
Other Linux
: Normal normal
: 1.5.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-05-31 09:21 UTC by henry
Modified: 2014-11-12 14:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
logs of 0.1 and 1.0 gst-launch playbin playing 5.0 channels testfile (241.73 KB, application/x-compressed-tar)
2014-06-01 12:32 UTC, henry
  Details
set the channel positions using the appropriate API (1.29 KB, patch)
2014-06-04 11:13 UTC, Vincent Penquerc'h
needs-work Details | Review
similar for faad (1.97 KB, patch)
2014-06-06 13:10 UTC, Vincent Penquerc'h
needs-work Details | Review
similar for dvdlpcmdec (1.38 KB, patch)
2014-06-06 13:10 UTC, Vincent Penquerc'h
needs-work Details | Review
flacparse: set ordered chanel positions (3.97 KB, patch)
2014-06-09 14:18 UTC, Vincent Penquerc'h
committed Details | Review
faad: set ordered chanel positions (2.51 KB, patch)
2014-06-09 14:19 UTC, Vincent Penquerc'h
committed Details | Review
dvdlpcmdec: set ordered chanel positions (2.97 KB, patch)
2014-06-09 14:20 UTC, Vincent Penquerc'h
committed Details | Review

Description henry 2014-05-31 09:21:15 UTC
when playbin gets the uri of a file containing audio with 5.0 channels (FRONT_LEFT,FRONT_RIGHT,FRONT_CENTER,REAR_LEFT,REAR_RIGHT) it gives following warning:

**(python3:13745): WARNING **: Unpositioned audio channel position flag set but channel positions present
and plays the file downmixed to stereo.

5.1 gives the same warning but plays properly
same behaviour using gst-play-1.0

the above did not happend using gstreamer 0.1 components
gst123 played properly

the handmade pipeline below plays properly to
gst-launch-1.0 -v filesrc location=testchannels50.flac ! flacparse ! flacdec ! audioconvert ! audio/x-raw, channels=6 ! alsasink

please restore the behaviour of the 0.1 version, because 5.0 is the MOST common case in classical-music media (LFE is mostly unwanted here) .
Nearly all comercial classical concertvideos and buyable audio-files have the above channellayout.
So it would be convenient for users of playbin, that the warning may remain, but the most common channel-layout for 5.0 is set as default in the same manner as you do it for 5.1
Comment 2 Tim-Philipp Müller 2014-05-31 11:37:10 UTC
I get 404 not found for that file.

Could you attach a compressed (xz -9) debug log made with GST_DEBUG=*:6 for the old 0.10 case and gst-play-1.0 ? The first second or so should be enough, we just need the preroll/negotiation steps.
Comment 4 henry 2014-06-01 12:32:14 UTC
Created attachment 277675 [details]
logs of 0.1 and 1.0 gst-launch playbin playing 5.0 channels testfile
Comment 5 henry 2014-06-01 12:33:31 UTC
attached requested logfiles

Note:
the 0.10 testrun lacks sound with  --gst-debug=*:6,  while 1.0 plays sound whith the same option
but i can confirm that 0.10 without --gst-debug=*:6 played fine.
confirmation based on my ears and the display of my av-receiver.

testcases on different machines, but with the same sound-configuration: pure alsa with .asoundrc pointing to hdmi
pcm.!default {
	type hw
	card 0
	device 8
}
ctl.!default {
	type hw           
	card 0
	device 8
}
Comment 6 Vincent Penquerc'h 2014-06-04 11:13:41 UTC
Created attachment 277864 [details] [review]
set the channel positions using the appropriate API

If you can build gstreamer, can you test this patch and see if channels are played in the right speakers ?
Comment 7 Vincent Penquerc'h 2014-06-05 14:31:48 UTC
Or if you don't know or can't build, let us know, please.
Comment 8 Sebastian Dröge (slomo) 2014-06-06 10:25:58 UTC
Comment on attachment 277864 [details] [review]
set the channel positions using the appropriate API

Looks good to me, should also check the other audio decoders for the same mistake. Will you do that Vincent?

Not sure if we shouldn't reorder the channels to valid order before set_format() though...
Comment 9 Vincent Penquerc'h 2014-06-06 10:34:03 UTC
I can go double check, yes.
Comment 10 Vincent Penquerc'h 2014-06-06 10:48:08 UTC
faad and dvdlpcm set channel positions manually after passing NULL, but both do unset the unpositioned flag where appropriate.
I'll make patches for those to pass channel positions directly.
Comment 11 Vincent Penquerc'h 2014-06-06 13:10:18 UTC
Created attachment 278025 [details] [review]
similar for faad
Comment 12 Vincent Penquerc'h 2014-06-06 13:10:47 UTC
Created attachment 278026 [details] [review]
similar for dvdlpcmdec
Comment 13 Vincent Penquerc'h 2014-06-06 13:13:22 UTC
Testing the faad one, I had to set call gst_audio_channel_positions_to_valid_order before setting, as the order was not valid on my sample. flacdec and dvdlpcmdec use const tables, so I think they're already in the correct order. I don't have a sample to test dvdlpcmdec.

I also have only stereo output. Do we assume the original bug is fixed by this, without hearing the result ?
Comment 14 Sebastian Dröge (slomo) 2014-06-06 13:23:05 UTC
The "valid" order is the GStreamer order, which might be different from the FLAC or DVD LPCM order. So better reorder before in all cases :)
Comment 15 Sebastian Dröge (slomo) 2014-06-06 13:24:24 UTC
Comment on attachment 278025 [details] [review]
similar for faad

And here you reorder first but don't keep the original order around... which we will need a few lines later to generate the reorder map
Comment 16 Vincent Penquerc'h 2014-06-06 13:26:08 UTC
Is here a reason why this reordering could not be done in gst_audio_info_set_format ?
Comment 17 Sebastian Dröge (slomo) 2014-06-06 13:28:27 UTC
Yes, making sure that the order is not magically transformed to GStreamer order under the hood and then people are confused that they hear the left channel on the right side :)
Comment 18 Vincent Penquerc'h 2014-06-06 13:30:33 UTC
Ah, so the mapping isn't automatic. Fair enough.
Comment 19 Vincent Penquerc'h 2014-06-09 14:18:53 UTC
Created attachment 278137 [details] [review]
flacparse: set ordered chanel positions
Comment 20 Vincent Penquerc'h 2014-06-09 14:19:31 UTC
Created attachment 278138 [details] [review]
faad: set ordered chanel positions
Comment 21 Vincent Penquerc'h 2014-06-09 14:20:09 UTC
Created attachment 278139 [details] [review]
dvdlpcmdec: set ordered chanel positions
Comment 22 Vincent Penquerc'h 2014-06-09 14:21:49 UTC
This code is confusing me a bit, but I think this is correct. The FLAC sample plays fine (at least when mapped to stereo). 6 channel AAC plays fine though I've no idea if the channels are in the right place, and I have no dvdlpcm sample.
Comment 23 Vincent Penquerc'h 2014-11-12 14:26:20 UTC
commit 0b36fe59e1725ffa2905b3aac5f424b1299791c6
Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Date:   Wed Jun 4 12:11:10 2014 +0100

    flacdec: set the channel positions using the appropriate API
    
    This avoids _set_format setting the unpositioned flag when passed
    NULL as channel positions, as it would not be cleared when setting
    actual channel positions later.

commit cf9c73367d65887c573a803ec5817082758637f7
Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Date:   Fri Jun 6 13:57:30 2014 +0100

    faad: set channel positions using the appropriate API
    
    https://bugzilla.gnome.org/show_bug.cgi?id=731038

commit 86562f56e208d0d7360a9b5f7bc5cf13836f06a3
Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Date:   Fri Jun 6 13:59:57 2014 +0100

    dvdlpcmdec: set channel positions using the appropriate API
    
    https://bugzilla.gnome.org/show_bug.cgi?id=731038


I'll pick -good to file this bug since it spans -good, -bad, and -ugly.