}
static void
+rtp_conflicting_address_free (RTPConflictingAddress * addr)
+{
+ g_object_unref (addr->address);
+ g_free (addr);
+}
+
+static void
rtp_source_finalize (GObject * object)
{
RTPSource *src;
gst_caps_replace (&src->caps, NULL);
- g_list_foreach (src->conflicting_addresses, (GFunc) g_free, NULL);
+ g_list_foreach (src->conflicting_addresses,
+ (GFunc) rtp_conflicting_address_free, NULL);
g_list_free (src->conflicting_addresses);
while ((buffer = g_queue_pop_head (src->retained_feedback)))
gst_buffer_unref (buffer);
g_queue_free (src->retained_feedback);
+ if (src->rtp_from)
+ g_object_unref (src->rtp_from);
+ if (src->rtcp_from)
+ g_object_unref (src->rtcp_from);
+
G_OBJECT_CLASS (rtp_source_parent_class)->finalize (object);
}
GstStructure *s;
gboolean is_sender = src->is_sender;
gboolean internal = src->internal;
- gchar address_str[GST_NETADDRESS_MAX_LEN];
+ gchar *address_str;
gboolean have_rb;
guint8 fractionlost = 0;
gint32 packetslost = 0;
"clock-rate", G_TYPE_INT, src->clock_rate, NULL);
/* add address and port */
- if (src->have_rtp_from) {
- gst_net_address_to_string (&src->rtp_from, address_str,
- sizeof (address_str));
+ if (src->rtp_from) {
+ address_str = __g_socket_address_to_string (src->rtp_from);
gst_structure_set (s, "rtp-from", G_TYPE_STRING, address_str, NULL);
+ g_free (address_str);
}
- if (src->have_rtcp_from) {
- gst_net_address_to_string (&src->rtcp_from, address_str,
- sizeof (address_str));
+ if (src->rtcp_from) {
+ address_str = __g_socket_address_to_string (src->rtcp_from);
gst_structure_set (s, "rtcp-from", G_TYPE_STRING, address_str, NULL);
+ g_free (address_str);
}
gst_structure_set (s,
* collistion checking.
*/
void
-rtp_source_set_rtp_from (RTPSource * src, GstNetAddress * address)
+rtp_source_set_rtp_from (RTPSource * src, GSocketAddress * address)
{
g_return_if_fail (RTP_IS_SOURCE (src));
- src->have_rtp_from = TRUE;
- memcpy (&src->rtp_from, address, sizeof (GstNetAddress));
+ if (src->rtp_from)
+ g_object_unref (src->rtp_from);
+ src->rtp_from = G_SOCKET_ADDRESS (g_object_ref (address));
}
/**
* collistion checking.
*/
void
-rtp_source_set_rtcp_from (RTPSource * src, GstNetAddress * address)
+rtp_source_set_rtcp_from (RTPSource * src, GSocketAddress * address)
{
g_return_if_fail (RTP_IS_SOURCE (src));
- src->have_rtcp_from = TRUE;
- memcpy (&src->rtcp_from, address, sizeof (GstNetAddress));
+ if (src->rtcp_from)
+ g_object_unref (src->rtcp_from);
+ src->rtcp_from = G_SOCKET_ADDRESS (g_object_ref (address));
}
static GstFlowReturn
gint32 diff;
gint clock_rate;
guint8 pt;
- GstRTPBuffer rtp;
+ GstRTPBuffer rtp = { NULL };
/* get arrival time */
if ((running_time = arrival->running_time) == GST_CLOCK_TIME_NONE)
guint16 seqnr, udelta;
RTPSourceStats *stats;
guint16 expected;
- GstRTPBuffer rtp;
+ GstRTPBuffer rtp = { NULL };
g_return_val_if_fail (RTP_IS_SOURCE (src), GST_FLOW_ERROR);
g_return_val_if_fail (GST_IS_BUFFER (buffer), GST_FLOW_ERROR);
seqnr = gst_rtp_buffer_get_seq (&rtp);
gst_rtp_buffer_unmap (&rtp);
- /* FIXME-0.11
- * would be nice to be able to pass along with buffer */
- g_assert_not_reached ();
- /* rtp_source_update_caps (src, GST_BUFFER_CAPS (buffer)); */
-
if (stats->cycles == -1) {
GST_DEBUG ("received first buffer");
/* first time we heard of this source */
static gboolean
set_ssrc (GstBuffer ** buffer, guint idx, RTPSource * src)
{
- GstRTPBuffer rtp;
+ GstRTPBuffer rtp = { NULL };
*buffer = gst_buffer_make_writable (*buffer);
gst_rtp_buffer_map (*buffer, GST_MAP_WRITE, &rtp);
GstBuffer *buffer = NULL;
guint packets;
guint32 ssrc;
- GstRTPBuffer rtp;
+ GstRTPBuffer rtp = { NULL };
g_return_val_if_fail (RTP_IS_SOURCE (src), GST_FLOW_ERROR);
g_return_val_if_fail (is_list || GST_IS_BUFFER (data), GST_FLOW_ERROR);
buffer = GST_BUFFER_CAST (data);
}
- /* FIXME-0.11 */
- g_assert_not_reached ();
- /* rtp_source_update_caps (src, GST_BUFFER_CAPS (buffer)); */
-
/* we are a sender now */
src->is_sender = TRUE;
* Returns: TRUE if it was a known conflict, FALSE otherwise
*/
gboolean
-rtp_source_find_conflicting_address (RTPSource * src, GstNetAddress * address,
+rtp_source_find_conflicting_address (RTPSource * src, GSocketAddress * address,
GstClockTime time)
{
GList *item;
item; item = g_list_next (item)) {
RTPConflictingAddress *known_conflict = item->data;
- if (gst_net_address_equal (address, &known_conflict->address)) {
+ if (__g_socket_address_equal (address, known_conflict->address)) {
known_conflict->time = time;
return TRUE;
}
*/
void
rtp_source_add_conflicting_address (RTPSource * src,
- GstNetAddress * address, GstClockTime time)
+ GSocketAddress * address, GstClockTime time)
{
RTPConflictingAddress *new_conflict;
new_conflict = g_new0 (RTPConflictingAddress, 1);
- memcpy (&new_conflict->address, address, sizeof (GstNetAddress));
+ new_conflict->address = G_SOCKET_ADDRESS (g_object_ref (address));
new_conflict->time = time;
src->conflicting_addresses = g_list_prepend (src->conflicting_addresses,
GList *next_item = g_list_next (item);
if (known_conflict->time < current_time - collision_timeout) {
- gchar buf[40];
+ gchar *buf;
src->conflicting_addresses =
g_list_delete_link (src->conflicting_addresses, item);
- gst_net_address_to_string (&known_conflict->address, buf, 40);
+ buf = __g_socket_address_to_string (known_conflict->address);
GST_DEBUG ("collision %p timed out: %s", known_conflict, buf);
+ g_free (buf);
+ g_object_unref (known_conflict->address);
g_free (known_conflict);
}
item = next_item;