From 4fd81747f32ce661995f9e6928e75f9c4ce2fa97 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 26 Aug 2010 16:00:38 +0200 Subject: [PATCH] session: minor cleanups Make clock snapshots more accurate by only sampling the same clock once. --- gst/rtpmanager/gstrtpsession.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gst/rtpmanager/gstrtpsession.c b/gst/rtpmanager/gstrtpsession.c index 061302c..c56ac6d 100644 --- a/gst/rtpmanager/gstrtpsession.c +++ b/gst/rtpmanager/gstrtpsession.c @@ -758,7 +758,7 @@ get_current_times (GstRtpSession * rtpsession, GstClockTime * running_time, { guint64 ntpns; GstClock *clock; - GstClockTime base_time, rt; + GstClockTime base_time, rt, clock_time; GST_OBJECT_LOCK (rtpsession); if ((clock = GST_ELEMENT_CLOCK (rtpsession))) { @@ -766,8 +766,10 @@ get_current_times (GstRtpSession * rtpsession, GstClockTime * running_time, gst_object_ref (clock); GST_OBJECT_UNLOCK (rtpsession); + clock_time = gst_clock_get_time (clock); + if (rtpsession->priv->use_pipeline_clock) { - ntpns = gst_clock_get_time (clock); + ntpns = clock_time; } else { GTimeVal current; @@ -780,7 +782,7 @@ get_current_times (GstRtpSession * rtpsession, GstClockTime * running_time, ntpns += (2208988800LL * GST_SECOND); /* get current clock time and convert to running time */ - rt = gst_clock_get_time (clock) - base_time; + rt = clock_time - base_time; gst_object_unref (clock); } else { -- 2.7.4