From e76dce3c6e2d48aef9b3e69b7fcf9e9af68c1986 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Cr=C3=AAte?= Date: Thu, 23 Sep 2021 16:37:45 -0400 Subject: [PATCH] rtphdrext: Parse direction from the caps Part-of: --- .../gst-libs/gst/rtp/gstrtphdrext.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.c b/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.c index 39b75a2..948c8b9 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.c @@ -438,6 +438,26 @@ gst_rtp_header_extension_set_attributes_from_caps (GstRTPHeaderExtension * ext, && gst_value_array_get_size (val) == 3) { const GValue *inner_val; + inner_val = gst_value_array_get_value (val, 0); + if (G_VALUE_HOLDS_STRING (inner_val)) { + const gchar *dir = g_value_get_string (inner_val); + + if (!strcmp (dir, "")) + priv->direction = GST_RTP_HEADER_EXTENSION_DIRECTION_DEFAULT; + else if (!strcmp (dir, "sendrecv")) + priv->direction = GST_RTP_HEADER_EXTENSION_DIRECTION_SENDRECV; + else if (!strcmp (dir, "sendonly")) + priv->direction = GST_RTP_HEADER_EXTENSION_DIRECTION_SENDONLY; + else if (!strcmp (dir, "recvonly")) + priv->direction = GST_RTP_HEADER_EXTENSION_DIRECTION_RECVONLY; + else if (!strcmp (dir, "inactive")) + priv->direction = GST_RTP_HEADER_EXTENSION_DIRECTION_INACTIVE; + else + goto error; + } else { + goto error; + } + inner_val = gst_value_array_get_value (val, 1); if (!G_VALUE_HOLDS_STRING (inner_val)) goto error; @@ -665,7 +685,6 @@ gst_rtp_header_extension_set_caps_from_attributes_default (GstRTPHeaderExtension g_value_init (&arr, GST_TYPE_ARRAY); g_value_init (&val, G_TYPE_STRING); - if (priv->direction & GST_RTP_HEADER_EXTENSION_DIRECTION_INHERITED) { g_value_set_string (&val, ""); } else { -- 2.7.4