Go to the source code of this file.
Data Structures | |
struct | jb_conf |
struct | jb_frame |
struct | jb_info |
struct | jitterbuf |
Defines | |
#define | JB_ADJUST_DELAY 40 |
#define | JB_DROP 4 |
#define | JB_EMPTY 1 |
#define | JB_HISTORY_DROPPCT 3 |
#define | JB_HISTORY_DROPPCT_MAX 4 |
#define | JB_HISTORY_MAXBUF_SZ JB_HISTORY_SZ * JB_HISTORY_DROPPCT_MAX / 100 |
#define | JB_HISTORY_SZ 500 |
#define | JB_INTERP 3 |
#define | JB_NOFRAME 2 |
#define | JB_OK 0 |
#define | JB_SCHED 5 |
#define | JB_TARGET_EXTRA 40 |
#define | JB_TYPE_CONTROL 0 |
#define | JB_TYPE_SILENCE 3 |
#define | JB_TYPE_VIDEO 2 |
#define | JB_TYPE_VOICE 1 |
Typedefs | |
typedef jb_conf | jb_conf |
typedef jb_frame | jb_frame |
typedef jb_info | jb_info |
typedef void(* | jb_output_function_t )(const char *fmt,...) |
typedef jitterbuf | jitterbuf |
Functions | |
void | jb_destroy (jitterbuf *jb) |
int | jb_get (jitterbuf *jb, jb_frame *frame, long now, long interpl) |
int | jb_getall (jitterbuf *jb, jb_frame *frameout) |
int | jb_getinfo (jitterbuf *jb, jb_info *stats) |
jitterbuf * | jb_new (void) |
long | jb_next (jitterbuf *jb) |
int | jb_put (jitterbuf *jb, void *data, int type, long ms, long ts, long now) |
void | jb_reset (jitterbuf *jb) |
int | jb_setconf (jitterbuf *jb, jb_conf *conf) |
void | jb_setoutput (jb_output_function_t err, jb_output_function_t warn, jb_output_function_t dbg) |
|
Definition at line 36 of file jitterbuf.h. |
|
Definition at line 44 of file jitterbuf.h. Referenced by get_from_jb(). |
|
Definition at line 41 of file jitterbuf.h. Referenced by get_from_jb(). |
|
Definition at line 28 of file jitterbuf.h. Referenced by history_get(). |
|
Definition at line 30 of file jitterbuf.h. |
|
Definition at line 32 of file jitterbuf.h. Referenced by history_calc_maxbuf(), history_get(), and history_put(). |
|
Definition at line 25 of file jitterbuf.h. |
|
Definition at line 43 of file jitterbuf.h. Referenced by get_from_jb(). |
|
Definition at line 42 of file jitterbuf.h. Referenced by get_from_jb(). |
|
Definition at line 40 of file jitterbuf.h. Referenced by get_from_jb(). |
|
Definition at line 45 of file jitterbuf.h. |
|
Definition at line 34 of file jitterbuf.h. Referenced by _jb_get(). |
|
Definition at line 48 of file jitterbuf.h. |
|
Definition at line 51 of file jitterbuf.h. |
|
Definition at line 50 of file jitterbuf.h. |
|
Definition at line 49 of file jitterbuf.h. |
|
|
|
|
|
|
|
Definition at line 152 of file jitterbuf.h. |
|
|
|
Definition at line 99 of file jitterbuf.c. References free, jitterbuf::free, jb_dbg2, and jb_frame::next. Referenced by iax2_destroy(). 00100 { 00101 jb_frame *frame; 00102 jb_dbg2("jb_destroy(%x)\n", jb); 00103 00104 /* free all the frames on the "free list" */ 00105 frame = jb->free; 00106 while (frame != NULL) { 00107 jb_frame *next = frame->next; 00108 free(frame); 00109 frame = next; 00110 } 00111 00112 /* free ourselves! */ 00113 free(jb); 00114 }
|
|
Definition at line 778 of file jitterbuf.c. References _jb_get(), jitterbuf::info, jb_warn, jb_info::last_voice_ms, jb_frame::ms, and jb_frame::ts. Referenced by get_from_jb(). 00779 { 00780 int ret = _jb_get(jb,frameout,now,interpl); 00781 #if 0 00782 static int lastts=0; 00783 int thists = ((ret == JB_OK) || (ret == JB_DROP)) ? frameout->ts : 0; 00784 jb_warn("jb_get(%x,%x,%ld) = %d (%d)\n", jb, frameout, now, ret, thists); 00785 if (thists && thists < lastts) jb_warn("XXXX timestamp roll-back!!!\n"); 00786 lastts = thists; 00787 #endif 00788 if(ret == JB_INTERP) 00789 frameout->ms = jb->info.last_voice_ms; 00790 00791 return ret; 00792 }
|
|
Definition at line 794 of file jitterbuf.c. References queue_getall(). Referenced by complete_transfer(), iax2_destroy(), and schedule_delivery(). 00795 { 00796 jb_frame *frame; 00797 frame = queue_getall(jb); 00798 00799 if (!frame) { 00800 return JB_NOFRAME; 00801 } 00802 00803 *frameout = *frame; 00804 return JB_OK; 00805 }
|
|
Definition at line 808 of file jitterbuf.c. References history_get(), and jitterbuf::info. Referenced by ast_cli_netstats(), construct_rr(), and iax2_show_channels(). 00809 { 00810 00811 history_get(jb); 00812 00813 *stats = jb->info; 00814 00815 return JB_OK; 00816 }
|
|
Definition at line 84 of file jitterbuf.c. References jb_dbg2, jb_reset(), and malloc. Referenced by new_iax(). 00085 { 00086 jitterbuf *jb; 00087 00088 00089 jb = malloc(sizeof(jitterbuf)); 00090 if (!jb) 00091 return NULL; 00092 00093 jb_reset(jb); 00094 00095 jb_dbg2("jb_new() = %x\n", jb); 00096 return jb; 00097 }
|
|
Definition at line 760 of file jitterbuf.c. References jb_info::current, history_get(), jitterbuf::info, jb_info::last_adjustment, jb_info::next_voice_ts, queue_next(), jb_info::silence_begin_ts, and jb_info::target. Referenced by get_from_jb(), and update_jbsched(). 00761 { 00762 if (jb->info.silence_begin_ts) { 00763 long next = queue_next(jb); 00764 if (next > 0) { 00765 history_get(jb); 00766 /* shrink during silence */ 00767 if (jb->info.target - jb->info.current < -JB_TARGET_EXTRA) 00768 return jb->info.last_adjustment + 10; 00769 return next + jb->info.target; 00770 } 00771 else 00772 return JB_LONGMAX; 00773 } else { 00774 return jb->info.next_voice_ts; 00775 } 00776 }
|
|
Definition at line 517 of file jitterbuf.c. References jb_info::frames_in, history_put(), jitterbuf::info, jb_dbg2, queue_put(), and type. Referenced by schedule_delivery(). 00518 { 00519 jb_dbg2("jb_put(%x,%x,%ld,%ld,%ld)\n", jb, data, ms, ts, now); 00520 00521 jb->info.frames_in++; 00522 00523 if (type == JB_TYPE_VOICE) { 00524 /* presently, I'm only adding VOICE frames to history and drift calculations; mostly because with the 00525 * IAX integrations, I'm sending retransmitted control frames with their awkward timestamps through */ 00526 if (history_put(jb,ts,now,ms)) 00527 return JB_DROP; 00528 } 00529 00530 /* if put into head of queue, caller needs to reschedule */ 00531 if (queue_put(jb,data,type,ms,ts)) { 00532 return JB_SCHED; 00533 } 00534 return JB_OK; 00535 }
|
|
Definition at line 72 of file jitterbuf.c. References jb_info::conf, jb_info::current, jitterbuf::info, s, jb_info::silence_begin_ts, and jb_info::target. Referenced by complete_transfer(), jb_new(), and schedule_delivery(). 00073 { 00074 /* only save settings */ 00075 jb_conf s = jb->info.conf; 00076 memset(jb,0,sizeof(jitterbuf)); 00077 jb->info.conf = s; 00078 00079 /* initialize length */ 00080 jb->info.current = jb->info.target = JB_TARGET_EXTRA; 00081 jb->info.silence_begin_ts = -1; 00082 }
|
|
Definition at line 818 of file jitterbuf.c. References jb_info::conf, jitterbuf::info, jb_conf::max_contig_interp, jb_conf::max_jitterbuf, and jb_conf::resync_threshold. Referenced by new_iax(). 00819 { 00820 /* take selected settings from the struct */ 00821 00822 jb->info.conf.max_jitterbuf = conf->max_jitterbuf; 00823 jb->info.conf.resync_threshold = conf->resync_threshold; 00824 jb->info.conf.max_contig_interp = conf->max_contig_interp; 00825 00826 return JB_OK; 00827 }
|
|
Definition at line 55 of file jitterbuf.c. References dbgf, errf, and warnf. Referenced by iax2_do_jb_debug(), iax2_no_jb_debug(), and load_module().
|