mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
rtpsender: Add API to set the priority
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1707>
This commit is contained in:
parent
0fbbdc5734
commit
cca313ecd8
2 changed files with 68 additions and 12 deletions
|
@ -51,10 +51,7 @@ enum
|
|||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_MID,
|
||||
PROP_SENDER,
|
||||
PROP_STOPPED,
|
||||
PROP_DIRECTION,
|
||||
PROP_PRIORITY
|
||||
};
|
||||
|
||||
//static guint gst_webrtc_rtp_sender_signals[LAST_SIGNAL] = { 0 };
|
||||
|
@ -85,11 +82,38 @@ gst_webrtc_rtp_sender_set_rtcp_transport (GstWebRTCRTPSender * sender,
|
|||
GST_OBJECT_UNLOCK (sender);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_webrtc_rtp_sender_set_priority:
|
||||
* @sender: a #GstWebRTCRTPSender
|
||||
* @priority: The priority of this sender
|
||||
*
|
||||
* Sets the content of the IPv4 Type of Service (ToS), also known as DSCP
|
||||
* (Differentiated Services Code Point).
|
||||
* This also sets the Traffic Class field of IPv6.
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
|
||||
void
|
||||
gst_webrtc_rtp_sender_set_priority (GstWebRTCRTPSender * sender,
|
||||
GstWebRTCPriorityType priority)
|
||||
{
|
||||
GST_OBJECT_LOCK (sender);
|
||||
sender->priority = priority;
|
||||
GST_OBJECT_UNLOCK (sender);
|
||||
g_object_notify (G_OBJECT (sender), "priority");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_webrtc_rtp_sender_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstWebRTCRTPSender *sender = GST_WEBRTC_RTP_SENDER (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_PRIORITY:
|
||||
gst_webrtc_rtp_sender_set_priority (sender, g_value_get_uint (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -100,7 +124,14 @@ static void
|
|||
gst_webrtc_rtp_sender_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstWebRTCRTPSender *sender = GST_WEBRTC_RTP_SENDER (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_PRIORITY:
|
||||
GST_OBJECT_LOCK (sender);
|
||||
g_value_set_uint (value, sender->priority);
|
||||
GST_OBJECT_UNLOCK (sender);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -110,15 +141,15 @@ gst_webrtc_rtp_sender_get_property (GObject * object, guint prop_id,
|
|||
static void
|
||||
gst_webrtc_rtp_sender_finalize (GObject * object)
|
||||
{
|
||||
GstWebRTCRTPSender *webrtc = GST_WEBRTC_RTP_SENDER (object);
|
||||
GstWebRTCRTPSender *sender = GST_WEBRTC_RTP_SENDER (object);
|
||||
|
||||
if (webrtc->transport)
|
||||
gst_object_unref (webrtc->transport);
|
||||
webrtc->transport = NULL;
|
||||
if (sender->transport)
|
||||
gst_object_unref (sender->transport);
|
||||
sender->transport = NULL;
|
||||
|
||||
if (webrtc->rtcp_transport)
|
||||
gst_object_unref (webrtc->rtcp_transport);
|
||||
webrtc->rtcp_transport = NULL;
|
||||
if (sender->rtcp_transport)
|
||||
gst_object_unref (sender->rtcp_transport);
|
||||
sender->rtcp_transport = NULL;
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -131,6 +162,21 @@ gst_webrtc_rtp_sender_class_init (GstWebRTCRTPSenderClass * klass)
|
|||
gobject_class->get_property = gst_webrtc_rtp_sender_get_property;
|
||||
gobject_class->set_property = gst_webrtc_rtp_sender_set_property;
|
||||
gobject_class->finalize = gst_webrtc_rtp_sender_finalize;
|
||||
|
||||
/**
|
||||
* GstWebRTCRTPSender:priority:
|
||||
*
|
||||
* The priority from which to set the DSCP field on packets
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_PRIORITY,
|
||||
g_param_spec_enum ("priority",
|
||||
"Priority",
|
||||
"The priority from which to set the DSCP field on packets",
|
||||
GST_TYPE_WEBRTC_PRIORITY_TYPE, GST_WEBRTC_PRIORITY_TYPE_LOW,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -48,6 +48,13 @@ GType gst_webrtc_rtp_sender_get_type(void);
|
|||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
/**
|
||||
* GstWebRTCRTPSender.priority:
|
||||
*
|
||||
* The priority of the stream
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
struct _GstWebRTCRTPSender
|
||||
{
|
||||
GstObject parent;
|
||||
|
@ -57,6 +64,7 @@ struct _GstWebRTCRTPSender
|
|||
GstWebRTCDTLSTransport *rtcp_transport;
|
||||
|
||||
GArray *send_encodings;
|
||||
GstWebRTCPriorityType priority;
|
||||
|
||||
gpointer _padding[GST_PADDING];
|
||||
};
|
||||
|
@ -77,7 +85,9 @@ void gst_webrtc_rtp_sender_set_transport (GstWebR
|
|||
GST_WEBRTC_API
|
||||
void gst_webrtc_rtp_sender_set_rtcp_transport (GstWebRTCRTPSender * sender,
|
||||
GstWebRTCDTLSTransport * transport);
|
||||
|
||||
GST_WEBRTC_API
|
||||
void gst_webrtc_rtp_sender_set_priority (GstWebRTCRTPSender *sender,
|
||||
GstWebRTCPriorityType priority);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstWebRTCRTPSender, gst_object_unref)
|
||||
|
||||
|
|
Loading…
Reference in a new issue