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 767226 - audioconvert: Preserve channels when we only need to reposition
audioconvert: Preserve channels when we only need to reposition
Status: RESOLVED DUPLICATE of bug 706884
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
unspecified
Other All
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-06-04 00:09 UTC by Thibault Saunier
Modified: 2016-06-17 09:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
audioconvert: Preserver channels when we only need to reposition (1.18 KB, patch)
2016-06-04 00:09 UTC, Thibault Saunier
none Details | Review
audioconvert: Preserve channels when we only need to reposition (1.18 KB, patch)
2016-06-04 00:10 UTC, Thibault Saunier
rejected Details | Review
tests:audioconvert: add test for number of channels negotiation (2.90 KB, patch)
2016-06-14 14:01 UTC, Thibault Saunier
none Details | Review

Description Thibault Saunier 2016-06-04 00:09:21 UTC
Pipeline such as:

   gst-launch-1.0 http://media.xiph.org/BBB/bbb3d/audio/bbb3d_sunflower_soundtrack_surround.ac3 ! ac3parse ! avdec_ac3 ! audioconvert ! opusenc ! fakesink -v

are downscaling to 1 channel because the channel-mask between the ac3 file content
and what opusenc support do not match, we can convert it so let's just do so.
Comment 1 Thibault Saunier 2016-06-04 00:09:26 UTC
Created attachment 329103 [details] [review]
audioconvert: Preserver channels when we only need to reposition

GstAudioConveter is able to reposition channels so we should make
sure that we try to keep all the channels and never fail only
because of channel positions mismatch.
Comment 2 Thibault Saunier 2016-06-04 00:10:02 UTC
Created attachment 329104 [details] [review]
audioconvert: Preserve channels when we only need to reposition

GstAudioConveter is able to reposition channels so we should make
sure that we try to keep all the channels and never fail only
because of channel positions mismatch.
Comment 3 Thibault Saunier 2016-06-04 00:13:13 UTC
(pitivi bug: https://phabricator.freedesktop.org/T7414)
Comment 4 Tim-Philipp Müller 2016-06-04 11:04:23 UTC
Unit test would be nice! :)
Comment 5 Sebastian Dröge (slomo) 2016-06-06 08:04:16 UTC
Review of attachment 329104 [details] [review]:

::: gst/audioconvert/gstaudioconvert.c
@@ +271,3 @@
+
+    /* We are able to do channel positioning conversion */
+    gst_structure_remove_fields (st, "channel-mask", NULL);

Except that we are not: bug #666506

This needs to be more fine-grained for the positions that we can actually convert.
Comment 6 Thibault Saunier 2016-06-06 12:42:57 UTC
Hrm, ok I do not understand that other bug then because while negotiating it does not claim it handle channel positioning conversion at all.

I will have a look and add a unit test.
Comment 7 Sebastian Dröge (slomo) 2016-06-06 12:55:18 UTC
The problem is that we can convert just fine only if:
1) All channels from the input are also in the output (your case I guess?), i.e. we only need to reorder but not mix
2) All channels are in positions where we support mixing (the first 8 positions or so)

Otherwise it will fail with great effect :)


Currently the caps negotiation does not consider that at all.
Comment 8 Thibault Saunier 2016-06-06 13:16:06 UTC
> 1) All channels from the input are also in the output (your case I guess?), i.e. we only need to reorder but not mix

yeah, this is my case, so I will just force output to have the same number of channels, and that works in that case. I will still try to look at #666506 later.
Comment 9 Sebastian Dröge (slomo) 2016-06-06 13:19:14 UTC
The same *number* of channels is not the same as the *same* channels :) We only handle the case where it's the same channels in a different order, or the case where it's only those channels we support mixing for.


I wouldn't worry too much about bug #666506, just let negotiation fail if it's neither of the two cases. That should be identifiable relatively easily with the mask.
Comment 10 Thibault Saunier 2016-06-06 13:22:31 UTC
(In reply to Sebastian Dröge (slomo) from comment #9)
> The same *number* of channels is not the same as the *same* channels :) We
> only handle the case where it's the same channels in a different order, or
> the case where it's only those channels we support mixing for.

Ah, got it, let's try to be smarter about that then.

> 2) All channels are in positions where we support mixing (the first 8 positions or so)

What does "the first 8 positions" mean in practice, up to 8 channels?
Comment 11 Sebastian Dröge (slomo) 2016-06-06 13:30:24 UTC
(In reply to Thibault Saunier from comment #10)

> > 2) All channels are in positions where we support mixing (the first 8 positions or so)
> 
> What does "the first 8 positions" mean in practice, up to 8 channels?

No, the 8 (or so) positions where we actually implement mixing. That's IIRC
- mono
- front left
- front right
- front center
- rear left
- rear right
- rear center
- side left
- side right

But better check the code :)
Comment 12 Sebastian Dröge (slomo) 2016-06-06 13:56:51 UTC
Basically every layout that has at least one channel that is not one of the above will fail remixing
Comment 13 Sebastian Dröge (slomo) 2016-06-08 13:21:22 UTC
There was some confusion here. I think what we need first now is a patch to the audioconvert unit tests to show the problem :) This might be bug #706884


So for the confusion. There is exactly one valid *order* of channels in 1.x, if encoders/decoders/etc need something different we have API for conversion but that's internal to the elements. So this is not the problem here.

The problem here is, according to Thibault, that opusenc wants 0x3f as channel mask and the input is 0xc0f. The audioconvert between the input and opusenc however is converting to mono instead of the appropriate 6 channel layout. That might be bug #706884 but we don't know for sure yet, needs more debugging/info from Thibault :)


The other problem seems to be that audioconvert happily converts channel positions it does not actually know about. The 0xc00 part of the channel mask is IIRC not supported for conversion in audioconvert at all, as such negotiation should fail (for going to mono as well as going to 0x3f). Which is then related to bug #666506.
Comment 14 Thibault Saunier 2016-06-14 14:01:16 UTC
Created attachment 329797 [details] [review]
tests:audioconvert: add test for number of channels negotiation
Comment 15 Thibault Saunier 2016-06-14 14:03:03 UTC
The first test passes (as we have the same channel positions) but the second one fails as audioconvert negotiates only one channel on it srcpad, basically because it used only the first structure when fixating caps (bug #706884).
Comment 16 Sebastian Dröge (slomo) 2016-06-17 09:46:15 UTC
Thanks for taking the time to report this.
This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.

*** This bug has been marked as a duplicate of bug 706884 ***