summaryrefslogtreecommitdiffstats
path: root/apps/codecs/libspeex/jitter.c
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2007-10-19 21:10:25 +0000
committerThom Johansen <thomj@rockbox.org>2007-10-19 21:10:25 +0000
commit56db5597548d0e9b9733b556a5c14ab4e38547e6 (patch)
tree8846e7d3a15f264853e6ee238994e3522e3bcc5a /apps/codecs/libspeex/jitter.c
parent6dc3a743addde6146b736ec5e1c71159c2150f95 (diff)
downloadrockbox-56db5597548d0e9b9733b556a5c14ab4e38547e6.tar.gz
rockbox-56db5597548d0e9b9733b556a5c14ab4e38547e6.zip
Sync Speex to SVN. Add new header file to adapt to Speex' new way of doing wrapper functions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15209 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libspeex/jitter.c')
-rw-r--r--apps/codecs/libspeex/jitter.c87
1 files changed, 1 insertions, 86 deletions
diff --git a/apps/codecs/libspeex/jitter.c b/apps/codecs/libspeex/jitter.c
index 81935e9195..6806b4ff22 100644
--- a/apps/codecs/libspeex/jitter.c
+++ b/apps/codecs/libspeex/jitter.c
@@ -133,8 +133,7 @@ void jitter_buffer_destroy(JitterBuffer *jitter)
/** Put one packet into the jitter buffer */
void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet)
{
- int i;
- unsigned int j;
+ int i,j;
spx_int32_t arrival_margin;
/*fprintf (stderr, "put packet %d %d\n", timestamp, span);*/
if (jitter->reset_state)
@@ -545,87 +544,3 @@ int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr)
return 0;
}
-
-
-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, short *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);
-}