webrtc: expose transport property on sender and receiver

As advised by !1366#note_629558 , the nice transport should be
accessed through:

> transceiver->sender/receiver->transport/rtcp_transport->icetransport

All the objects on the path can be accessed through properties
except sender/receiver->transport. This patch addresses that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1952>
This commit is contained in:
Mathieu Duponchelle 2021-01-12 19:12:42 +01:00 committed by GStreamer Merge Bot
parent 0f7af4b143
commit 86c009e7aa
3 changed files with 49 additions and 3 deletions

View file

@ -59,12 +59,17 @@ webrtc_transceiver_set_transport (WebRTCTransceiver * trans,
gst_object_replace ((GstObject **) & trans->stream, (GstObject *) stream); gst_object_replace ((GstObject **) & trans->stream, (GstObject *) stream);
if (rtp_trans->sender) if (rtp_trans->sender) {
gst_object_replace ((GstObject **) & rtp_trans->sender->transport, gst_object_replace ((GstObject **) & rtp_trans->sender->transport,
(GstObject *) stream->transport); (GstObject *) stream->transport);
if (rtp_trans->receiver) g_object_notify (G_OBJECT (rtp_trans->sender), "transport");
}
if (rtp_trans->receiver) {
gst_object_replace ((GstObject **) & rtp_trans->receiver->transport, gst_object_replace ((GstObject **) & rtp_trans->receiver->transport,
(GstObject *) stream->transport); (GstObject *) stream->transport);
g_object_notify (G_OBJECT (rtp_trans->receiver), "transport");
}
} }
GstWebRTCDTLSTransport * GstWebRTCDTLSTransport *

View file

@ -49,6 +49,7 @@ enum
enum enum
{ {
PROP_0, PROP_0,
PROP_TRANSPORT,
}; };
//static guint gst_webrtc_rtp_receiver_signals[LAST_SIGNAL] = { 0 }; //static guint gst_webrtc_rtp_receiver_signals[LAST_SIGNAL] = { 0 };
@ -68,7 +69,13 @@ static void
gst_webrtc_rtp_receiver_get_property (GObject * object, guint prop_id, gst_webrtc_rtp_receiver_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec) GValue * value, GParamSpec * pspec)
{ {
GstWebRTCRTPReceiver *receiver = GST_WEBRTC_RTP_RECEIVER (object);
switch (prop_id) { switch (prop_id) {
case PROP_TRANSPORT:
GST_OBJECT_LOCK (receiver);
g_value_set_object (value, receiver->transport);
GST_OBJECT_UNLOCK (receiver);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -95,6 +102,20 @@ gst_webrtc_rtp_receiver_class_init (GstWebRTCRTPReceiverClass * klass)
gobject_class->get_property = gst_webrtc_rtp_receiver_get_property; gobject_class->get_property = gst_webrtc_rtp_receiver_get_property;
gobject_class->set_property = gst_webrtc_rtp_receiver_set_property; gobject_class->set_property = gst_webrtc_rtp_receiver_set_property;
gobject_class->finalize = gst_webrtc_rtp_receiver_finalize; gobject_class->finalize = gst_webrtc_rtp_receiver_finalize;
/**
* GstWebRTCRTPReceiver:transport:
*
* The DTLS transport for this receiver
*
* Since: 1.20
*/
g_object_class_install_property (gobject_class,
PROP_TRANSPORT,
g_param_spec_object ("transport", "Transport",
"The DTLS transport for this receiver",
GST_TYPE_WEBRTC_DTLS_TRANSPORT,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
} }
static void static void

View file

@ -51,7 +51,8 @@ enum
enum enum
{ {
PROP_0, PROP_0,
PROP_PRIORITY PROP_PRIORITY,
PROP_TRANSPORT,
}; };
//static guint gst_webrtc_rtp_sender_signals[LAST_SIGNAL] = { 0 }; //static guint gst_webrtc_rtp_sender_signals[LAST_SIGNAL] = { 0 };
@ -106,6 +107,11 @@ gst_webrtc_rtp_sender_get_property (GObject * object, guint prop_id,
g_value_set_uint (value, sender->priority); g_value_set_uint (value, sender->priority);
GST_OBJECT_UNLOCK (sender); GST_OBJECT_UNLOCK (sender);
break; break;
case PROP_TRANSPORT:
GST_OBJECT_LOCK (sender);
g_value_set_object (value, sender->transport);
GST_OBJECT_UNLOCK (sender);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -147,6 +153,20 @@ gst_webrtc_rtp_sender_class_init (GstWebRTCRTPSenderClass * klass)
"The priority from which to set the DSCP field on packets", "The priority from which to set the DSCP field on packets",
GST_TYPE_WEBRTC_PRIORITY_TYPE, GST_WEBRTC_PRIORITY_TYPE_LOW, GST_TYPE_WEBRTC_PRIORITY_TYPE, GST_WEBRTC_PRIORITY_TYPE_LOW,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstWebRTCRTPSender:transport:
*
* The DTLS transport for this sender
*
* Since: 1.20
*/
g_object_class_install_property (gobject_class,
PROP_TRANSPORT,
g_param_spec_object ("transport", "Transport",
"The DTLS transport for this sender",
GST_TYPE_WEBRTC_DTLS_TRANSPORT,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
} }
static void static void