jitterbuf: an application-independent jitterbuffer More...
Go to the source code of this file.
Macros | |
#define | jb_dbg(...) (dbgf ? dbgf(__VA_ARGS__) : (void)0) |
#define | jb_dbg2(...) ((void)0) |
#define | jb_err(...) (errf ? errf(__VA_ARGS__) : (void)0) |
#define | JB_LONGMAX 2147483647L |
#define | JB_LONGMIN (-JB_LONGMAX - 1L) |
#define | jb_warn(...) (warnf ? warnf(__VA_ARGS__) : (void)0) |
Functions | |
static enum jb_return_code | _jb_get (jitterbuf *jb, jb_frame *frameout, long now, long interpl) |
static jb_frame * | _queue_get (jitterbuf *jb, long ts, int all) |
static int | check_resync (jitterbuf *jb, long ts, long now, long ms, const enum jb_frame_type type, long *delay) |
static void | decrement_losspct (jitterbuf *jb) |
static void | history_calc_maxbuf (jitterbuf *jb) |
static void | history_get (jitterbuf *jb) |
static int | history_put (jitterbuf *jb, long ts, long now, long ms, long delay) |
static void | increment_losspct (jitterbuf *jb) |
void | jb_destroy (jitterbuf *jb) |
destroy jitterbuf More... | |
enum jb_return_code | jb_get (jitterbuf *jb, jb_frame *frameout, long now, long interpl) |
get a frame for time now (receiver's time) return value is one of JB_OK: You've got frame! JB_DROP: Here's an audio frame you should just drop. Ask me again for this time.. JB_NOFRAME: There's no frame scheduled for this time. JB_INTERP: Please interpolate an interpl-length frame for this time (either we need to grow, or there was a lost frame) JB_EMPTY: The jb is empty. More... | |
enum jb_return_code | jb_getall (jitterbuf *jb, jb_frame *frameout) |
unconditionally get frames from jitterbuf until empty More... | |
enum jb_return_code | jb_getinfo (jitterbuf *jb, jb_info *stats) |
get jitterbuf info: only "statistics" may be valid More... | |
jitterbuf * | jb_new () |
new jitterbuf More... | |
long | jb_next (jitterbuf *jb) |
when is the next frame due out, in receiver's time (0=EMPTY) This value may change as frames are added (esp non-audio frames) More... | |
enum jb_return_code | jb_put (jitterbuf *jb, void *data, const enum jb_frame_type type, long ms, long ts, long now) |
queue a frame More... | |
void | jb_reset (jitterbuf *jb) |
reset jitterbuf More... | |
enum jb_return_code | jb_setconf (jitterbuf *jb, jb_conf *conf) |
set jitterbuf conf More... | |
void | jb_setoutput (jb_output_function_t err, jb_output_function_t warn, jb_output_function_t dbg) |
static jb_frame * | queue_get (jitterbuf *jb, long ts) |
static jb_frame * | queue_getall (jitterbuf *jb) |
static long | queue_last (jitterbuf *jb) |
static long | queue_next (jitterbuf *jb) |
static int | queue_put (jitterbuf *jb, void *data, const enum jb_frame_type type, long ms, long ts) |
Variables | |
static jb_output_function_t | dbgf |
static jb_output_function_t | errf |
static jb_output_function_t | warnf |
jitterbuf: an application-independent jitterbuffer
Definition in file jitterbuf.c.
Definition at line 47 of file jitterbuf.c.
Referenced by _jb_get().
#define jb_dbg2 | ( | ... | ) | ((void)0) |
Definition at line 52 of file jitterbuf.c.
Referenced by jb_destroy(), jb_new(), and jb_put().
Definition at line 46 of file jitterbuf.c.
Referenced by queue_put().
#define JB_LONGMAX 2147483647L |
define these here, just for ancient compiler systems
Definition at line 42 of file jitterbuf.c.
Referenced by history_calc_maxbuf(), and jb_next().
#define JB_LONGMIN (-JB_LONGMAX - 1L) |
Definition at line 43 of file jitterbuf.c.
Referenced by history_calc_maxbuf().
Definition at line 45 of file jitterbuf.c.
Referenced by check_resync(), and jb_get().
|
static |
Definition at line 552 of file jitterbuf.c.
References jb_info::cnt_contig_interp, jb_info::conf, jb_info::current, decrement_losspct(), jb_info::frames_dropped, jb_info::frames_late, jb_info::frames_lost, jb_info::frames_out, history_get(), increment_losspct(), jitterbuf::info, JB_ADJUST_DELAY, jb_dbg, JB_DROP, JB_INTERP, JB_NOFRAME, JB_OK, JB_TYPE_SILENCE, JB_TYPE_VOICE, jb_info::jitter, jb_info::last_adjustment, jb_info::last_voice_ms, jb_conf::max_contig_interp, jb_conf::max_jitterbuf, jb_info::min, jb_frame::ms, jb_info::next_voice_ts, queue_get(), queue_last(), queue_next(), jb_info::silence_begin_ts, jb_info::target, jb_conf::target_extra, jb_frame::ts, and jb_frame::type.
Referenced by jb_get().
Definition at line 416 of file jitterbuf.c.
References jitterbuf::frames, jb_info::frames_cur, jitterbuf::free, jitterbuf::info, jb_frame::next, jb_frame::prev, and jb_frame::ts.
Referenced by queue_get(), and queue_getall().
|
static |
Definition at line 118 of file jitterbuf.c.
References ast_debug, jb_info::cnt_delay_discont, jb_info::conf, jitterbuf::dropem, jitterbuf::frames, jb_info::frames_dropped, jitterbuf::hist_maxbuf_valid, jitterbuf::hist_ptr, jitterbuf::info, JB_TYPE_CONTROL, jb_warn, jb_info::jitter, jb_info::last_delay, jb_conf::max_jitterbuf, jb_frame::prev, jb_info::resync_offset, jb_conf::resync_threshold, and jb_frame::ts.
Referenced by jb_put().
|
static |
Definition at line 69 of file jitterbuf.c.
References jitterbuf::info, and jb_info::losspct.
Referenced by _jb_get().
|
static |
Definition at line 216 of file jitterbuf.c.
References jitterbuf::hist_maxbuf, jitterbuf::hist_maxbuf_valid, jitterbuf::hist_minbuf, jitterbuf::hist_ptr, jitterbuf::history, JB_HISTORY_MAXBUF_SZ, JB_HISTORY_SZ, JB_LONGMAX, and JB_LONGMIN.
Referenced by history_get().
|
static |
Definition at line 297 of file jitterbuf.c.
References jitterbuf::hist_maxbuf, jitterbuf::hist_maxbuf_valid, jitterbuf::hist_minbuf, jitterbuf::hist_ptr, history_calc_maxbuf(), if(), jitterbuf::info, JB_HISTORY_DROPPCT, JB_HISTORY_MAXBUF_SZ, JB_HISTORY_SZ, jb_info::jitter, and jb_info::min.
Referenced by _jb_get(), jb_getinfo(), and jb_next().
|
static |
Definition at line 165 of file jitterbuf.c.
References jitterbuf::hist_maxbuf, jitterbuf::hist_maxbuf_valid, jitterbuf::hist_ptr, jitterbuf::history, JB_HISTORY_MAXBUF_SZ, and JB_HISTORY_SZ.
Referenced by jb_put().
|
static |
Definition at line 64 of file jitterbuf.c.
References jitterbuf::info, and jb_info::losspct.
Referenced by _jb_get().
void jb_destroy | ( | jitterbuf * | jb | ) |
destroy jitterbuf
Definition at line 101 of file jitterbuf.c.
References ast_free, jitterbuf::free, jb_dbg2, and jb_frame::next.
Referenced by jb_destroy_adaptive(), and pvt_destructor().
enum jb_return_code jb_get | ( | jitterbuf * | jb, |
jb_frame * | frameout, | ||
long | now, | ||
long | interpl | ||
) |
get a frame for time now (receiver's time) return value is one of JB_OK: You've got frame! JB_DROP: Here's an audio frame you should just drop. Ask me again for this time.. JB_NOFRAME: There's no frame scheduled for this time. JB_INTERP: Please interpolate an interpl-length frame for this time (either we need to grow, or there was a lost frame) JB_EMPTY: The jb is empty.
Definition at line 787 of file jitterbuf.c.
References _jb_get(), jitterbuf::info, JB_DROP, JB_INTERP, JB_OK, jb_warn, jb_info::last_voice_ms, jb_frame::ms, and jb_frame::ts.
Referenced by __get_from_jb(), and jb_get_adaptive().
enum jb_return_code jb_getall | ( | jitterbuf * | jb, |
jb_frame * | frameout | ||
) |
unconditionally get frames from jitterbuf until empty
Definition at line 803 of file jitterbuf.c.
References JB_NOFRAME, JB_OK, and queue_getall().
Referenced by complete_transfer(), jb_empty_and_reset_adaptive(), jb_remove_adaptive(), pvt_destructor(), and schedule_delivery().
enum jb_return_code jb_getinfo | ( | jitterbuf * | jb, |
jb_info * | stats | ||
) |
get jitterbuf info: only "statistics" may be valid
Definition at line 817 of file jitterbuf.c.
References history_get(), jitterbuf::info, and JB_OK.
Referenced by ast_cli_netstats(), construct_rr(), handle_cli_iax2_show_channels(), and log_jitterstats().
jitterbuf* jb_new | ( | void | ) |
new jitterbuf
Definition at line 88 of file jitterbuf.c.
References ast_calloc, jb_dbg2, and jb_reset().
Referenced by jb_create_adaptive(), and new_iax().
long jb_next | ( | jitterbuf * | jb | ) |
when is the next frame due out, in receiver's time (0=EMPTY) This value may change as frames are added (esp non-audio frames)
Definition at line 769 of file jitterbuf.c.
References jb_info::conf, jb_info::current, jitterbuf::frames, history_get(), jitterbuf::info, JB_LONGMAX, jb_info::last_adjustment, jb_info::next_voice_ts, queue_next(), jb_info::silence_begin_ts, jb_info::target, and jb_conf::target_extra.
Referenced by __get_from_jb(), jb_next_adaptive(), and update_jbsched().
enum jb_return_code jb_put | ( | jitterbuf * | jb, |
void * | data, | ||
const enum jb_frame_type | type, | ||
long | ms, | ||
long | ts, | ||
long | now | ||
) |
queue a frame
data=frame data, timings (in ms): ms=length of frame (for voice), ts=ts (sender's time) now=now (in receiver's time) return value is one of JB_OK: Frame added. Last call to jb_next() still valid JB_DROP: Drop this frame immediately JB_SCHED: Frame added. Call jb_next() to get a new time for the next frame
Definition at line 527 of file jitterbuf.c.
References check_resync(), jb_info::frames_in, history_put(), jitterbuf::info, jb_dbg2, JB_DROP, JB_OK, JB_SCHED, JB_TYPE_VOICE, queue_put(), and jb_info::resync_offset.
Referenced by jb_put_adaptive(), and schedule_delivery().
void jb_reset | ( | jitterbuf * | jb | ) |
reset jitterbuf
Definition at line 74 of file jitterbuf.c.
References jb_info::conf, jb_info::current, jitterbuf::free, jitterbuf::info, JB_TARGET_EXTRA, jb_info::silence_begin_ts, jb_info::target, and jb_conf::target_extra.
Referenced by complete_transfer(), jb_empty_and_reset_adaptive(), jb_new(), and schedule_delivery().
enum jb_return_code jb_setconf | ( | jitterbuf * | jb, |
jb_conf * | conf | ||
) |
set jitterbuf conf
Definition at line 827 of file jitterbuf.c.
References jb_info::conf, jb_info::current, jitterbuf::info, JB_OK, JB_TARGET_EXTRA, jb_conf::max_contig_interp, jb_conf::max_jitterbuf, jb_conf::resync_threshold, jb_info::target, and jb_conf::target_extra.
Referenced by jb_create_adaptive(), and new_iax().
void jb_setoutput | ( | jb_output_function_t | err, |
jb_output_function_t | warn, | ||
jb_output_function_t | dbg | ||
) |
Definition at line 57 of file jitterbuf.c.
Referenced by handle_cli_iax2_set_debug_jb(), and load_module().
|
static |
Definition at line 408 of file jitterbuf.c.
References jitterbuf::frames, jb_frame::prev, and jb_frame::ts.
Referenced by _jb_get().
|
static |
Definition at line 400 of file jitterbuf.c.
References jitterbuf::frames, and jb_frame::ts.
Referenced by _jb_get(), and jb_next().
|
static |
Definition at line 339 of file jitterbuf.c.
References ast_malloc, jb_frame::data, frames, jitterbuf::frames, jb_info::frames_cur, jb_info::frames_ooo, jitterbuf::free, jitterbuf::info, jb_err, jb_frame::ms, jb_frame::next, jb_frame::prev, jb_info::resync_offset, jb_frame::ts, type, and jb_frame::type.
Referenced by jb_put().
|
static |
Definition at line 55 of file jitterbuf.c.
|
static |
Definition at line 55 of file jitterbuf.c.
|
static |
Definition at line 55 of file jitterbuf.c.