2 * Copyright (C) 2017 Matthew Waters <matthew@centricular.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
21 * SECTION:gstwebrtc-sender
22 * @short_description: RTCRtpSender object
23 * @title: GstWebRTCRTPSender
24 * @see_also: #GstWebRTCRTPReceiver, #GstWebRTCRTPTransceiver
26 * - GstWebRTCRTPSender
28 * <https://www.w3.org/TR/webrtc/#rtcrtpsender-interface>
35 #include "rtpsender.h"
36 #include "rtptransceiver.h"
37 #include "webrtc-priv.h"
39 #define GST_CAT_DEFAULT gst_webrtc_rtp_sender_debug
40 GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
42 #define gst_webrtc_rtp_sender_parent_class parent_class
43 G_DEFINE_TYPE_WITH_CODE (GstWebRTCRTPSender, gst_webrtc_rtp_sender,
44 GST_TYPE_OBJECT, GST_DEBUG_CATEGORY_INIT (gst_webrtc_rtp_sender_debug,
45 "webrtcsender", 0, "webrtcsender");
61 //static guint gst_webrtc_rtp_sender_signals[LAST_SIGNAL] = { 0 };
64 * gst_webrtc_rtp_sender_set_priority:
65 * @sender: a #GstWebRTCRTPSender
66 * @priority: The priority of this sender
68 * Sets the content of the IPv4 Type of Service (ToS), also known as DSCP
69 * (Differentiated Services Code Point).
70 * This also sets the Traffic Class field of IPv6.
76 gst_webrtc_rtp_sender_set_priority (GstWebRTCRTPSender * sender,
77 GstWebRTCPriorityType priority)
79 GST_OBJECT_LOCK (sender);
80 sender->priority = priority;
81 GST_OBJECT_UNLOCK (sender);
82 g_object_notify (G_OBJECT (sender), "priority");
86 gst_webrtc_rtp_sender_set_property (GObject * object, guint prop_id,
87 const GValue * value, GParamSpec * pspec)
89 GstWebRTCRTPSender *sender = GST_WEBRTC_RTP_SENDER (object);
93 gst_webrtc_rtp_sender_set_priority (sender, g_value_get_uint (value));
96 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
102 gst_webrtc_rtp_sender_get_property (GObject * object, guint prop_id,
103 GValue * value, GParamSpec * pspec)
105 GstWebRTCRTPSender *sender = GST_WEBRTC_RTP_SENDER (object);
109 GST_OBJECT_LOCK (sender);
110 g_value_set_uint (value, sender->priority);
111 GST_OBJECT_UNLOCK (sender);
114 GST_OBJECT_LOCK (sender);
115 g_value_set_object (value, sender->transport);
116 GST_OBJECT_UNLOCK (sender);
119 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
125 gst_webrtc_rtp_sender_finalize (GObject * object)
127 GstWebRTCRTPSender *sender = GST_WEBRTC_RTP_SENDER (object);
129 if (sender->transport)
130 gst_object_unref (sender->transport);
131 sender->transport = NULL;
133 G_OBJECT_CLASS (parent_class)->finalize (object);
137 gst_webrtc_rtp_sender_class_init (GstWebRTCRTPSenderClass * klass)
139 GObjectClass *gobject_class = (GObjectClass *) klass;
141 gobject_class->get_property = gst_webrtc_rtp_sender_get_property;
142 gobject_class->set_property = gst_webrtc_rtp_sender_set_property;
143 gobject_class->finalize = gst_webrtc_rtp_sender_finalize;
146 * GstWebRTCRTPSender:priority:
148 * The priority from which to set the DSCP field on packets
152 g_object_class_install_property (gobject_class,
154 g_param_spec_enum ("priority",
156 "The priority from which to set the DSCP field on packets",
157 GST_TYPE_WEBRTC_PRIORITY_TYPE, GST_WEBRTC_PRIORITY_TYPE_LOW,
158 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
161 * GstWebRTCRTPSender:transport:
163 * The DTLS transport for this sender
167 g_object_class_install_property (gobject_class,
169 g_param_spec_object ("transport", "Transport",
170 "The DTLS transport for this sender",
171 GST_TYPE_WEBRTC_DTLS_TRANSPORT,
172 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
176 gst_webrtc_rtp_sender_init (GstWebRTCRTPSender * webrtc)
181 gst_webrtc_rtp_sender_new (void)
183 return g_object_new (GST_TYPE_WEBRTC_RTP_SENDER, NULL);