Common implementation-independent jitterbuffer stuff. More...
Go to the source code of this file.
Data Structures | |
struct | ast_jb |
General jitterbuffer state. More... | |
struct | ast_jb_conf |
General jitterbuffer configuration. More... | |
Macros | |
#define | AST_JB_CONF_ENABLE "enable" |
#define | AST_JB_CONF_FORCE "force" |
#define | AST_JB_CONF_IMPL "impl" |
#define | AST_JB_CONF_LOG "log" |
#define | AST_JB_CONF_MAX_SIZE "maxsize" |
#define | AST_JB_CONF_PREFIX "jb" |
#define | AST_JB_CONF_RESYNCH_THRESHOLD "resyncthreshold" |
#define | AST_JB_CONF_TARGET_EXTRA "targetextra" |
#define | AST_JB_IMPL_NAME_SIZE 12 |
Enumerations | |
enum | { AST_JB_ENABLED = (1 << 0), AST_JB_FORCED = (1 << 1), AST_JB_LOG = (1 << 2) } |
Functions | |
void | ast_jb_configure (struct ast_channel *chan, const struct ast_jb_conf *conf) |
Configures a jitterbuffer on a channel. More... | |
void | ast_jb_destroy (struct ast_channel *chan) |
Destroys jitterbuffer on a channel. More... | |
int | ast_jb_do_usecheck (struct ast_channel *c0, struct ast_channel *c1) |
Checks the need of a jb use in a generic bridge. More... | |
void | ast_jb_empty_and_reset (struct ast_channel *c0, struct ast_channel *c1) |
drops all frames from a jitterbuffer and resets it More... | |
void | ast_jb_get_and_deliver (struct ast_channel *c0, struct ast_channel *c1) |
Deliver the queued frames that should be delivered now for both channels. More... | |
void | ast_jb_get_config (const struct ast_channel *chan, struct ast_jb_conf *conf) |
Copies a channel's jitterbuffer configuration. More... | |
int | ast_jb_get_when_to_wakeup (struct ast_channel *c0, struct ast_channel *c1, int time_left) |
Calculates the time, left to the closest delivery moment in a bridge. More... | |
int | ast_jb_put (struct ast_channel *chan, struct ast_frame *f) |
Puts a frame into a channel jitterbuffer. More... | |
int | ast_jb_read_conf (struct ast_jb_conf *conf, const char *varname, const char *value) |
Sets jitterbuffer configuration property. More... | |
Common implementation-independent jitterbuffer stuff.
Definition in file abstract_jb.h.
#define AST_JB_CONF_ENABLE "enable" |
Definition at line 72 of file abstract_jb.h.
Referenced by ast_jb_read_conf().
#define AST_JB_CONF_FORCE "force" |
Definition at line 73 of file abstract_jb.h.
Referenced by ast_jb_read_conf().
#define AST_JB_CONF_IMPL "impl" |
Definition at line 77 of file abstract_jb.h.
Referenced by ast_jb_read_conf().
#define AST_JB_CONF_LOG "log" |
Definition at line 78 of file abstract_jb.h.
Referenced by ast_jb_read_conf().
#define AST_JB_CONF_MAX_SIZE "maxsize" |
Definition at line 74 of file abstract_jb.h.
Referenced by ast_jb_read_conf().
#define AST_JB_CONF_PREFIX "jb" |
Definition at line 71 of file abstract_jb.h.
Referenced by ast_jb_read_conf().
#define AST_JB_CONF_RESYNCH_THRESHOLD "resyncthreshold" |
Definition at line 75 of file abstract_jb.h.
Referenced by ast_jb_read_conf().
#define AST_JB_CONF_TARGET_EXTRA "targetextra" |
Definition at line 76 of file abstract_jb.h.
Referenced by ast_jb_read_conf().
#define AST_JB_IMPL_NAME_SIZE 12 |
Definition at line 50 of file abstract_jb.h.
Referenced by create_jb().
anonymous enum |
Enumerator | |
---|---|
AST_JB_ENABLED | |
AST_JB_FORCED | |
AST_JB_LOG |
Definition at line 44 of file abstract_jb.h.
void ast_jb_configure | ( | struct ast_channel * | chan, |
const struct ast_jb_conf * | conf | ||
) |
Configures a jitterbuffer on a channel.
chan | channel to configure. |
conf | configuration to apply. |
Called from a channel driver when a channel is created and its jitterbuffer needs to be configured.
Definition at line 616 of file abstract_jb.c.
References ast_jb::conf, and ast_channel::jb.
Referenced by __oh323_rtp_create(), __oh323_update_info(), alsa_new(), console_new(), dahdi_new(), gtalk_new(), jingle_new(), local_new(), mgcp_new(), misdn_new(), oss_new(), sip_new(), skinny_new(), and unistim_new().
void ast_jb_destroy | ( | struct ast_channel * | chan | ) |
Destroys jitterbuffer on a channel.
chan | channel. |
Called from ast_channel_free() when a channel is destroyed.
Definition at line 536 of file abstract_jb.c.
References ast_clear_flag, ast_frfree, ast_test_flag, ast_verb, ast_jb_impl::destroy, f, ast_jb::impl, ast_channel::jb, JB_CREATED, JB_IMPL_OK, ast_jb::jbobj, ast_jb::logfile, ast_jb_impl::name, ast_channel::name, and ast_jb_impl::remove.
Referenced by ast_channel_destructor().
int ast_jb_do_usecheck | ( | struct ast_channel * | c0, |
struct ast_channel * | c1 | ||
) |
Checks the need of a jb use in a generic bridge.
c0 | first bridged channel. |
c1 | second bridged channel. |
Called from ast_generic_bridge() when two channels are entering in a bridge. The function checks the need of a jitterbuffer, depending on both channel's configuration and technology properties. As a result, this function sets appropriate internal jb flags to the channels, determining further behaviour of the bridged jitterbuffers.
zero | if there are no jitter buffers in use |
non-zero | if there are |
Definition at line 205 of file abstract_jb.c.
References AST_CHAN_TP_CREATESJITTER, AST_CHAN_TP_WANTSJITTER, AST_JB_ENABLED, AST_JB_FORCED, ast_set_flag, ast_test_flag, ast_jb::conf, ast_channel::jb, jb_choose_impl(), JB_CREATED, JB_TIMEBASE_INITIALIZED, JB_USE, ast_channel_tech::properties, ast_channel::tech, and ast_jb::timebase.
Referenced by ast_generic_bridge().
void ast_jb_empty_and_reset | ( | struct ast_channel * | c0, |
struct ast_channel * | c1 | ||
) |
drops all frames from a jitterbuffer and resets it
c0 | one channel of a bridge |
c1 | the other channel of the bridge |
Definition at line 627 of file abstract_jb.c.
References ast_test_flag, ast_jb_impl::empty_and_reset, ast_jb::impl, ast_channel::jb, JB_CREATED, JB_USE, and ast_jb::jbobj.
Referenced by ast_generic_bridge().
void ast_jb_get_and_deliver | ( | struct ast_channel * | c0, |
struct ast_channel * | c1 | ||
) |
Deliver the queued frames that should be delivered now for both channels.
c0 | first bridged channel. |
c1 | second bridged channel. |
Called from ast_generic_bridge() to deliver any frames, that should be delivered for the moment of invocation. Does nothing if neihter of the channels is using jb or has any frames currently queued in. The function delivers frames usig ast_write() each of the channels.
Definition at line 371 of file abstract_jb.c.
References ast_test_flag, ast_channel::jb, JB_CREATED, jb_get_and_deliver(), and JB_USE.
Referenced by ast_generic_bridge().
void ast_jb_get_config | ( | const struct ast_channel * | chan, |
struct ast_jb_conf * | conf | ||
) |
Copies a channel's jitterbuffer configuration.
chan | channel. |
conf | destination. |
Definition at line 622 of file abstract_jb.c.
References ast_jb::conf, and ast_channel::jb.
int ast_jb_get_when_to_wakeup | ( | struct ast_channel * | c0, |
struct ast_channel * | c1, | ||
int | time_left | ||
) |
Calculates the time, left to the closest delivery moment in a bridge.
c0 | first bridged channel. |
c1 | second bridged channel. |
time_left | bridge time limit, or -1 if not set. |
Called from ast_generic_bridge() to determine the maximum time to wait for activity in ast_waitfor_n() call. If neihter of the channels is using jb, this function returns the time limit passed.
Definition at line 266 of file abstract_jb.c.
References ast_test_flag, get_now(), ast_channel::jb, JB_CREATED, JB_USE, and ast_jb::next.
Referenced by ast_generic_bridge().
int ast_jb_put | ( | struct ast_channel * | chan, |
struct ast_frame * | f | ||
) |
Puts a frame into a channel jitterbuffer.
chan | channel. |
f | frame. |
Called from ast_generic_bridge() to put a frame into a channel's jitterbuffer. The function will successfuly enqueue a frame if and only if:
0 | if the frame was queued |
-1 | if not |
Definition at line 306 of file abstract_jb.c.
References ast_clear_flag, AST_FRAME_DTMF, AST_FRAME_VOICE, ast_frdup(), AST_FRFLAG_HAS_TIMING_INFO, ast_frfree, ast_log(), ast_set_flag, ast_test_flag, create_jb(), ast_jb_impl::force_resync, ast_frame::frametype, get_now(), ast_jb::impl, ast_channel::jb, JB_CREATED, jb_framelog, JB_IMPL_OK, JB_USE, ast_jb::jbobj, ast_frame::len, LOG_ERROR, LOG_WARNING, ast_channel::name, ast_jb_impl::next, ast_jb::next, ast_jb_impl::put, ast_frame::src, and ast_frame::ts.
Referenced by ast_generic_bridge().
int ast_jb_read_conf | ( | struct ast_jb_conf * | conf, |
const char * | varname, | ||
const char * | value | ||
) |
Sets jitterbuffer configuration property.
conf | configuration to store the property in. |
varname | property name. |
value | property value. |
Called from a channel driver to build a jitterbuffer configuration typically when reading a configuration file. It is not necessary for a channel driver to know each of the jb configuration property names. The jitterbuffer itself knows them. The channel driver can pass each config var it reads through this function. It will return 0 if the variable was consumed from the jb conf.
Definition at line 577 of file abstract_jb.c.
References AST_JB_CONF_ENABLE, AST_JB_CONF_FORCE, AST_JB_CONF_IMPL, AST_JB_CONF_LOG, AST_JB_CONF_MAX_SIZE, AST_JB_CONF_PREFIX, AST_JB_CONF_RESYNCH_THRESHOLD, AST_JB_CONF_TARGET_EXTRA, AST_JB_ENABLED, AST_JB_FORCED, AST_JB_LOG, ast_set2_flag, ast_strlen_zero(), ast_true(), ast_jb_conf::impl, ast_jb_conf::max_size, name, ast_jb_conf::resync_threshold, and ast_jb_conf::target_extra.
Referenced by _build_general_config(), config_parse_variables(), gtalk_load_config(), jingle_load_config(), load_module(), process_dahdi(), reload_config(), and store_config_core().