jitterbuffer: add new timestamp mode
authorWim Taymans <wim.taymans@collabora.co.uk>
Wed, 30 Oct 2013 15:49:36 +0000 (16:49 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Thu, 31 Oct 2013 09:15:25 +0000 (10:15 +0100)
Add a new timestamp mode that assumes the local and remote clock are
synchronized. It takes the first timestamp as a base time and then uses the RTP
timestamps for the output PTS.

gst/rtpmanager/rtpjitterbuffer.c
gst/rtpmanager/rtpjitterbuffer.h

index b7aac10..76dfa5f 100644 (file)
@@ -53,6 +53,8 @@ rtp_jitter_buffer_mode_get_type (void)
     {RTP_JITTER_BUFFER_MODE_SLAVE, "Slave receiver to sender clock", "slave"},
     {RTP_JITTER_BUFFER_MODE_BUFFER, "Do low/high watermark buffering",
         "buffer"},
+    {RTP_JITTER_BUFFER_MODE_SYNCED, "Synchronized sender and receiver clocks",
+        "synced"},
     {0, NULL, NULL},
   };
 
@@ -716,6 +718,12 @@ rtp_jitter_buffer_insert (RTPJitterBuffer * jbuf, RTPJitterBufferItem * item,
       else
         dts = -1;
       break;
+    case RTP_JITTER_BUFFER_MODE_SYNCED:
+      /* synchronized clocks, take first timestamp as base, use RTP timestamps
+       * to interpolate */
+      if (jbuf->base_time != -1)
+        dts = -1;
+      break;
     case RTP_JITTER_BUFFER_MODE_SLAVE:
     default:
       break;
index 1389f26..1f7cbf4 100644 (file)
@@ -45,6 +45,10 @@ typedef struct _RTPJitterBufferItem RTPJitterBufferItem;
  *    low latency communications.
  * RTP_JITTER_BUFFER_MODE_BUFFER: buffer packets between low/high watermarks.
  *    This mode is good for streaming communication.
+ * RTP_JITTER_BUFFER_MODE_SYNCED: sender and receiver clocks are synchronized,
+ *    like #RTP_JITTER_BUFFER_MODE_SLAVE but skew is assumed to be 0. Good for
+ *    low latency communication when sender and receiver clocks are
+ *    synchronized and there is thus no clock skew.
  * RTP_JITTER_BUFFER_MODE_LAST: last buffer mode.
  *
  * The different buffer modes for a jitterbuffer.
@@ -53,6 +57,7 @@ typedef enum {
   RTP_JITTER_BUFFER_MODE_NONE    = 0,
   RTP_JITTER_BUFFER_MODE_SLAVE   = 1,
   RTP_JITTER_BUFFER_MODE_BUFFER  = 2,
+  RTP_JITTER_BUFFER_MODE_SYNCED  = 3,
   RTP_JITTER_BUFFER_MODE_LAST
 } RTPJitterBufferMode;