summaryrefslogtreecommitdiffstats
path: root/apps/codecs/libspeex/jitter.c
diff options
context:
space:
mode:
authorDan Everton <dan@iocaine.org>2007-05-22 09:50:31 +0000
committerDan Everton <dan@iocaine.org>2007-05-22 09:50:31 +0000
commitdf6f2f9a3c88a7a4a8ad0382ee4ee7c9a3ee3256 (patch)
treed9862e5d04f4014def5911bb4ff8206c85636fb7 /apps/codecs/libspeex/jitter.c
parent8970055ec107a2387eedbb373889d0f540745121 (diff)
downloadrockbox-df6f2f9a3c88a7a4a8ad0382ee4ee7c9a3ee3256.tar.gz
rockbox-df6f2f9a3c88a7a4a8ad0382ee4ee7c9a3ee3256.zip
Upgrade to libspeex 1.2beta2. Very minor performance increase (0.6% on coldfire).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13461 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libspeex/jitter.c')
-rw-r--r--apps/codecs/libspeex/jitter.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/apps/codecs/libspeex/jitter.c b/apps/codecs/libspeex/jitter.c
index 02919e2135..81935e9195 100644
--- a/apps/codecs/libspeex/jitter.c
+++ b/apps/codecs/libspeex/jitter.c
@@ -197,7 +197,7 @@ void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet)
/* Adjust the buffer size depending on network conditions.
The arrival margin is how much in advance (or late) the packet it */
- arrival_margin = (packet->timestamp - jitter->current_timestamp)/jitter->tick_size - jitter->buffer_margin;
+ arrival_margin = (((spx_int32_t)packet->timestamp) - ((spx_int32_t)jitter->current_timestamp))/jitter->tick_size - jitter->buffer_margin;
if (arrival_margin >= -jitter->late_cutoff)
{
@@ -243,7 +243,7 @@ void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet)
}
/** Get one packet from the jitter buffer */
-int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_uint32_t *start_offset)
+int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset)
{
int i;
unsigned int j;
@@ -378,7 +378,7 @@ int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_uint
jitter->buf[i] = NULL;
/* Set timestamp and span (if requested) */
if (start_offset)
- *start_offset = jitter->timestamp[i]-jitter->pointer_timestamp;
+ *start_offset = (spx_int32_t)jitter->timestamp[i]-(spx_int32_t)jitter->pointer_timestamp;
packet->timestamp = jitter->timestamp[i];
packet->span = jitter->span[i];
/* Point at the end of the current packet */
@@ -438,7 +438,7 @@ void jitter_buffer_tick(JitterBuffer *jitter)
}
/* Let the jitter buffer know it's the right time to adjust the buffering delay to the network conditions */
-int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_uint32_t *start_offset)
+int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset)
{
int i;
float late_ratio_short;
@@ -579,6 +579,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;
@@ -618,7 +619,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);
}