Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
jitterbuf: an application-independent jitterbuffer jitterbuf.c More...
Go to the source code of this file.
Data Structures | |
struct | jb_conf |
struct | jb_frame |
struct | jb_info |
struct | jitterbuf |
Macros | |
configuration constants | |
#define | JB_ADJUST_DELAY 40 |
#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_TARGET_EXTRA 40 |
Typedefs | |
typedef struct jb_conf | jb_conf |
typedef struct jb_frame | jb_frame |
typedef struct jb_info | jb_info |
typedef void(* | jb_output_function_t) (const char *fmt,...) |
typedef struct jitterbuf | jitterbuf |
Enumerations | |
enum | jb_frame_type { JB_TYPE_CONTROL , JB_TYPE_VOICE , JB_TYPE_VIDEO , JB_TYPE_SILENCE } |
enum | jb_return_code { JB_OK , JB_EMPTY , JB_NOFRAME , JB_INTERP , JB_DROP , JB_SCHED } |
Functions | |
void | jb_destroy (jitterbuf *jb) |
destroy jitterbuf More... | |
enum jb_return_code | jb_get (jitterbuf *jb, jb_frame *frame, 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... | |
int | jb_is_late (jitterbuf *jb, long ts) |
Checks if the given time stamp is late. More... | |
jitterbuf * | jb_new (void) |
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) |
jitterbuf: an application-independent jitterbuffer jitterbuf.c
Definition in file jitterbuf.h.
#define JB_ADJUST_DELAY 40 |
ms between growing and shrinking; may not be honored if jitterbuffer runs out of space
Definition at line 45 of file jitterbuf.h.
#define JB_HISTORY_DROPPCT 3 |
what percentage of timestamps should we drop from the history when we examine it; this might eventually be something made configurable
Definition at line 37 of file jitterbuf.h.
#define JB_HISTORY_DROPPCT_MAX 4 |
the maximum droppct we can handle (say it was configurable).
Definition at line 39 of file jitterbuf.h.
#define JB_HISTORY_MAXBUF_SZ JB_HISTORY_SZ * JB_HISTORY_DROPPCT_MAX / 100 |
the size of the buffer we use to keep the top and botton timestamps for dropping
Definition at line 41 of file jitterbuf.h.
#define JB_HISTORY_SZ 500 |
Number of historical timestamps to use in calculating jitter and drift
Definition at line 34 of file jitterbuf.h.
#define JB_TARGET_EXTRA 40 |
amount of additional jitterbuffer adjustment
Definition at line 43 of file jitterbuf.h.
typedef void(* jb_output_function_t) (const char *fmt,...) |
Definition at line 168 of file jitterbuf.h.
enum jb_frame_type |
Enumerator | |
---|---|
JB_TYPE_CONTROL | 0 |
JB_TYPE_VOICE | 1 |
JB_TYPE_VIDEO | 2 - reserved |
JB_TYPE_SILENCE | 3 |
Definition at line 59 of file jitterbuf.h.
enum jb_return_code |
Enumerator | |
---|---|
JB_OK | |
JB_EMPTY | |
JB_NOFRAME | |
JB_INTERP | |
JB_DROP | |
JB_SCHED |
Definition at line 49 of file jitterbuf.h.
void jb_destroy | ( | jitterbuf * | jb | ) |
destroy jitterbuf
Definition at line 99 of file jitterbuf.c.
References ast_free, jitterbuf::free, jb_dbg2, jb_frame::next, and NULL.
Referenced by AST_TEST_DEFINE(), jb_destroy_adaptive(), and pvt_destructor().
enum jb_return_code jb_get | ( | jitterbuf * | jb, |
jb_frame * | frame, | ||
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 785 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(), AST_TEST_DEFINE(), 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 801 of file jitterbuf.c.
References JB_NOFRAME, JB_OK, and queue_getall().
Referenced by AST_TEST_DEFINE(), complete_transfer(), jb_empty_and_reset_adaptive(), jb_remove_adaptive(), and pvt_destructor().
enum jb_return_code jb_getinfo | ( | jitterbuf * | jb, |
jb_info * | stats | ||
) |
get jitterbuf info: only "statistics" may be valid
Definition at line 815 of file jitterbuf.c.
References history_get(), jitterbuf::info, and JB_OK.
Referenced by ast_cli_netstats(), AST_TEST_DEFINE(), construct_rr(), handle_cli_iax2_show_channels(), and log_jitterstats().
int jb_is_late | ( | jitterbuf * | jb, |
long | ts | ||
) |
Checks if the given time stamp is late.
Definition at line 846 of file jitterbuf.c.
References jb_info::current, jitterbuf::info, and jb_info::next_voice_ts.
Referenced by jb_is_late_adaptive().
jitterbuf * jb_new | ( | void | ) |
new jitterbuf
Definition at line 86 of file jitterbuf.c.
References ast_calloc, jb_dbg2, jb_reset(), and NULL.
Referenced by AST_TEST_DEFINE(), 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 767 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(), AST_TEST_DEFINE(), 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 525 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(), jb_info::resync_offset, and type.
Referenced by jb_put_adaptive(), schedule_delivery(), test_jb_late_frame_insertion(), test_jb_lost_frame_insertion(), test_jb_nominal_frame_insertion(), test_jb_out_of_order_frame_insertion(), test_jb_overflow_frame_insertion(), and test_jb_resynch_frame_insertion().
void jb_reset | ( | jitterbuf * | jb | ) |
reset jitterbuf
Definition at line 72 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(), and jb_new().
enum jb_return_code jb_setconf | ( | jitterbuf * | jb, |
jb_conf * | conf | ||
) |
set jitterbuf conf
Definition at line 825 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 AST_TEST_DEFINE(), 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 55 of file jitterbuf.c.
References dbgf, errf, and warnf.
Referenced by handle_cli_iax2_set_debug_jb(), and load_module().