automatically decide when to update the jitter buffer delay based on the
authorjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Mon, 21 May 2007 11:41:21 +0000 (11:41 +0000)
committerjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Mon, 21 May 2007 11:41:21 +0000 (11:41 +0000)
decoded activity level.

git-svn-id: http://svn.xiph.org/trunk/speex@12965 0101bb08-14d6-0310-b084-bc0e0c8e3800

libspeex/jitter.c

index 2b64453..2c6a9d5 100644 (file)
@@ -578,6 +578,7 @@ void speex_jitter_get(SpeexJitter *jitter, short *out, int *current_timestamp)
 {
    int i;
    int ret;
+   spx_int32_t activity;
    char data[2048];
    JitterBufferPacket packet;
    packet.data = data;
@@ -617,7 +618,9 @@ void speex_jitter_get(SpeexJitter *jitter, short *out, int *current_timestamp)
             out[i]=0;
       }
    }
-   jitter_buffer_update_delay(jitter->packets, &packet, NULL);
+   speex_decoder_ctl(jitter->dec, SPEEX_GET_ACTIVITY, &activity);
+   if (activity < 30)
+      jitter_buffer_update_delay(jitter->packets, &packet, NULL);
    jitter_buffer_tick(jitter->packets);
 }