mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +00:00
rtptransceiver: Remove direction setter and vfunc and replace it by a property
It was changed from a function to a property in the latest WebRTC spec.
This commit is contained in:
parent
ef81c9d6c4
commit
28b0be4036
5 changed files with 29 additions and 40 deletions
|
@ -102,12 +102,6 @@ webrtc_transceiver_get_rtcp_dtls_transport (GstWebRTCRTPTransceiver * trans)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
webrtc_transceiver_set_direction (GstWebRTCRTPTransceiver * trans,
|
|
||||||
GstWebRTCRTPTransceiverDirection direction)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
webrtc_transceiver_set_property (GObject * object, guint prop_id,
|
webrtc_transceiver_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec)
|
const GValue * value, GParamSpec * pspec)
|
||||||
|
@ -185,16 +179,12 @@ webrtc_transceiver_finalize (GObject * object)
|
||||||
static void
|
static void
|
||||||
webrtc_transceiver_class_init (WebRTCTransceiverClass * klass)
|
webrtc_transceiver_class_init (WebRTCTransceiverClass * klass)
|
||||||
{
|
{
|
||||||
GstWebRTCRTPTransceiverClass *trans_class =
|
|
||||||
(GstWebRTCRTPTransceiverClass *) klass;
|
|
||||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
GObjectClass *gobject_class = (GObjectClass *) klass;
|
||||||
|
|
||||||
gobject_class->get_property = webrtc_transceiver_get_property;
|
gobject_class->get_property = webrtc_transceiver_get_property;
|
||||||
gobject_class->set_property = webrtc_transceiver_set_property;
|
gobject_class->set_property = webrtc_transceiver_set_property;
|
||||||
gobject_class->finalize = webrtc_transceiver_finalize;
|
gobject_class->finalize = webrtc_transceiver_finalize;
|
||||||
|
|
||||||
trans_class->set_direction = webrtc_transceiver_set_direction;
|
|
||||||
|
|
||||||
/* some acrobatics are required to set the parent before _constructed()
|
/* some acrobatics are required to set the parent before _constructed()
|
||||||
* has been called */
|
* has been called */
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
|
|
|
@ -54,29 +54,13 @@ enum
|
||||||
PROP_MID,
|
PROP_MID,
|
||||||
PROP_SENDER,
|
PROP_SENDER,
|
||||||
PROP_RECEIVER,
|
PROP_RECEIVER,
|
||||||
PROP_STOPPED, // FIXME
|
PROP_DIRECTION,
|
||||||
PROP_DIRECTION, // FIXME
|
|
||||||
PROP_MLINE,
|
PROP_MLINE,
|
||||||
|
PROP_STOPPED, // FIXME
|
||||||
};
|
};
|
||||||
|
|
||||||
//static guint gst_webrtc_rtp_transceiver_signals[LAST_SIGNAL] = { 0 };
|
//static guint gst_webrtc_rtp_transceiver_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
void
|
|
||||||
gst_webrtc_rtp_transceiver_set_direction (GstWebRTCRTPTransceiver * trans,
|
|
||||||
GstWebRTCRTPTransceiverDirection direction)
|
|
||||||
{
|
|
||||||
GstWebRTCRTPTransceiverClass *trans_class;
|
|
||||||
|
|
||||||
GST_OBJECT_LOCK (trans);
|
|
||||||
trans->direction = direction;
|
|
||||||
|
|
||||||
trans_class = GST_WEBRTC_RTP_TRANSCEIVER_GET_CLASS (trans);
|
|
||||||
|
|
||||||
g_assert (trans_class->set_direction);
|
|
||||||
trans_class->set_direction (trans, direction);
|
|
||||||
GST_OBJECT_UNLOCK (trans);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_webrtc_rtp_transceiver_set_property (GObject * object, guint prop_id,
|
gst_webrtc_rtp_transceiver_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec)
|
const GValue * value, GParamSpec * pspec)
|
||||||
|
@ -93,6 +77,9 @@ gst_webrtc_rtp_transceiver_set_property (GObject * object, guint prop_id,
|
||||||
case PROP_MLINE:
|
case PROP_MLINE:
|
||||||
webrtc->mline = g_value_get_uint (value);
|
webrtc->mline = g_value_get_uint (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_DIRECTION:
|
||||||
|
webrtc->direction = g_value_get_enum (value);
|
||||||
|
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;
|
||||||
|
@ -115,6 +102,9 @@ gst_webrtc_rtp_transceiver_get_property (GObject * object, guint prop_id,
|
||||||
case PROP_MLINE:
|
case PROP_MLINE:
|
||||||
g_value_set_uint (value, webrtc->mline);
|
g_value_set_uint (value, webrtc->mline);
|
||||||
break;
|
break;
|
||||||
|
case PROP_DIRECTION:
|
||||||
|
g_value_set_enum (value, webrtc->direction);
|
||||||
|
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;
|
||||||
|
@ -194,9 +184,25 @@ gst_webrtc_rtp_transceiver_class_init (GstWebRTCRTPTransceiverClass * klass)
|
||||||
"Index in the SDP of the Media",
|
"Index in the SDP of the Media",
|
||||||
0, G_MAXUINT, 0,
|
0, G_MAXUINT, 0,
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstWebRTCRTPTransceiver:direction:
|
||||||
|
*
|
||||||
|
* Direction of the transceiver.
|
||||||
|
*
|
||||||
|
* Since: 1.18
|
||||||
|
**/
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_DIRECTION,
|
||||||
|
g_param_spec_enum ("direction", "Direction",
|
||||||
|
"Transceiver direction",
|
||||||
|
GST_TYPE_WEBRTC_RTP_TRANSCEIVER_DIRECTION,
|
||||||
|
GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_webrtc_rtp_transceiver_init (GstWebRTCRTPTransceiver * webrtc)
|
gst_webrtc_rtp_transceiver_init (GstWebRTCRTPTransceiver * webrtc)
|
||||||
{
|
{
|
||||||
|
webrtc->direction = GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,19 +61,12 @@ struct _GstWebRTCRTPTransceiverClass
|
||||||
{
|
{
|
||||||
GstObjectClass parent_class;
|
GstObjectClass parent_class;
|
||||||
|
|
||||||
void (*set_direction) (GstWebRTCRTPTransceiver * trans,
|
|
||||||
GstWebRTCRTPTransceiverDirection direction);
|
|
||||||
|
|
||||||
/* FIXME; reset */
|
/* FIXME; reset */
|
||||||
gpointer _padding[GST_PADDING-1];
|
gpointer _padding[GST_PADDING];
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstWebRTCRTPTransceiver, gst_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstWebRTCRTPTransceiver, gst_object_unref)
|
||||||
|
|
||||||
GST_WEBRTC_API
|
|
||||||
void gst_webrtc_rtp_transceiver_set_direction (GstWebRTCRTPTransceiver * trans,
|
|
||||||
GstWebRTCRTPTransceiverDirection direction);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_WEBRTC_RTP_TRANSCEIVER_H__ */
|
#endif /* __GST_WEBRTC_RTP_TRANSCEIVER_H__ */
|
||||||
|
|
|
@ -2716,8 +2716,8 @@ GST_START_TEST (test_renego_transceiver_set_direction)
|
||||||
pad = gst_element_get_static_pad (t->webrtc1, "sink_0");
|
pad = gst_element_get_static_pad (t->webrtc1, "sink_0");
|
||||||
g_object_get (pad, "transceiver", &transceiver, NULL);
|
g_object_get (pad, "transceiver", &transceiver, NULL);
|
||||||
fail_unless (transceiver != NULL);
|
fail_unless (transceiver != NULL);
|
||||||
gst_webrtc_rtp_transceiver_set_direction (transceiver,
|
g_object_set (transceiver, "direction",
|
||||||
GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_INACTIVE);
|
GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_INACTIVE, NULL);
|
||||||
expected_offer[0] = "inactive";
|
expected_offer[0] = "inactive";
|
||||||
expected_answer[0] = "inactive";
|
expected_answer[0] = "inactive";
|
||||||
|
|
||||||
|
|
|
@ -221,8 +221,8 @@ stream_change (gpointer data)
|
||||||
gst_element_send_event (extra_src, gst_event_new_eos ());
|
gst_element_send_event (extra_src, gst_event_new_eos ());
|
||||||
|
|
||||||
g_object_get (peer, "transceiver", &transceiver, NULL);
|
g_object_get (peer, "transceiver", &transceiver, NULL);
|
||||||
gst_webrtc_rtp_transceiver_set_direction (transceiver,
|
g_object_set (transceiver, "direction",
|
||||||
GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_INACTIVE);
|
GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_INACTIVE, NULL);
|
||||||
|
|
||||||
gst_element_set_locked_state (extra_src, TRUE);
|
gst_element_set_locked_state (extra_src, TRUE);
|
||||||
gst_element_set_state (extra_src, GST_STATE_NULL);
|
gst_element_set_state (extra_src, GST_STATE_NULL);
|
||||||
|
|
Loading…
Reference in a new issue