guint16 seqnum;
GstFlowReturn ret = GST_FLOW_OK;
GstClockTime timestamp;
+ guint64 latency_ts;
jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad));
* latency is set, we just pump it in the queue and let the other end push it
* out as fast as possible. */
if (priv->latency_ms && priv->drop_on_latency) {
- guint64 latency_ts;
latency_ts =
gst_util_uint64_scale_int (priv->latency_ms, priv->clock_rate, 1000);
if (priv->next_seqnum != -1) {
/* we expected next_seqnum but received something else, that's a gap */
GST_WARNING_OBJECT (jitterbuffer,
- "Sequence number GAP detected -> %d instead of %d", priv->next_seqnum,
- seqnum);
+ "Sequence number GAP detected: expected %d instead of %d",
+ priv->next_seqnum, seqnum);
} else {
/* we don't know what the next_seqnum should be, wait for the last
* possible moment to push this buffer, maybe we get an earlier seqnum
rtpsession = GST_RTP_SESSION (user_data);
priv = rtpsession->priv;
- GST_DEBUG_OBJECT (rtpsession, "reading receiving RTP packet");
-
if (rtpsession->recv_rtp_src) {
+ GST_DEBUG_OBJECT (rtpsession, "pushing received RTP packet");
result = gst_pad_push (rtpsession->recv_rtp_src, buffer);
} else {
+ GST_DEBUG_OBJECT (rtpsession, "dropping received RTP packet");
gst_buffer_unref (buffer);
result = GST_FLOW_OK;
}
}
ret = rtp_session_process_rtp (priv->session, buffer, ntpnstime);
+ if (ret != GST_FLOW_OK)
+ goto push_error;
+
+done:
gst_object_unref (rtpsession);
return ret;
+
+ /* ERRORS */
+push_error:
+ {
+ GST_DEBUG_OBJECT (rtpsession, "process returned %s",
+ gst_flow_get_name (ret));
+ goto done;
+ }
}
static GstFlowReturn
}
ret = rtp_session_send_rtp (priv->session, buffer, ntpnstime);
+ if (ret != GST_FLOW_OK)
+ goto push_error;
+done:
gst_object_unref (rtpsession);
return ret;
+
+ /* ERRORS */
+push_error:
+ {
+ GST_DEBUG_OBJECT (rtpsession, "process returned %s",
+ gst_flow_get_name (ret));
+ goto done;
+ }
}
/* Create sinkpad to receive RTP packets from senders. This will also create a
"Wim Taymans <wim@fluendo.com>"
};
+#define GST_PAD_LOCK(obj) (g_mutex_lock ((obj)->padlock))
+#define GST_PAD_UNLOCK(obj) (g_mutex_unlock ((obj)->padlock))
+
/* signals */
enum
{
return NULL;
}
+/* with PAD_LOCK */
static GstRtpSsrcDemuxPad *
create_demux_pad_for_ssrc (GstRtpSsrcDemux * demux, guint32 ssrc,
GstClockTime timestamp)
demux->srcpads = g_slist_prepend (demux->srcpads, demuxpad);
- /* unlock to perform the remainder and to fire our signal */
- GST_OBJECT_UNLOCK (demux);
-
/* copy caps from input */
gst_pad_set_caps (rtp_pad, GST_PAD_CAPS (demux->rtp_sink));
gst_pad_use_fixed_caps (rtp_pad);
g_signal_emit (G_OBJECT (demux),
gst_rtp_ssrc_demux_signals[SIGNAL_NEW_SSRC_PAD], 0, ssrc, rtp_pad);
- GST_OBJECT_LOCK (demux);
-
return demuxpad;
}
gst_rtp_ssrc_demux_rtcp_sink_event);
gst_element_add_pad (GST_ELEMENT_CAST (demux), demux->rtcp_sink);
+ demux->padlock = g_mutex_new ();
+
gst_segment_init (&demux->segment, GST_FORMAT_UNDEFINED);
}
GstRtpSsrcDemux *demux;
demux = GST_RTP_SSRC_DEMUX (object);
+ g_mutex_free (demux->padlock);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
GSList *walk;
res = TRUE;
- GST_OBJECT_LOCK (demux);
+ GST_PAD_LOCK (demux);
for (walk = demux->srcpads; walk; walk = g_slist_next (walk)) {
GstRtpSsrcDemuxPad *pad = (GstRtpSsrcDemuxPad *) walk->data;
gst_event_ref (event);
res &= gst_pad_push_event (pad->rtp_pad, event);
}
- GST_OBJECT_UNLOCK (demux);
+ GST_PAD_UNLOCK (demux);
gst_event_unref (event);
break;
}
GSList *walk;
res = TRUE;
- GST_OBJECT_LOCK (demux);
+ GST_PAD_LOCK (demux);
for (walk = demux->srcpads; walk; walk = g_slist_next (walk)) {
GstRtpSsrcDemuxPad *pad = (GstRtpSsrcDemuxPad *) walk->data;
res &= gst_pad_push_event (pad->rtcp_pad, event);
}
- GST_OBJECT_UNLOCK (demux);
+ GST_PAD_UNLOCK (demux);
break;
}
}
GST_DEBUG_OBJECT (demux, "received buffer of SSRC %08x", ssrc);
- GST_OBJECT_LOCK (demux);
+ GST_PAD_LOCK (demux);
dpad = find_demux_pad_for_ssrc (demux, ssrc);
if (dpad == NULL) {
if (!(dpad =
GST_BUFFER_TIMESTAMP (buf))))
goto create_failed;
}
- GST_OBJECT_UNLOCK (demux);
+ GST_PAD_UNLOCK (demux);
/* push to srcpad */
ret = gst_pad_push (dpad->rtp_pad, buf);
{
GST_ELEMENT_ERROR (demux, STREAM, DECODE, (NULL),
("Could not create new pad"));
- GST_OBJECT_UNLOCK (demux);
+ GST_PAD_UNLOCK (demux);
gst_buffer_unref (buf);
return GST_FLOW_ERROR;
}
GST_DEBUG_OBJECT (demux, "received RTCP of SSRC %08x", ssrc);
- GST_OBJECT_LOCK (demux);
+ GST_PAD_LOCK (demux);
dpad = find_demux_pad_for_ssrc (demux, ssrc);
if (dpad == NULL) {
GST_DEBUG_OBJECT (demux, "creating pad for SSRC %08x", ssrc);
if (!(dpad = create_demux_pad_for_ssrc (demux, ssrc, -1)))
goto create_failed;
}
- GST_OBJECT_UNLOCK (demux);
+ GST_PAD_UNLOCK (demux);
/* push to srcpad */
ret = gst_pad_push (dpad->rtcp_pad, buf);
{
GST_ELEMENT_ERROR (demux, STREAM, DECODE, (NULL),
("Could not create new pad"));
- GST_OBJECT_UNLOCK (demux);
+ GST_PAD_UNLOCK (demux);
gst_buffer_unref (buf);
return GST_FLOW_ERROR;
}
demux = GST_RTP_SSRC_DEMUX (gst_pad_get_parent (pad));
- GST_OBJECT_LOCK (demux);
+ GST_PAD_LOCK (demux);
for (walk = demux->srcpads; walk; walk = g_slist_next (walk)) {
GstRtpSsrcDemuxPad *dpad = (GstRtpSsrcDemuxPad *) walk->data;
break;
}
}
- GST_OBJECT_UNLOCK (demux);
+ GST_PAD_UNLOCK (demux);
gst_object_unref (demux);
return res;