webrtc rtptransceiver: Implement "current-direction" property
authorOlivier Crête <olivier.crete@collabora.com>
Wed, 21 Apr 2021 19:34:07 +0000 (15:34 -0400)
committerOlivier Crête <olivier.crete@collabora.com>
Thu, 13 May 2021 19:05:00 +0000 (15:05 -0400)
Implement the property as read-only to follow the WebRTC spec

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2183>

gst-libs/gst/webrtc/rtptransceiver.c

index 7cd2132..98d7ce8 100644 (file)
@@ -56,6 +56,7 @@ enum
   PROP_DIRECTION,
   PROP_MLINE,
   PROP_MID,
+  PROP_CURRENT_DIRECTION,
   PROP_STOPPED,                 // FIXME
 };
 
@@ -108,6 +109,9 @@ gst_webrtc_rtp_transceiver_get_property (GObject * object, guint prop_id,
     case PROP_DIRECTION:
       g_value_set_enum (value, webrtc->direction);
       break;
+    case PROP_CURRENT_DIRECTION:
+      g_value_set_enum (value, webrtc->current_direction);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -225,6 +229,24 @@ gst_webrtc_rtp_transceiver_class_init (GstWebRTCRTPTransceiverClass * klass)
           " m-line is rejected by either a remote offer or any answer.",
           NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
 
+  /**
+   * GstWebRTCRTPTransceiver:current-direction:
+   *
+   * The transceiver's current directionality, or none if the
+   * transceiver is stopped or has never participated in an exchange
+   * of offers and answers. To change the transceiver's
+   * directionality, set the value of the direction property.
+   *
+   * Since: 1.20
+   **/
+  g_object_class_install_property (gobject_class,
+      PROP_DIRECTION,
+      g_param_spec_enum ("current-direction", "Current Direction",
+          "Transceiver current direction",
+          GST_TYPE_WEBRTC_RTP_TRANSCEIVER_DIRECTION,
+          GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE,
+          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
 }
 
 static void