rtpbin: use running-time for NTP time
authorWim Taymans <wim.taymans@collabora.co.uk>
Wed, 17 Oct 2012 10:17:32 +0000 (12:17 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Wed, 17 Oct 2012 10:26:05 +0000 (12:26 +0200)
When use-pipeline-clock is set, use the running-time of the
pipeline to calculate the NTP timestamps. This method would previously
only work when the base-time is set to 0 but with this change it can
also work with different offsets and we can also implement pause/resume
of the sender and receiver now.

gst/rtpmanager/gstrtpbin.c
gst/rtpmanager/gstrtpsession.c

index bcc904a..d2ffcf1 100644 (file)
@@ -939,7 +939,7 @@ get_current_times (GstRtpBin * bin, GstClockTime * running_time,
     clock_time = gst_clock_get_time (clock);
 
     if (bin->use_pipeline_clock) {
-      ntpns = clock_time;
+      ntpns = clock_time - base_time;
     } else {
       GTimeVal current;
 
@@ -1786,7 +1786,7 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass)
 
   g_object_class_install_property (gobject_class, PROP_USE_PIPELINE_CLOCK,
       g_param_spec_boolean ("use-pipeline-clock", "Use pipeline clock",
-          "Use the pipeline clock to set the NTP time in the RTCP SR messages",
+          "Use the pipeline running-time to set the NTP time in the RTCP SR messages",
           DEFAULT_USE_PIPELINE_CLOCK,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   /**
index 5863650..dc2d364 100644 (file)
@@ -564,7 +564,7 @@ gst_rtp_session_class_init (GstRtpSessionClass * klass)
 
   g_object_class_install_property (gobject_class, PROP_USE_PIPELINE_CLOCK,
       g_param_spec_boolean ("use-pipeline-clock", "Use pipeline clock",
-          "Use the pipeline clock to set the NTP time in the RTCP SR messages",
+          "Use the pipeline running-time to set the NTP time in the RTCP SR messages",
           DEFAULT_USE_PIPELINE_CLOCK,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
@@ -784,7 +784,7 @@ get_current_times (GstRtpSession * rtpsession, GstClockTime * running_time,
     clock_time = gst_clock_get_time (clock);
 
     if (rtpsession->priv->use_pipeline_clock) {
-      ntpns = clock_time;
+      ntpns = clock_time - base_time;
     } else {
       GTimeVal current;