[xiph-commits] r12675 - in trunk/speex: include/speex libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Wed Mar 7 14:28:14 PST 2007
Author: jm
Date: 2007-03-07 14:28:11 -0800 (Wed, 07 Mar 2007)
New Revision: 12675
Modified:
trunk/speex/include/speex/speex_jitter.h
trunk/speex/libspeex/jitter.c
Log:
JITTER_BUFFER_GET_AVAILABLE_COUNT (patch by pwk)
Modified: trunk/speex/include/speex/speex_jitter.h
===================================================================
--- trunk/speex/include/speex/speex_jitter.h 2007-03-07 21:09:20 UTC (rev 12674)
+++ trunk/speex/include/speex/speex_jitter.h 2007-03-07 22:28:11 UTC (rev 12675)
@@ -81,6 +81,9 @@
#define JITTER_BUFFER_SET_MARGIN 0
/** Get minimum amount of extra buffering required (margin) */
#define JITTER_BUFFER_GET_MARGIN 1
+/* JITTER_BUFFER_SET_AVALIABLE_COUNT wouldn't make sense */
+/** Get the amount of avaliable packets currently buffered */
+#define JITTER_BUFFER_GET_AVALIABLE_COUNT 3
#define JITTER_BUFFER_ADJUST_INTERPOLATE -1
#define JITTER_BUFFER_ADJUST_OK 0
Modified: trunk/speex/libspeex/jitter.c
===================================================================
--- trunk/speex/libspeex/jitter.c 2007-03-07 21:09:20 UTC (rev 12674)
+++ trunk/speex/libspeex/jitter.c 2007-03-07 22:28:11 UTC (rev 12675)
@@ -516,6 +516,7 @@
/* Used like the ioctl function to control the jitter buffer parameters */
int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr)
{
+ int count, i;
switch(request)
{
case JITTER_BUFFER_SET_MARGIN:
@@ -524,6 +525,17 @@
case JITTER_BUFFER_GET_MARGIN:
*(spx_int32_t*)ptr = jitter->buffer_margin;
break;
+ case JITTER_BUFFER_GET_AVALIABLE_COUNT:
+ count = 0;
+ for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
+ {
+ if (jitter->buf[i] && LE32(jitter->pointer_timestamp, jitter->timestamp[i]))
+ {
+ count++;
+ }
+ }
+ *(spx_int32_t*)ptr = count;
+ break;
default:
speex_warning_int("Unknown jitter_buffer_ctl request: ", request);
return -1;
More information about the commits
mailing list