rtpopuspay does not honour 'stereo' prop
Submitted by David Woodhouse
Link to original bug (#793763)
Description
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.
Version: 1.x