diff options
Diffstat (limited to 'apps/codecs/libspeex/jitter.c')
-rw-r--r-- | apps/codecs/libspeex/jitter.c | 13 |
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) | |||
197 | 197 | ||
198 | /* Adjust the buffer size depending on network conditions. | 198 | /* Adjust the buffer size depending on network conditions. |
199 | The arrival margin is how much in advance (or late) the packet it */ | 199 | The arrival margin is how much in advance (or late) the packet it */ |
200 | arrival_margin = (packet->timestamp - jitter->current_timestamp)/jitter->tick_size - jitter->buffer_margin; | 200 | arrival_margin = (((spx_int32_t)packet->timestamp) - ((spx_int32_t)jitter->current_timestamp))/jitter->tick_size - jitter->buffer_margin; |
201 | 201 | ||
202 | if (arrival_margin >= -jitter->late_cutoff) | 202 | if (arrival_margin >= -jitter->late_cutoff) |
203 | { | 203 | { |
@@ -243,7 +243,7 @@ void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet) | |||
243 | } | 243 | } |
244 | 244 | ||
245 | /** Get one packet from the jitter buffer */ | 245 | /** Get one packet from the jitter buffer */ |
246 | int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_uint32_t *start_offset) | 246 | int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset) |
247 | { | 247 | { |
248 | int i; | 248 | int i; |
249 | unsigned int j; | 249 | unsigned int j; |
@@ -378,7 +378,7 @@ int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_uint | |||
378 | jitter->buf[i] = NULL; | 378 | jitter->buf[i] = NULL; |
379 | /* Set timestamp and span (if requested) */ | 379 | /* Set timestamp and span (if requested) */ |
380 | if (start_offset) | 380 | if (start_offset) |
381 | *start_offset = jitter->timestamp[i]-jitter->pointer_timestamp; | 381 | *start_offset = (spx_int32_t)jitter->timestamp[i]-(spx_int32_t)jitter->pointer_timestamp; |
382 | packet->timestamp = jitter->timestamp[i]; | 382 | packet->timestamp = jitter->timestamp[i]; |
383 | packet->span = jitter->span[i]; | 383 | packet->span = jitter->span[i]; |
384 | /* Point at the end of the current packet */ | 384 | /* Point at the end of the current packet */ |
@@ -438,7 +438,7 @@ void jitter_buffer_tick(JitterBuffer *jitter) | |||
438 | } | 438 | } |
439 | 439 | ||
440 | /* Let the jitter buffer know it's the right time to adjust the buffering delay to the network conditions */ | 440 | /* Let the jitter buffer know it's the right time to adjust the buffering delay to the network conditions */ |
441 | int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_uint32_t *start_offset) | 441 | int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset) |
442 | { | 442 | { |
443 | int i; | 443 | int i; |
444 | float late_ratio_short; | 444 | float late_ratio_short; |
@@ -579,6 +579,7 @@ void speex_jitter_get(SpeexJitter *jitter, short *out, int *current_timestamp) | |||
579 | { | 579 | { |
580 | int i; | 580 | int i; |
581 | int ret; | 581 | int ret; |
582 | spx_int32_t activity; | ||
582 | char data[2048]; | 583 | char data[2048]; |
583 | JitterBufferPacket packet; | 584 | JitterBufferPacket packet; |
584 | packet.data = data; | 585 | packet.data = data; |
@@ -618,7 +619,9 @@ void speex_jitter_get(SpeexJitter *jitter, short *out, int *current_timestamp) | |||
618 | out[i]=0; | 619 | out[i]=0; |
619 | } | 620 | } |
620 | } | 621 | } |
621 | jitter_buffer_update_delay(jitter->packets, &packet, NULL); | 622 | speex_decoder_ctl(jitter->dec, SPEEX_GET_ACTIVITY, &activity); |
623 | if (activity < 30) | ||
624 | jitter_buffer_update_delay(jitter->packets, &packet, NULL); | ||
622 | jitter_buffer_tick(jitter->packets); | 625 | jitter_buffer_tick(jitter->packets); |
623 | } | 626 | } |
624 | 627 | ||