[xiph-commits] r11124 - in trunk/speex: include/speex libspeex

jm at svn.xiph.org jm at svn.xiph.org
Wed Apr 12 00:12:12 PDT 2006


Author: jm
Date: 2006-04-12 00:12:10 -0700 (Wed, 12 Apr 2006)
New Revision: 11124

Modified:
   trunk/speex/include/speex/speex_jitter.h
   trunk/speex/libspeex/jitter.c
Log:
OK, jitter_buffer_get() now returns the offset, which is more useful by itself.


Modified: trunk/speex/include/speex/speex_jitter.h
===================================================================
--- trunk/speex/include/speex/speex_jitter.h	2006-04-12 06:27:37 UTC (rev 11123)
+++ trunk/speex/include/speex/speex_jitter.h	2006-04-12 07:12:10 UTC (rev 11124)
@@ -105,7 +105,7 @@
 void speex_jitter_put(SpeexJitter *jitter, const JitterBufferPacket *packet);
 
 /** Get one packet from the jitter buffer */
-void speex_jitter_get(SpeexJitter *jitter, spx_int16_t *out, int *current_timestamp);
+void speex_jitter_get(SpeexJitter *jitter, spx_int16_t *out, int *start_offset);
 
 /** Get pointer timestamp of jitter buffer */
 int speex_jitter_get_pointer_timestamp(SpeexJitter *jitter);

Modified: trunk/speex/libspeex/jitter.c
===================================================================
--- trunk/speex/libspeex/jitter.c	2006-04-12 06:27:37 UTC (rev 11123)
+++ trunk/speex/libspeex/jitter.c	2006-04-12 07:12:10 UTC (rev 11124)
@@ -227,7 +227,7 @@
 
 /** Get one packet from the jitter buffer */
 /*void jitter_buffer_get(JitterBuffer *jitter, short *out, int *current_timestamp);*/
-int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_uint32_t *current_timestamp)
+int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_uint32_t *start_offset)
 {
    int i, j;
    float late_ratio_short;
@@ -239,7 +239,7 @@
    int chunk_size;
    int incomplete = 0;
    
-   if (LT32(jitter->current_timestamp, jitter->pointer_timestamp-jitter->tick_size))
+   if (LT32(jitter->current_timestamp+jitter->tick_size, jitter->pointer_timestamp))
    {
       jitter->current_timestamp = jitter->pointer_timestamp;
       speex_warning("did you forget to call jitter_buffer_tick() by any chance?");
@@ -382,8 +382,8 @@
       speex_free(jitter->buf[i]);
       jitter->buf[i] = NULL;
       /* Set timestamp and span (if requested) */
-      if (current_timestamp)
-         *current_timestamp = jitter->pointer_timestamp;
+      if (start_offset)
+         *start_offset = jitter->timestamp[i]-jitter->pointer_timestamp;
       packet->timestamp = jitter->timestamp[i];
       packet->span = jitter->span[i];
       /* Point at the end of the current packet */
@@ -401,8 +401,8 @@
    /*fprintf (stderr, "m");*/
    /*fprintf (stderr, "lost_count = %d\n", jitter->lost_count);*/
    jitter->loss_rate = .999*jitter->loss_rate + .001;
-   if (current_timestamp)
-      *current_timestamp = jitter->pointer_timestamp;
+   if (start_offset)
+      *start_offset = 0;
    packet->timestamp = jitter->pointer_timestamp;
    packet->span = jitter->tick_size;
    jitter->pointer_timestamp += chunk_size;



More information about the commits mailing list