}
}
-/**
- * rtp_source_process_rtp:
- * @src: an #RTPSource
- * @pinfo: an #RTPPacketInfo
- *
- * Let @src handle the incomming RTP packet described in @pinfo.
- *
- * Returns: a #GstFlowReturn.
- */
-GstFlowReturn
-rtp_source_process_rtp (RTPSource * src, RTPPacketInfo * pinfo)
+static gboolean
+update_receiver_stats (RTPSource * src, RTPPacketInfo * pinfo)
{
- GstFlowReturn result = GST_FLOW_OK;
guint16 seqnr, udelta;
RTPSourceStats *stats;
guint16 expected;
- g_return_val_if_fail (RTP_IS_SOURCE (src), GST_FLOW_ERROR);
- g_return_val_if_fail (pinfo != NULL, GST_FLOW_ERROR);
-
stats = &src->stats;
seqnr = pinfo->seqnum;
src->stats.packets_received++;
/* for the bitrate estimation */
src->bytes_received += pinfo->payload_len;
- /* the source that sent the packet must be a sender */
- src->is_sender = TRUE;
- src->validated = TRUE;
-
- do_bitrate_estimation (src, pinfo->running_time, &src->bytes_received);
GST_LOG ("seq %d, PC: %" G_GUINT64_FORMAT ", OC: %" G_GUINT64_FORMAT,
seqnr, src->stats.packets_received, src->stats.octets_received);
- /* calculate jitter for the stats */
- calculate_jitter (src, pinfo);
-
- /* we're ready to push the RTP packet now */
- result = push_packet (src, pinfo->data);
- pinfo->data = NULL;
-
-done:
- return result;
+ return TRUE;
/* ERRORS */
+done:
+ {
+ return FALSE;
+ }
bad_sequence:
{
GST_WARNING ("unacceptable seqnum received");
- return GST_FLOW_OK;
+ return FALSE;
}
probation_seqnum:
{
GST_WARNING ("probation: seqnr %d != expected %d", seqnr, expected);
src->curr_probation = src->probation;
src->stats.max_seq = seqnr;
- return GST_FLOW_OK;
+ return FALSE;
}
}
/**
+ * rtp_source_process_rtp:
+ * @src: an #RTPSource
+ * @pinfo: an #RTPPacketInfo
+ *
+ * Let @src handle the incomming RTP packet described in @pinfo.
+ *
+ * Returns: a #GstFlowReturn.
+ */
+GstFlowReturn
+rtp_source_process_rtp (RTPSource * src, RTPPacketInfo * pinfo)
+{
+ GstFlowReturn result;
+
+ g_return_val_if_fail (RTP_IS_SOURCE (src), GST_FLOW_ERROR);
+ g_return_val_if_fail (pinfo != NULL, GST_FLOW_ERROR);
+
+ if (!update_receiver_stats (src, pinfo))
+ return GST_FLOW_OK;
+
+ /* the source that sent the packet must be a sender */
+ src->is_sender = TRUE;
+ src->validated = TRUE;
+
+ do_bitrate_estimation (src, pinfo->running_time, &src->bytes_received);
+
+ /* calculate jitter for the stats */
+ calculate_jitter (src, pinfo);
+
+ /* we're ready to push the RTP packet now */
+ result = push_packet (src, pinfo->data);
+ pinfo->data = NULL;
+
+ return result;
+}
+
+/**
* rtp_source_mark_bye:
* @src: an #RTPSource
* @reason: the reason for leaving