jitterbuffer: add new timestamp mode

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.
This commit is contained in:
Wim Taymans 2013-10-30 16:49:36 +01:00
parent 4a8082856a
commit 43645d5981
2 changed files with 13 additions and 0 deletions

View 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_SLAVE, "Slave receiver to sender clock", "slave"},
{RTP_JITTER_BUFFER_MODE_BUFFER, "Do low/high watermark buffering", {RTP_JITTER_BUFFER_MODE_BUFFER, "Do low/high watermark buffering",
"buffer"}, "buffer"},
{RTP_JITTER_BUFFER_MODE_SYNCED, "Synchronized sender and receiver clocks",
"synced"},
{0, NULL, NULL}, {0, NULL, NULL},
}; };
@ -716,6 +718,12 @@ rtp_jitter_buffer_insert (RTPJitterBuffer * jbuf, RTPJitterBufferItem * item,
else else
dts = -1; dts = -1;
break; 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: case RTP_JITTER_BUFFER_MODE_SLAVE:
default: default:
break; break;

View file

@ -45,6 +45,10 @@ typedef struct _RTPJitterBufferItem RTPJitterBufferItem;
* low latency communications. * low latency communications.
* RTP_JITTER_BUFFER_MODE_BUFFER: buffer packets between low/high watermarks. * RTP_JITTER_BUFFER_MODE_BUFFER: buffer packets between low/high watermarks.
* This mode is good for streaming communication. * 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. * RTP_JITTER_BUFFER_MODE_LAST: last buffer mode.
* *
* The different buffer modes for a jitterbuffer. * The different buffer modes for a jitterbuffer.
@ -53,6 +57,7 @@ typedef enum {
RTP_JITTER_BUFFER_MODE_NONE = 0, RTP_JITTER_BUFFER_MODE_NONE = 0,
RTP_JITTER_BUFFER_MODE_SLAVE = 1, RTP_JITTER_BUFFER_MODE_SLAVE = 1,
RTP_JITTER_BUFFER_MODE_BUFFER = 2, RTP_JITTER_BUFFER_MODE_BUFFER = 2,
RTP_JITTER_BUFFER_MODE_SYNCED = 3,
RTP_JITTER_BUFFER_MODE_LAST RTP_JITTER_BUFFER_MODE_LAST
} RTPJitterBufferMode; } RTPJitterBufferMode;