opus: Add proper support for multichannel audio

https://bugzilla.gnome.org/show_bug.cgi?id=757152
This commit is contained in:
Sebastian Dröge 2015-11-03 14:50:53 +02:00 committed by Tim-Philipp Müller
parent 0472d9f8b2
commit 01342378b5
2 changed files with 6 additions and 5 deletions

View file

@ -47,7 +47,7 @@ static GstStaticPadTemplate gst_rtp_opus_depay_src_template =
GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_SRC,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-opus, multistream = (boolean) FALSE") GST_STATIC_CAPS ("audio/x-opus, channel-mapping-family = (int) 0")
); );
static GstBuffer *gst_rtp_opus_depay_process (GstRTPBaseDepayload * depayload, static GstBuffer *gst_rtp_opus_depay_process (GstRTPBaseDepayload * depayload,
@ -98,8 +98,8 @@ gst_rtp_opus_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
const gchar *sprop_stereo, *sprop_maxcapturerate; const gchar *sprop_stereo, *sprop_maxcapturerate;
srccaps = srccaps =
gst_caps_new_simple ("audio/x-opus", "multistream", G_TYPE_BOOLEAN, FALSE, gst_caps_new_simple ("audio/x-opus", "channel-mapping-family", G_TYPE_INT,
NULL); 0, NULL);
s = gst_caps_get_structure (caps, 0); s = gst_caps_get_structure (caps, 0);
if ((sprop_stereo = gst_structure_get_string (s, "sprop-stereo"))) { if ((sprop_stereo = gst_structure_get_string (s, "sprop-stereo"))) {

View file

@ -38,7 +38,8 @@ static GstStaticPadTemplate gst_rtp_opus_pay_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK, GST_PAD_SINK,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-opus, multistream = (boolean) FALSE") GST_STATIC_CAPS
("audio/x-opus, channels = (int) [1, 2], channel-mapping-family = (int) 0")
); );
static GstStaticPadTemplate gst_rtp_opus_pay_src_template = static GstStaticPadTemplate gst_rtp_opus_pay_src_template =
@ -122,7 +123,7 @@ gst_rtp_opus_pay_setcaps (GstRTPBasePayload * payload, GstCaps * caps)
if (gst_structure_get_int (s, "channels", &channels)) { if (gst_structure_get_int (s, "channels", &channels)) {
if (channels > 2) { if (channels > 2) {
GST_ERROR_OBJECT (payload, GST_ERROR_OBJECT (payload,
"More than 2 channels with multistream=FALSE is invalid"); "More than 2 channels with channel-mapping-family=0 is invalid");
return FALSE; return FALSE;
} else if (channels == 2) { } else if (channels == 2) {
sprop_stereo = "1"; sprop_stereo = "1";