[Asterisk-cvs] asterisk jitterbuf.c,1.17,1.18 jitterbuf.h,1.7,1.8
kpfleming at lists.digium.com
kpfleming at lists.digium.com
Mon Jun 20 21:19:21 CDT 2005
Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv2508
Modified Files:
jitterbuf.c jitterbuf.h
Log Message:
control maximum number of interpolation frames generated during silence by jitterbuffer (bug #4295)
Index: jitterbuf.c
===================================================================
RCS file: /usr/cvsroot/asterisk/jitterbuf.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- jitterbuf.c 21 Jun 2005 01:02:07 -0000 1.17
+++ jitterbuf.c 21 Jun 2005 01:20:14 -0000 1.18
@@ -564,6 +564,10 @@
jb->info.next_voice_ts += interpl;
jb->info.last_voice_ms = interpl;
jb->info.last_adjustment = now;
+ jb->info.cnt_contig_interp++;
+ if (jb->info.conf.max_contig_interp && jb->info.cnt_contig_interp >= jb->info.conf.max_contig_interp) {
+ jb->info.silence_begin_ts = jb->info.next_voice_ts - jb->info.current;
+ }
jb_dbg("G");
return JB_INTERP;
}
@@ -572,8 +576,10 @@
/* not a voice frame; just return it. */
if (frame && frame->type != JB_TYPE_VOICE) {
- if (frame->type == JB_TYPE_SILENCE)
+ if (frame->type == JB_TYPE_SILENCE) {
jb->info.silence_begin_ts = frame->ts;
+ jb->info.cnt_contig_interp = 0;
+ }
*frameout = *frame;
jb->info.frames_out++;
@@ -592,6 +598,7 @@
jb->info.next_voice_ts = frame->ts + jb->info.current + frame->ms;
jb->info.frames_out++;
decrement_losspct(jb);
+ jb->info.cnt_contig_interp = 0;
jb_dbg("v");
return JB_OK;
} else {
@@ -622,6 +629,7 @@
(jb->info.last_adjustment + 500 < now))) {
jb->info.last_adjustment = now;
+ jb->info.cnt_contig_interp = 0;
if (frame) {
*frameout = *frame;
@@ -669,6 +677,10 @@
increment_losspct(jb);
jb->info.next_voice_ts += interpl;
jb->info.last_voice_ms = interpl;
+ jb->info.cnt_contig_interp++;
+ if (jb->info.conf.max_contig_interp && jb->info.cnt_contig_interp >= jb->info.conf.max_contig_interp) {
+ jb->info.silence_begin_ts = jb->info.next_voice_ts - jb->info.current;
+ }
jb_dbg("L");
return JB_INTERP;
}
@@ -677,6 +689,7 @@
*frameout = *frame;
jb->info.next_voice_ts += frame->ms;
jb->info.frames_out++;
+ jb->info.cnt_contig_interp = 0;
decrement_losspct(jb);
jb_dbg("v");
return JB_OK;
@@ -795,6 +808,7 @@
jb->info.conf.max_jitterbuf = conf->max_jitterbuf;
jb->info.conf.resync_threshold = conf->resync_threshold;
+ jb->info.conf.max_contig_interp = conf->max_contig_interp;
return JB_OK;
}
Index: jitterbuf.h
===================================================================
RCS file: /usr/cvsroot/asterisk/jitterbuf.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- jitterbuf.h 2 Jun 2005 17:45:38 -0000 1.7
+++ jitterbuf.h 21 Jun 2005 01:20:14 -0000 1.8
@@ -55,6 +55,7 @@
/* settings */
long max_jitterbuf; /* defines a hard clamp to use in setting the jitter buffer delay */
long resync_threshold; /* the jb will resync when delay increases to (2 * jitter) + this param */
+ long max_contig_interp; /* the max interp frames to return in a row */
} jb_conf;
typedef struct jb_info {
@@ -80,6 +81,7 @@
long last_delay; /* the last now added to history */
long cnt_delay_discont; /* the count of discontinuous delays */
long resync_offset; /* the amount to offset ts to support resyncs */
+ long cnt_contig_interp; /* the number of contiguous interp frames returned */
} jb_info;
typedef struct jb_frame {
More information about the svn-commits
mailing list