[xiph-commits] r13981 - in trunk/speex: . doc speexclient
jm at svn.xiph.org
jm at svn.xiph.org
Sun Oct 14 08:43:34 PDT 2007
Author: jm
Date: 2007-10-14 08:43:33 -0700 (Sun, 14 Oct 2007)
New Revision: 13981
Added:
trunk/speex/speexclient/speex_jitter_buffer.c
Modified:
trunk/speex/COPYING
trunk/speex/configure.ac
trunk/speex/doc/manual.lyx
Log:
Manual update -- including Speex-specific jitter buffer
Modified: trunk/speex/COPYING
===================================================================
--- trunk/speex/COPYING 2007-10-14 15:43:16 UTC (rev 13980)
+++ trunk/speex/COPYING 2007-10-14 15:43:33 UTC (rev 13981)
@@ -1,7 +1,8 @@
Copyright 2002-2007 Xiph.org Foundation
Copyright 2002-2007 Jean-Marc Valin
Copyright 2005-2007 Analog Devices Inc.
-Copyright 2005-2007 Commonwealth Scientific and Industrial Research Organisation (CSIRO)
+Copyright 2005-2007 Commonwealth Scientific and Industrial Research
+ Organisation (CSIRO)
Copyright 1993, 2002, 2006 David Rowe
Copyright 2003 EpicGames
Copyright 1992-1994 Jutta Degener, Carsten Bormann
Modified: trunk/speex/configure.ac
===================================================================
--- trunk/speex/configure.ac 2007-10-14 15:43:16 UTC (rev 13980)
+++ trunk/speex/configure.ac 2007-10-14 15:43:33 UTC (rev 13981)
@@ -10,7 +10,7 @@
SPEEX_EXTRA_VERSION=-git
#SPEEX_VERSION=
#SPEEX_VERSION=$SPEEX_MAJOR_VERSION.$SPEEX_MINOR_VERSION.$SPEEX_MICRO_VERSION$SPEEX_EXTRA_VERSION
-SPEEX_VERSION="1.2beta2"
+SPEEX_VERSION="1.2beta3"
SPEEX_LT_CURRENT=5
SPEEX_LT_REVISION=0
Modified: trunk/speex/doc/manual.lyx
===================================================================
--- trunk/speex/doc/manual.lyx 2007-10-14 15:43:16 UTC (rev 13980)
+++ trunk/speex/doc/manual.lyx 2007-10-14 15:43:33 UTC (rev 13981)
@@ -9660,6 +9660,25 @@
\end_layout
\begin_layout Chapter
+Jitter Buffer for Speex
+\end_layout
+
+\begin_layout Standard
+\begin_inset Include \lstinputlisting{speex_jitter_buffer.c}[caption={Example of using the jitter buffer for Speex packets},label={example-speex-jitter},numbers=left,numberstyle={\footnotesize}]
+preview false
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+
+\newpage
+
+\end_layout
+
+\begin_layout Chapter
IETF RTP Profile
\begin_inset LatexCommand label
name "sec:IETF-draft"
@@ -9695,40 +9714,16 @@
\end_layout
\begin_layout Standard
-Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-\end_layout
+\begin_inset Include \verbatiminput{/home/jm/dsp/speex/COPYING}
+preview false
-\begin_layout Itemize
-Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-\end_layout
+\end_inset
-\begin_layout Itemize
-Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-\end_layout
-\begin_layout Itemize
-Neither the name of the Xiph.org Foundation nor the names of its contributors
- may be used to endorse or promote products derived from this software without
- specific prior written permission.
\end_layout
\begin_layout Standard
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
- IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
\end_layout
\begin_layout Standard
Added: trunk/speex/speexclient/speex_jitter_buffer.c
===================================================================
--- trunk/speex/speexclient/speex_jitter_buffer.c (rev 0)
+++ trunk/speex/speexclient/speex_jitter_buffer.c 2007-10-14 15:43:33 UTC (rev 13981)
@@ -0,0 +1,85 @@
+#include <speex/speex_jitter.h>
+
+
+void speex_jitter_init(SpeexJitter *jitter, void *decoder, int sampling_rate)
+{
+ jitter->dec = decoder;
+ speex_decoder_ctl(decoder, SPEEX_GET_FRAME_SIZE, &jitter->frame_size);
+
+ jitter->packets = jitter_buffer_init(jitter->frame_size);
+
+ speex_bits_init(&jitter->current_packet);
+ jitter->valid_bits = 0;
+
+}
+
+void speex_jitter_destroy(SpeexJitter *jitter)
+{
+ jitter_buffer_destroy(jitter->packets);
+ speex_bits_destroy(&jitter->current_packet);
+}
+
+void speex_jitter_put(SpeexJitter *jitter, char *packet, int len, int timestamp)
+{
+ JitterBufferPacket p;
+ p.data = packet;
+ p.len = len;
+ p.timestamp = timestamp;
+ p.span = jitter->frame_size;
+ jitter_buffer_put(jitter->packets, &p);
+}
+
+void speex_jitter_get(SpeexJitter *jitter, spx_int16_t *out, int *current_timestamp)
+{
+ int i;
+ int ret;
+ spx_int32_t activity;
+ char data[2048];
+ JitterBufferPacket packet;
+ packet.data = data;
+
+ if (jitter->valid_bits)
+ {
+ /* Try decoding last received packet */
+ ret = speex_decode_int(jitter->dec, &jitter->current_packet, out);
+ if (ret == 0)
+ {
+ jitter_buffer_tick(jitter->packets);
+ return;
+ } else {
+ jitter->valid_bits = 0;
+ }
+ }
+
+ ret = jitter_buffer_get(jitter->packets, &packet, NULL);
+
+ if (ret != JITTER_BUFFER_OK)
+ {
+ /* No packet found */
+
+ /*fprintf (stderr, "lost/late frame\n");*/
+ /*Packet is late or lost*/
+ speex_decode_int(jitter->dec, NULL, out);
+ } else {
+ speex_bits_read_from(&jitter->current_packet, packet.data, packet.len);
+ /* Decode packet */
+ ret = speex_decode_int(jitter->dec, &jitter->current_packet, out);
+ if (ret == 0)
+ {
+ jitter->valid_bits = 1;
+ } else {
+ /* Error while decoding */
+ for (i=0;i<jitter->frame_size;i++)
+ out[i]=0;
+ }
+ }
+ 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);
+}
+
+int speex_jitter_get_pointer_timestamp(SpeexJitter *jitter)
+{
+ return jitter_buffer_get_pointer_timestamp(jitter->packets);
+}
More information about the commits
mailing list