From ca15984e14415a6be286c4744020aa4f9b258979 Mon Sep 17 00:00:00 2001 From: Peter Kjellerstedt Date: Thu, 3 Jul 2008 13:47:19 +0000 Subject: [PATCH] gst/rtpmanager/: Do not mix the use of g_get_current_time() with gst_clock_get_time(). Original commit message from CVS: * gst/rtpmanager/gstrtpsession.c: (gst_rtp_session_init), (gst_rtp_session_finalize), (rtcp_thread), (gst_rtp_session_chain_recv_rtp), (gst_rtp_session_chain_recv_rtcp), (gst_rtp_session_event_send_rtp_sink), (gst_rtp_session_chain_send_rtp): * gst/rtpmanager/rtpsession.c: (check_collision), (update_arrival_stats), (rtp_session_process_rtp), (rtp_session_process_rtcp), (rtp_session_send_rtp), (rtp_session_send_bye_locked), (rtp_session_send_bye), (rtp_session_next_timeout), (session_report_blocks), (session_cleanup), (is_rtcp_time), (rtp_session_on_timeout): * gst/rtpmanager/rtpsession.h: Do not mix the use of g_get_current_time() with gst_clock_get_time(). --- gst/rtpmanager/gstrtpsession.c | 53 ++++++++-------- gst/rtpmanager/rtpsession.c | 108 ++++++++++++++++----------------- gst/rtpmanager/rtpsession.h | 15 ++--- 3 files changed, 85 insertions(+), 91 deletions(-) diff --git a/gst/rtpmanager/gstrtpsession.c b/gst/rtpmanager/gstrtpsession.c index facbaaf72f..a3359e4543 100644 --- a/gst/rtpmanager/gstrtpsession.c +++ b/gst/rtpmanager/gstrtpsession.c @@ -236,6 +236,7 @@ enum struct _GstRtpSessionPrivate { GMutex *lock; + GstClock *sysclock; RTPSession *session; /* thread for sending out RTCP */ @@ -651,6 +652,7 @@ gst_rtp_session_init (GstRtpSession * rtpsession, GstRtpSessionClass * klass) { rtpsession->priv = GST_RTP_SESSION_GET_PRIVATE (rtpsession); rtpsession->priv->lock = g_mutex_new (); + rtpsession->priv->sysclock = gst_system_clock_obtain (); rtpsession->priv->session = rtp_session_new (); /* configure callbacks */ rtp_session_set_callbacks (rtpsession->priv->session, &callbacks, rtpsession); @@ -698,6 +700,7 @@ gst_rtp_session_finalize (GObject * object) g_hash_table_destroy (rtpsession->priv->ptmap); g_mutex_free (rtpsession->priv->lock); + g_object_unref (rtpsession->priv->sysclock); g_object_unref (rtpsession->priv->session); G_OBJECT_CLASS (parent_class)->finalize (object); @@ -857,23 +860,17 @@ get_current_ntp_ns_time (GstRtpSession * rtpsession) static void rtcp_thread (GstRtpSession * rtpsession) { - GstClock *sysclock; GstClockID id; GstClockTime current_time; GstClockTime next_timeout; guint64 ntpnstime; - /* for RTCP timeouts we use the system clock */ - sysclock = gst_system_clock_obtain (); - if (sysclock == NULL) - goto no_sysclock; - - current_time = gst_clock_get_time (sysclock); - GST_DEBUG_OBJECT (rtpsession, "entering RTCP thread"); GST_RTP_SESSION_LOCK (rtpsession); + current_time = gst_clock_get_time (rtpsession->priv->sysclock); + while (!rtpsession->priv->stop_thread) { GstClockReturn res; @@ -889,7 +886,7 @@ rtcp_thread (GstRtpSession * rtpsession) break; id = rtpsession->priv->id = - gst_clock_new_single_shot_id (sysclock, next_timeout); + gst_clock_new_single_shot_id (rtpsession->priv->sysclock, next_timeout); GST_RTP_SESSION_UNLOCK (rtpsession); res = gst_clock_id_wait (id, NULL); @@ -902,7 +899,7 @@ rtcp_thread (GstRtpSession * rtpsession) break; /* update current time */ - current_time = gst_clock_get_time (sysclock); + current_time = gst_clock_get_time (rtpsession->priv->sysclock); /* get current NTP time */ ntpnstime = get_current_ntp_ns_time (rtpsession); @@ -921,18 +918,7 @@ rtcp_thread (GstRtpSession * rtpsession) rtpsession->priv->thread_stopped = TRUE; GST_RTP_SESSION_UNLOCK (rtpsession); - gst_object_unref (sysclock); - GST_DEBUG_OBJECT (rtpsession, "leaving RTCP thread"); - return; - - /* ERRORS */ -no_sysclock: - { - GST_ELEMENT_ERROR (rtpsession, CORE, CLOCK, (NULL), - ("Could not get system clock")); - return; - } } static gboolean @@ -1397,6 +1383,7 @@ gst_rtp_session_chain_recv_rtp (GstPad * pad, GstBuffer * buffer) GstRtpSession *rtpsession; GstRtpSessionPrivate *priv; GstFlowReturn ret; + GstClockTime current_time; guint64 ntpnstime; GstClockTime timestamp; @@ -1418,7 +1405,9 @@ gst_rtp_session_chain_recv_rtp (GstPad * pad, GstBuffer * buffer) ntpnstime = get_current_ntp_ns_time (rtpsession); } - ret = rtp_session_process_rtp (priv->session, buffer, ntpnstime); + current_time = gst_clock_get_time (priv->sysclock); + ret = rtp_session_process_rtp (priv->session, buffer, current_time, + ntpnstime); if (ret != GST_FLOW_OK) goto push_error; @@ -1472,6 +1461,7 @@ gst_rtp_session_chain_recv_rtcp (GstPad * pad, GstBuffer * buffer) { GstRtpSession *rtpsession; GstRtpSessionPrivate *priv; + GstClockTime current_time; GstFlowReturn ret; rtpsession = GST_RTP_SESSION (gst_pad_get_parent (pad)); @@ -1479,7 +1469,8 @@ gst_rtp_session_chain_recv_rtcp (GstPad * pad, GstBuffer * buffer) GST_DEBUG_OBJECT (rtpsession, "received RTCP packet"); - ret = rtp_session_process_rtcp (priv->session, buffer); + current_time = gst_clock_get_time (priv->sysclock); + ret = rtp_session_process_rtcp (priv->session, buffer, current_time); gst_object_unref (rtpsession); @@ -1531,8 +1522,7 @@ gst_rtp_session_event_send_rtp_sink (GstPad * pad, GstEvent * event) gst_segment_init (&rtpsession->send_rtp_seg, GST_FORMAT_UNDEFINED); ret = gst_pad_push_event (rtpsession->send_rtp_src, event); break; - case GST_EVENT_NEWSEGMENT: - { + case GST_EVENT_NEWSEGMENT:{ gboolean update; gdouble rate, arate; GstFormat format; @@ -1563,10 +1553,15 @@ gst_rtp_session_event_send_rtp_sink (GstPad * pad, GstEvent * event) ret = gst_pad_push_event (rtpsession->send_rtp_src, event); break; } - case GST_EVENT_EOS: + case GST_EVENT_EOS:{ + GstClockTime current_time; + ret = gst_pad_push_event (rtpsession->send_rtp_src, event); - rtp_session_send_bye (rtpsession->priv->session, "End of stream"); + current_time = gst_clock_get_time (rtpsession->priv->sysclock); + rtp_session_send_bye (rtpsession->priv->session, "End of stream", + current_time); break; + } default: ret = gst_pad_push_event (rtpsession->send_rtp_src, event); break; @@ -1613,6 +1608,7 @@ gst_rtp_session_chain_send_rtp (GstPad * pad, GstBuffer * buffer) GstRtpSessionPrivate *priv; GstFlowReturn ret; GstClockTime timestamp; + GstClockTime current_time; guint64 ntpnstime; rtpsession = GST_RTP_SESSION (gst_pad_get_parent (pad)); @@ -1635,7 +1631,8 @@ gst_rtp_session_chain_send_rtp (GstPad * pad, GstBuffer * buffer) ntpnstime = -1; } - ret = rtp_session_send_rtp (priv->session, buffer, ntpnstime); + current_time = gst_clock_get_time (priv->sysclock); + ret = rtp_session_send_rtp (priv->session, buffer, current_time, ntpnstime); if (ret != GST_FLOW_OK) goto push_error; diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c index b6ca39cf33..c7ab410f34 100644 --- a/gst/rtpmanager/rtpsession.c +++ b/gst/rtpmanager/rtpsession.c @@ -101,7 +101,7 @@ G_DEFINE_TYPE (RTPSession, rtp_session, G_TYPE_OBJECT); static RTPSource *obtain_source (RTPSession * sess, guint32 ssrc, gboolean * created, RTPArrivalStats * arrival, gboolean rtp); static GstFlowReturn rtp_session_send_bye_locked (RTPSession * sess, - const gchar * reason); + const gchar * reason, GstClockTime current_time); static GstClockTime calculate_rtcp_interval (RTPSession * sess, gboolean deterministic, gboolean first); @@ -959,7 +959,7 @@ check_collision (RTPSession * sess, RTPSource * source, GST_DEBUG ("Collision for SSRC %x", rtp_source_get_ssrc (source)); on_ssrc_collision (sess, source); - rtp_session_send_bye_locked (sess, "SSRC Collision"); + rtp_session_send_bye_locked (sess, "SSRC Collision", arrival->time); sess->change_ssrc = TRUE; } @@ -1230,13 +1230,11 @@ rtp_session_create_source (RTPSession * sess) */ static void update_arrival_stats (RTPSession * sess, RTPArrivalStats * arrival, - gboolean rtp, GstBuffer * buffer, guint64 ntpnstime) + gboolean rtp, GstBuffer * buffer, GstClockTime current_time, + guint64 ntpnstime) { - GTimeVal current; - /* get time of arrival */ - g_get_current_time (¤t); - arrival->time = GST_TIMEVAL_TO_TIME (current); + arrival->time = current_time; arrival->timestamp = GST_BUFFER_TIMESTAMP (buffer); arrival->ntpnstime = ntpnstime; @@ -1262,6 +1260,7 @@ update_arrival_stats (RTPSession * sess, RTPArrivalStats * arrival, * rtp_session_process_rtp: * @sess: and #RTPSession * @buffer: an RTP buffer + * @current_time: the current system time * @ntpnstime: the NTP arrival time in nanoseconds * * Process an RTP buffer in the session manager. This function takes ownership @@ -1271,7 +1270,7 @@ update_arrival_stats (RTPSession * sess, RTPArrivalStats * arrival, */ GstFlowReturn rtp_session_process_rtp (RTPSession * sess, GstBuffer * buffer, - guint64 ntpnstime) + GstClockTime current_time, guint64 ntpnstime) { GstFlowReturn result; guint32 ssrc; @@ -1288,7 +1287,7 @@ rtp_session_process_rtp (RTPSession * sess, GstBuffer * buffer, RTP_SESSION_LOCK (sess); /* update arrival stats */ - update_arrival_stats (sess, &arrival, TRUE, buffer, ntpnstime); + update_arrival_stats (sess, &arrival, TRUE, buffer, current_time, ntpnstime); /* ignore more RTP packets when we left the session */ if (sess->source->received_bye) @@ -1639,6 +1638,7 @@ rtp_session_process_app (RTPSession * sess, GstRTCPPacket * packet, * rtp_session_process_rtcp: * @sess: and #RTPSession * @buffer: an RTCP buffer + * @current_time: the current system time * * Process an RTCP buffer in the session manager. This function takes ownership * of @buffer. @@ -1646,7 +1646,8 @@ rtp_session_process_app (RTPSession * sess, GstRTCPPacket * packet, * Returns: a #GstFlowReturn. */ GstFlowReturn -rtp_session_process_rtcp (RTPSession * sess, GstBuffer * buffer) +rtp_session_process_rtcp (RTPSession * sess, GstBuffer * buffer, + GstClockTime current_time) { GstRTCPPacket packet; gboolean more, is_bye = FALSE, is_sr = FALSE; @@ -1663,7 +1664,7 @@ rtp_session_process_rtcp (RTPSession * sess, GstBuffer * buffer) RTP_SESSION_LOCK (sess); /* update arrival stats */ - update_arrival_stats (sess, &arrival, FALSE, buffer, -1); + update_arrival_stats (sess, &arrival, FALSE, buffer, current_time, -1); if (sess->sent_bye) goto ignore; @@ -1749,6 +1750,7 @@ ignore: * rtp_session_send_rtp: * @sess: an #RTPSession * @buffer: an RTP buffer + * @current_time: the current system time * @ntpnstime: the NTP time in nanoseconds of when this buffer was captured. * * Send the RTP buffer in the session manager. This function takes ownership of @@ -1757,12 +1759,12 @@ ignore: * Returns: a #GstFlowReturn. */ GstFlowReturn -rtp_session_send_rtp (RTPSession * sess, GstBuffer * buffer, guint64 ntpnstime) +rtp_session_send_rtp (RTPSession * sess, GstBuffer * buffer, + GstClockTime current_time, guint64 ntpnstime) { GstFlowReturn result; RTPSource *source; gboolean prevsender; - GTimeVal current; g_return_val_if_fail (RTP_IS_SESSION (sess), GST_FLOW_ERROR); g_return_val_if_fail (GST_IS_BUFFER (buffer), GST_FLOW_ERROR); @@ -1776,8 +1778,7 @@ rtp_session_send_rtp (RTPSession * sess, GstBuffer * buffer, guint64 ntpnstime) source = sess->source; /* update last activity */ - g_get_current_time (¤t); - source->last_rtp_activity = GST_TIMEVAL_TO_TIME (current); + source->last_rtp_activity = current_time; prevsender = RTP_SOURCE_IS_SENDER (source); @@ -1835,12 +1836,12 @@ calculate_rtcp_interval (RTPSession * sess, gboolean deterministic, * Returns: a #GstFlowReturn. */ static GstFlowReturn -rtp_session_send_bye_locked (RTPSession * sess, const gchar * reason) +rtp_session_send_bye_locked (RTPSession * sess, const gchar * reason, + GstClockTime current_time) { GstFlowReturn result = GST_FLOW_OK; RTPSource *source; - GstClockTime current, interval; - GTimeVal curtv; + GstClockTime interval; g_return_val_if_fail (RTP_IS_SESSION (sess), GST_FLOW_ERROR); @@ -1860,14 +1861,10 @@ rtp_session_send_bye_locked (RTPSession * sess, const gchar * reason) sess->first_rtcp = TRUE; sess->sent_bye = FALSE; - /* get current time */ - g_get_current_time (&curtv); - current = GST_TIMEVAL_TO_TIME (curtv); - /* reschedule transmission */ - sess->last_rtcp_send_time = current; + sess->last_rtcp_send_time = current_time; interval = calculate_rtcp_interval (sess, FALSE, TRUE); - sess->next_rtcp_check_time = current + interval; + sess->next_rtcp_check_time = current_time + interval; GST_DEBUG ("Schedule BYE for %" GST_TIME_FORMAT ", %" GST_TIME_FORMAT, GST_TIME_ARGS (interval), GST_TIME_ARGS (sess->next_rtcp_check_time)); @@ -1886,6 +1883,7 @@ done: * rtp_session_send_bye: * @sess: an #RTPSession * @reason: a reason or NULL + * @current_time: the current system time * * Stop the current @sess and schedule a BYE message for the other members. * @@ -1894,14 +1892,15 @@ done: * Returns: a #GstFlowReturn. */ GstFlowReturn -rtp_session_send_bye (RTPSession * sess, const gchar * reason) +rtp_session_send_bye (RTPSession * sess, const gchar * reason, + GstClockTime current_time) { GstFlowReturn result = GST_FLOW_OK; g_return_val_if_fail (RTP_IS_SESSION (sess), GST_FLOW_ERROR); RTP_SESSION_LOCK (sess); - result = rtp_session_send_bye_locked (sess, reason); + result = rtp_session_send_bye_locked (sess, reason, current_time); RTP_SESSION_UNLOCK (sess); return result; @@ -1910,7 +1909,7 @@ rtp_session_send_bye (RTPSession * sess, const gchar * reason) /** * rtp_session_next_timeout: * @sess: an #RTPSession - * @time: the current system time + * @current_time: the current system time * * Get the next time we should perform session maintenance tasks. * @@ -1918,7 +1917,7 @@ rtp_session_send_bye (RTPSession * sess, const gchar * reason) * current system time. */ GstClockTime -rtp_session_next_timeout (RTPSession * sess, GstClockTime time) +rtp_session_next_timeout (RTPSession * sess, GstClockTime current_time) { GstClockTime result; @@ -1929,13 +1928,13 @@ rtp_session_next_timeout (RTPSession * sess, GstClockTime time) result = sess->next_rtcp_check_time; GST_DEBUG ("current time: %" GST_TIME_FORMAT ", next :%" GST_TIME_FORMAT, - GST_TIME_ARGS (time), GST_TIME_ARGS (result)); + GST_TIME_ARGS (current_time), GST_TIME_ARGS (result)); - if (result < time) { + if (result < current_time) { GST_DEBUG ("take current time as base"); /* our previous check time expired, start counting from the current time * again. */ - result = time; + result = current_time; } if (sess->source->received_bye) { @@ -1952,7 +1951,7 @@ rtp_session_next_timeout (RTPSession * sess, GstClockTime time) GST_DEBUG ("first RTCP packet"); /* we are called for the first time */ result += calculate_rtcp_interval (sess, FALSE, TRUE); - } else if (sess->next_rtcp_check_time < time) { + } else if (sess->next_rtcp_check_time < current_time) { GST_DEBUG ("old check time expired, getting new timeout"); /* get a new timeout when we need to */ result += calculate_rtcp_interval (sess, FALSE, FALSE); @@ -1970,7 +1969,7 @@ typedef struct { RTPSession *sess; GstBuffer *rtcp; - GstClockTime time; + GstClockTime current_time; guint64 ntpnstime; GstClockTime interval; GstRTCPPacket packet; @@ -2033,8 +2032,8 @@ session_report_blocks (const gchar * key, RTPSource * source, ReportData * data) guint32 lsr, dlsr; /* get new stats */ - rtp_source_get_new_rb (source, data->time, &fractionlost, &packetslost, - &exthighestseq, &jitter, &lsr, &dlsr); + rtp_source_get_new_rb (source, data->current_time, &fractionlost, + &packetslost, &exthighestseq, &jitter, &lsr, &dlsr); /* packet is not yet filled, add report block for this source. */ gst_rtcp_packet_add_rb (packet, source->ssrc, fractionlost, packetslost, @@ -2061,8 +2060,8 @@ session_cleanup (const gchar * key, RTPSource * source, ReportData * data) if (source->received_bye) { /* if we received a BYE from the source, remove the source after some * time. */ - if (data->time > source->bye_time && - data->time - source->bye_time > sess->stats.bye_timeout) { + if (data->current_time > source->bye_time && + data->current_time - source->bye_time > sess->stats.bye_timeout) { GST_DEBUG ("removing BYE source %08x", source->ssrc); remove = TRUE; byetimeout = TRUE; @@ -2070,9 +2069,9 @@ session_cleanup (const gchar * key, RTPSource * source, ReportData * data) } /* sources that were inactive for more than 5 times the deterministic reporting * interval get timed out. the min timeout is 5 seconds. */ - if (data->time > source->last_activity) { + if (data->current_time > source->last_activity) { interval = MAX (data->interval * 5, 5 * GST_SECOND); - if (data->time - source->last_activity > interval) { + if (data->current_time - source->last_activity > interval) { GST_DEBUG ("removing timeout source %08x, last %" GST_TIME_FORMAT, source->ssrc, GST_TIME_ARGS (source->last_activity)); remove = TRUE; @@ -2083,9 +2082,9 @@ session_cleanup (const gchar * key, RTPSource * source, ReportData * data) /* senders that did not send for a long time become a receiver, this also * holds for our own source. */ if (is_sender) { - if (data->time > source->last_rtp_activity) { + if (data->current_time > source->last_rtp_activity) { interval = MAX (data->interval * 2, 5 * GST_SECOND); - if (data->time - source->last_rtp_activity > interval) { + if (data->current_time - source->last_rtp_activity > interval) { GST_DEBUG ("sender source %08x timed out and became receiver, last %" GST_TIME_FORMAT, source->ssrc, GST_TIME_ARGS (source->last_rtp_activity)); @@ -2162,21 +2161,21 @@ session_bye (RTPSession * sess, ReportData * data) } static gboolean -is_rtcp_time (RTPSession * sess, GstClockTime time, ReportData * data) +is_rtcp_time (RTPSession * sess, GstClockTime current_time, ReportData * data) { GstClockTime new_send_time, elapsed; gboolean result; /* no need to check yet */ - if (sess->next_rtcp_check_time > time) { + if (sess->next_rtcp_check_time > current_time) { GST_DEBUG ("no check time yet, next %" GST_TIME_FORMAT " > now %" GST_TIME_FORMAT, GST_TIME_ARGS (sess->next_rtcp_check_time), - GST_TIME_ARGS (time)); + GST_TIME_ARGS (current_time)); return FALSE; } /* get elapsed time since we last reported */ - elapsed = time - sess->last_rtcp_send_time; + elapsed = current_time - sess->last_rtcp_send_time; /* perform forward reconsideration */ new_send_time = rtp_stats_add_rtcp_jitter (&sess->stats, data->interval); @@ -2187,7 +2186,7 @@ is_rtcp_time (RTPSession * sess, GstClockTime time, ReportData * data) new_send_time += sess->last_rtcp_send_time; /* check if reconsideration */ - if (time < new_send_time) { + if (current_time < new_send_time) { GST_DEBUG ("reconsider RTCP for %" GST_TIME_FORMAT, GST_TIME_ARGS (new_send_time)); result = FALSE; @@ -2199,7 +2198,7 @@ is_rtcp_time (RTPSession * sess, GstClockTime time, ReportData * data) GST_DEBUG ("can send RTCP now, next interval %" GST_TIME_FORMAT, GST_TIME_ARGS (new_send_time)); - sess->next_rtcp_check_time = time + new_send_time; + sess->next_rtcp_check_time = current_time + new_send_time; } return result; } @@ -2207,7 +2206,7 @@ is_rtcp_time (RTPSession * sess, GstClockTime time, ReportData * data) /** * rtp_session_on_timeout: * @sess: an #RTPSession - * @time: the current system time + * @current_time: the current system time * @ntpnstime: the current NTP time in nanoseconds * * Perform maintenance actions after the timeout obtained with @@ -2222,7 +2221,8 @@ is_rtcp_time (RTPSession * sess, GstClockTime time, ReportData * data) * Returns: a #GstFlowReturn. */ GstFlowReturn -rtp_session_on_timeout (RTPSession * sess, GstClockTime time, guint64 ntpnstime) +rtp_session_on_timeout (RTPSession * sess, GstClockTime current_time, + guint64 ntpnstime) { GstFlowReturn result = GST_FLOW_OK; GList *item; @@ -2231,11 +2231,11 @@ rtp_session_on_timeout (RTPSession * sess, GstClockTime time, guint64 ntpnstime) g_return_val_if_fail (RTP_IS_SESSION (sess), GST_FLOW_ERROR); GST_DEBUG ("reporting at %" GST_TIME_FORMAT ", NTP time %" GST_TIME_FORMAT, - GST_TIME_ARGS (time), GST_TIME_ARGS (ntpnstime)); + GST_TIME_ARGS (current_time), GST_TIME_ARGS (ntpnstime)); data.sess = sess; data.rtcp = NULL; - data.time = time; + data.current_time = current_time; data.ntpnstime = ntpnstime; data.is_bye = FALSE; data.has_sdes = FALSE; @@ -2249,7 +2249,7 @@ rtp_session_on_timeout (RTPSession * sess, GstClockTime time, guint64 ntpnstime) (GHRFunc) session_cleanup, &data); /* see if we need to generate SR or RR packets */ - if (is_rtcp_time (sess, time, &data)) { + if (is_rtcp_time (sess, current_time, &data)) { if (sess->source->received_bye) { /* generate BYE instead */ session_bye (sess, &data); @@ -2266,7 +2266,7 @@ rtp_session_on_timeout (RTPSession * sess, GstClockTime time, guint64 ntpnstime) /* we keep track of the last report time in order to timeout inactive * receivers or senders */ - sess->last_rtcp_send_time = data.time; + sess->last_rtcp_send_time = data.current_time; sess->first_rtcp = FALSE; /* add SDES for this source when not already added */ @@ -2284,7 +2284,7 @@ rtp_session_on_timeout (RTPSession * sess, GstClockTime time, guint64 ntpnstime) RTPConflictingAddress *known_conflict = item->data; GList *next_item = g_list_next (item); - if (known_conflict->time < time - (data.interval * + if (known_conflict->time < current_time - (data.interval * RTCP_INTERVAL_COLLISION_TIMEOUT)) { sess->conflicting_addresses = g_list_delete_link (sess->conflicting_addresses, item); diff --git a/gst/rtpmanager/rtpsession.h b/gst/rtpmanager/rtpsession.h index e14e2da3e7..7c8db6dd27 100644 --- a/gst/rtpmanager/rtpsession.h +++ b/gst/rtpmanager/rtpsession.h @@ -205,9 +205,6 @@ struct _RTPSession { GList *conflicting_addresses; gboolean change_ssrc; - - /* for mapping clock time to NTP time */ - GstClockTime base_time; }; /** @@ -275,17 +272,17 @@ RTPSource* rtp_session_get_source_by_cname (RTPSession *sess, const gcha RTPSource* rtp_session_create_source (RTPSession *sess); /* processing packets from receivers */ -GstFlowReturn rtp_session_process_rtp (RTPSession *sess, GstBuffer *buffer, guint64 ntpnstime); -GstFlowReturn rtp_session_process_rtcp (RTPSession *sess, GstBuffer *buffer); +GstFlowReturn rtp_session_process_rtp (RTPSession *sess, GstBuffer *buffer, GstClockTime current_time, guint64 ntpnstime); +GstFlowReturn rtp_session_process_rtcp (RTPSession *sess, GstBuffer *buffer, GstClockTime current_time); /* processing packets for sending */ -GstFlowReturn rtp_session_send_rtp (RTPSession *sess, GstBuffer *buffer, guint64 ntpnstime); +GstFlowReturn rtp_session_send_rtp (RTPSession *sess, GstBuffer *buffer, GstClockTime current_time, guint64 ntpnstime); /* stopping the session */ -GstFlowReturn rtp_session_send_bye (RTPSession *sess, const gchar *reason); +GstFlowReturn rtp_session_send_bye (RTPSession *sess, const gchar *reason, GstClockTime current_time); /* get interval for next RTCP interval */ -GstClockTime rtp_session_next_timeout (RTPSession *sess, GstClockTime time); -GstFlowReturn rtp_session_on_timeout (RTPSession *sess, GstClockTime time, guint64 ntpnstime); +GstClockTime rtp_session_next_timeout (RTPSession *sess, GstClockTime current_time); +GstFlowReturn rtp_session_on_timeout (RTPSession *sess, GstClockTime current_time, guint64 ntpnstime); #endif /* __RTP_SESSION_H__ */