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 793763 - rtpopuspay does not honour 'stereo' prop
rtpopuspay does not honour 'stereo' prop
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.x
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-02-23 17:26 UTC by David Woodhouse
Modified: 2018-11-03 15:26 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description David Woodhouse 2018-02-23 17:26:11 UTC
GST_DEBUG=3 GST_DEBUG_DUMP_DOT_DIR=/tmp gst-launch-1.0 pulsesrc ! opusenc ! rtpopuspay ! "application/x-rtp,media=audio,encoding-name=OPUS,stereo=(string)1" ! filesink location=/dev/null

Look at resulting graph; the opusenc is actually taking 1-channel audio.


This makes it "work":

--- a/gst/rtp/gstrtpopuspay.c
+++ b/gst/rtp/gstrtpopuspay.c
@@ -254,14 +254,14 @@ gst_rtp_opus_pay_getcaps (GstRTPBasePayload * payload,
       GstCaps *caps2 = gst_caps_copy (caps);
 
       gst_caps_set_simple (caps, "channels", G_TYPE_INT, 2, NULL);
-      gst_caps_set_simple (caps2, "channels", G_TYPE_INT, 1, NULL);
-      caps = gst_caps_merge (caps, caps2);
+//      gst_caps_set_simple (caps2, "channels", G_TYPE_INT, 1, NULL);
+//      caps = gst_caps_merge (caps, caps2);
     } else if (!strcmp (stereo, "0")) {
       GstCaps *caps2 = gst_caps_copy (caps);
 
       gst_caps_set_simple (caps, "channels", G_TYPE_INT, 1, NULL);
-      gst_caps_set_simple (caps2, "channels", G_TYPE_INT, 2, NULL);
-      caps = gst_caps_merge (caps, caps2);
+//      gst_caps_set_simple (caps2, "channels", G_TYPE_INT, 2, NULL);
+//      caps = gst_caps_merge (caps, caps2);
     }
   }
   gst_caps_unref (peercaps);


However that isn't quite right because 'stereo=1' is supposed to be a *hint*. It's supposed to *allow* mono audio if it really has to, but I'd like it to make *some* attempt to do as it's asked. It looks like reordering the channels=[1,2] vs. channels=[2,1] options is expected to do that? It doesn't seem to work.

FWIW I saw this in a Farstream conference the other way round: I was setting 'stereo=0' and still actually getting stereo because the "hint" wasn't honoured.
Comment 1 Sebastian Dröge (slomo) 2018-02-25 11:22:29 UTC
This also needs some negotiation code where rtpopusdepay is currently setting the srcpad caps. it would have to check what downstream supports with regards to the number of channels and then select something appropriate.

If downstream supports mono and stereo, stereo should have preference if stereo=1.
Comment 2 David Woodhouse 2018-02-27 09:13:23 UTC
Note that following the discussion in bug 793765 it looks like I'm going to keep using my own special cut-and-paste of rtpopuspay for ever, so I can also just hard-code it to mono and my interest in this bug is somewhat diminished.

It should still be fixed though, ideally...
Comment 3 Tim-Philipp Müller 2018-02-27 13:49:56 UTC
Judging by the output of

GST_DEBUG=*pay*:6 gst-launch-1.0 audiotestsrc ! opusenc ! rtpopuspay ! 'application/x-rtp,media=audio,encoding-name=OPUS,stereo=(string)1' ! fakesink -v 2>&1 | grep gst_rtp_opus_pay_getcaps

vs.

GST_DEBUG=*pay*:6 gst-launch-1.0 audiotestsrc ! opusenc ! rtpopuspay ! 'application/x-rtp,media=audio,encoding-name=OPUS,stereo=(string)0' ! fakesink -v 2>&1 | grep gst_rtp_opus_pay_getcaps

if does do the right thing somewhere, that is it should return:

 audio/x-opus,channels=2; audio/x-opus,channels=1 for stereo=1

and

 audio/x-opus,channels=1; audio/x-opus,channels=2 for stereo=0


Unclear to me for now if there's more stuff needed in rtpopuspay or if it goes wrong somewhere upstream (e.g. opusenc).
Comment 4 GStreamer system administrator 2018-11-03 15:26:41 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-good/issues/444.