webrtc rtptransceiver: Implement "current-direction" property

Implement the property as read-only to follow the WebRTC spec

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2183>
This commit is contained in:
Olivier Crête 2021-04-21 15:34:07 -04:00
parent 7e7678f4cb
commit 5fd0ee3227

View 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