FreeSWITCH API Documentation
1.7.0
|
Go to the source code of this file.
Data Structures | |
struct | switch_jb_node_s |
struct | switch_jb_s |
Macros | |
#define | NACK_TIME 80000 |
#define | RENACK_TIME 100000 |
#define | PERIOD_LEN 250 |
#define | MAX_FRAME_PADDING 2 |
#define | MAX_MISSING_SEQ 20 |
#define | jb_debug(_jb, _level, _format,...) if (_jb->debug_level >= _level) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(_jb->session), SWITCH_LOG_ALERT, "JB:%p:%s lv:%d ln:%.4d sz:%.3u/%.3u/%.3u/%.3u c:%.3u %.3u/%.3u/%.3u/%.3u %.2f%% ->" _format, (void *) _jb, (jb->type == SJB_AUDIO ? "aud" : "vid"), _level, __LINE__, _jb->min_frame_len, _jb->max_frame_len, _jb->frame_len, _jb->complete_frames, _jb->period_count, _jb->consec_good_count, _jb->period_good_count, _jb->consec_miss_count, _jb->period_miss_count, _jb->period_miss_pct, __VA_ARGS__) |
#define | jb_frame_inc(_jb, _i) jb_frame_inc_line(_jb, _i, __LINE__) |
Typedefs | |
typedef struct switch_jb_node_s | switch_jb_node_t |
#define jb_debug | ( | _jb, | |
_level, | |||
_format, | |||
... | |||
) | if (_jb->debug_level >= _level) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(_jb->session), SWITCH_LOG_ALERT, "JB:%p:%s lv:%d ln:%.4d sz:%.3u/%.3u/%.3u/%.3u c:%.3u %.3u/%.3u/%.3u/%.3u %.2f%% ->" _format, (void *) _jb, (jb->type == SJB_AUDIO ? "aud" : "vid"), _level, __LINE__, _jb->min_frame_len, _jb->max_frame_len, _jb->frame_len, _jb->complete_frames, _jb->period_count, _jb->consec_good_count, _jb->period_good_count, _jb->consec_miss_count, _jb->period_miss_count, _jb->period_miss_pct, __VA_ARGS__) |
Definition at line 40 of file switch_jitterbuffer.c.
Referenced by add_node(), drop_oldest_frame(), jb_frame_inc_line(), jb_next_packet_by_seq(), jb_next_packet_by_ts(), switch_jb_get_packet(), switch_jb_get_packet_by_seq(), switch_jb_pop_nack(), switch_jb_put_packet(), and switch_jb_reset().
#define jb_frame_inc | ( | _jb, | |
_i | |||
) | jb_frame_inc_line(_jb, _i, __LINE__) |
Definition at line 491 of file switch_jitterbuffer.c.
Referenced by jb_next_packet_by_seq(), switch_jb_get_packet(), and switch_jb_put_packet().
#define MAX_FRAME_PADDING 2 |
Definition at line 38 of file switch_jitterbuffer.c.
#define MAX_MISSING_SEQ 20 |
Definition at line 39 of file switch_jitterbuffer.c.
#define NACK_TIME 80000 |
Definition at line 35 of file switch_jitterbuffer.c.
#define PERIOD_LEN 250 |
Definition at line 37 of file switch_jitterbuffer.c.
Referenced by switch_jb_get_packet().
#define RENACK_TIME 100000 |
Definition at line 36 of file switch_jitterbuffer.c.
Referenced by switch_jb_pop_nack().
typedef struct switch_jb_node_s switch_jb_node_t |
|
inlinestatic |
Definition at line 571 of file switch_jitterbuffer.c.
References switch_rtp_packet_t::body, switch_jb_s::complete_frames, switch_jb_s::frame_len, switch_rtp_packet_t::header, switch_jb_s::highest_wrote_seq, switch_jb_s::highest_wrote_ts, jb_debug, switch_jb_node_s::len, switch_rtp_hdr_t::m, switch_jb_s::max_frame_len, new_node(), switch_jb_s::node_hash, switch_jb_s::node_hash_ts, switch_jb_node_s::packet, switch_rtp_hdr_t::seq, SJB_VIDEO, switch_core_inthash_insert(), switch_jb_reset(), switch_rtp_hdr_t::ts, switch_jb_s::type, switch_jb_s::visible_nodes, and switch_jb_s::write_init.
Referenced by switch_jb_put_packet().
|
inlinestatic |
Definition at line 543 of file switch_jitterbuffer.c.
References drop_ts(), jb_debug, and jb_find_lowest_ts().
Referenced by switch_jb_put_packet().
|
inlinestatic |
Definition at line 301 of file switch_jitterbuffer.c.
References switch_jb_s::complete_frames, switch_rtp_packet_t::header, hide_node(), switch_jb_s::list_mutex, switch_jb_node_s::next, switch_jb_s::node_list, switch_jb_node_s::packet, sort_free_nodes(), SWITCH_FALSE, switch_mutex_lock(), switch_mutex_unlock(), switch_rtp_hdr_t::ts, and switch_jb_node_s::visible.
Referenced by drop_oldest_frame(), jb_next_packet_by_seq(), and thin_frames().
|
inlinestatic |
Definition at line 790 of file switch_jitterbuffer.c.
References switch_jb_s::list_mutex, switch_jb_s::node_list, switch_mutex_lock(), and switch_mutex_unlock().
Referenced by switch_jb_destroy().
|
inlinestatic |
Definition at line 258 of file switch_jitterbuffer.c.
References switch_jb_node_s::bad_hits, switch_rtp_packet_t::header, switch_jb_s::list_mutex, switch_jb_s::node_hash, switch_jb_s::node_hash_ts, switch_jb_node_s::packet, switch_jb_node_s::parent, push_to_top(), switch_rtp_hdr_t::seq, switch_core_inthash_delete(), switch_mutex_lock(), switch_mutex_unlock(), switch_rtp_hdr_t::ts, switch_jb_node_s::visible, and switch_jb_s::visible_nodes.
Referenced by drop_ts(), hide_nodes(), and switch_jb_get_packet().
|
inlinestatic |
Definition at line 290 of file switch_jitterbuffer.c.
References hide_node(), switch_jb_s::list_mutex, switch_jb_node_s::next, switch_jb_s::node_list, SWITCH_FALSE, switch_mutex_lock(), and switch_mutex_unlock().
Referenced by switch_jb_reset().
|
inlinestatic |
Definition at line 657 of file switch_jitterbuffer.c.
References switch_jb_s::last_target_seq, and switch_jb_s::target_seq.
Referenced by jb_next_packet_by_seq().
|
inlinestatic |
Definition at line 636 of file switch_jitterbuffer.c.
References switch_jb_s::last_psuedo_seq, switch_jb_s::last_target_ts, switch_jb_s::psuedo_seq, switch_jb_s::samples_per_frame, and switch_jb_s::target_ts.
Referenced by jb_next_packet_by_ts().
|
inlinestatic |
Definition at line 344 of file switch_jitterbuffer.c.
References switch_rtp_packet_t::header, switch_jb_s::list_mutex, switch_jb_node_s::next, switch_jb_s::node_list, switch_jb_node_s::packet, switch_mutex_lock(), switch_mutex_unlock(), switch_rtp_hdr_t::ts, and switch_jb_node_s::visible.
Referenced by jb_find_lowest_ts(), and jb_next_packet_by_ts().
|
inlinestatic |
Definition at line 325 of file switch_jitterbuffer.c.
References switch_rtp_packet_t::header, switch_jb_s::list_mutex, switch_jb_node_s::next, switch_jb_s::node_list, switch_jb_node_s::packet, switch_rtp_hdr_t::seq, switch_mutex_lock(), switch_mutex_unlock(), switch_rtp_hdr_t::ts, and switch_jb_node_s::visible.
Referenced by jb_next_packet_by_seq().
|
inlinestatic |
Definition at line 361 of file switch_jitterbuffer.c.
References switch_rtp_packet_t::header, jb_find_lowest_node(), switch_jb_node_s::packet, and switch_rtp_hdr_t::ts.
Referenced by drop_oldest_frame().
|
static |
Definition at line 449 of file switch_jitterbuffer.c.
References switch_jb_s::frame_len, switch_jb_s::highest_frame_len, jb_debug, switch_jb_s::max_frame_len, switch_jb_s::min_frame_len, switch_jb_s::session, and switch_core_session_request_video_refresh().
|
inlinestatic |
Definition at line 442 of file switch_jitterbuffer.c.
References switch_jb_s::consec_good_count, switch_jb_s::consec_miss_count, and switch_jb_s::period_good_count.
Referenced by jb_next_packet_by_seq(), and jb_next_packet_by_ts().
|
inlinestatic |
Definition at line 494 of file switch_jitterbuffer.c.
References switch_jb_s::consec_good_count, switch_jb_s::consec_miss_count, and switch_jb_s::period_miss_count.
Referenced by jb_next_packet_by_seq(), and jb_next_packet_by_ts().
|
inlinestatic |
Definition at line 781 of file switch_jitterbuffer.c.
References jb_next_packet_by_seq(), jb_next_packet_by_ts(), and switch_jb_s::samples_per_frame.
Referenced by switch_jb_get_packet().
|
inlinestatic |
Definition at line 669 of file switch_jitterbuffer.c.
References drop_ts(), switch_jb_s::dropped, switch_rtp_packet_t::header, switch_jb_s::highest_read_ts, increment_seq(), jb_debug, jb_find_lowest_seq(), jb_frame_inc, jb_hit(), jb_miss(), switch_rtp_hdr_t::m, switch_jb_s::node_hash, switch_jb_node_s::packet, switch_jb_s::period_miss_count, switch_jb_s::period_miss_inc, switch_rtp_hdr_t::seq, switch_jb_s::session, set_read_seq(), SJB_VIDEO, switch_core_inthash_find(), switch_core_session_request_video_refresh(), SWITCH_STATUS_NOTFOUND, SWITCH_STATUS_SUCCESS, switch_jb_s::target_seq, switch_rtp_hdr_t::ts, and switch_jb_s::type.
Referenced by jb_next_packet().
|
inlinestatic |
Definition at line 749 of file switch_jitterbuffer.c.
References switch_rtp_packet_t::header, increment_ts(), jb_debug, jb_find_lowest_node(), jb_hit(), jb_miss(), switch_jb_s::node_hash_ts, switch_jb_node_s::packet, switch_jb_s::psuedo_seq, switch_rtp_hdr_t::seq, set_read_ts(), switch_core_inthash_find(), SWITCH_STATUS_NOTFOUND, SWITCH_STATUS_SUCCESS, switch_jb_s::target_ts, and switch_rtp_hdr_t::ts.
Referenced by jb_next_packet().
|
inlinestatic |
Definition at line 198 of file switch_jitterbuffer.c.
References switch_jb_node_s::bad_hits, switch_jb_s::list_mutex, switch_jb_node_s::next, switch_jb_s::node_list, switch_jb_node_s::parent, switch_jb_s::pool, switch_jb_node_s::prev, switch_assert, switch_core_alloc, switch_mutex_lock(), switch_mutex_unlock(), switch_jb_node_s::visible, and switch_jb_s::visible_nodes.
Referenced by add_node().
|
static |
Definition at line 107 of file switch_jitterbuffer.c.
References switch_rtp_packet_t::header, switch_jb_node_s::packet, switch_rtp_hdr_t::seq, and switch_jb_node_s::visible.
Referenced by sort_free_nodes().
|
inlinestatic |
Definition at line 233 of file switch_jitterbuffer.c.
References switch_jb_node_s::next, switch_jb_s::node_list, switch_jb_node_s::prev, and switch_assert.
Referenced by hide_node().
|
inlinestatic |
Definition at line 663 of file switch_jitterbuffer.c.
References switch_jb_s::last_target_seq, and switch_jb_s::target_seq.
Referenced by jb_next_packet_by_seq().
|
inlinestatic |
Definition at line 646 of file switch_jitterbuffer.c.
References switch_jb_s::last_psuedo_seq, switch_jb_s::last_target_ts, switch_jb_s::psuedo_seq, switch_jb_s::samples_per_frame, and switch_jb_s::target_ts.
Referenced by jb_next_packet_by_ts().
|
inlinestatic |
Definition at line 283 of file switch_jitterbuffer.c.
References switch_jb_s::list_mutex, node_cmp(), switch_jb_s::node_list, sort_nodes(), switch_mutex_lock(), and switch_mutex_unlock().
Referenced by drop_ts(), and thin_frames().
switch_jb_node_t* sort_nodes | ( | switch_jb_node_t * | list, |
int(*)(const void *, const void *) | cmp | ||
) |
Definition at line 119 of file switch_jitterbuffer.c.
References switch_jb_node_s::next, and switch_jb_node_s::prev.
Referenced by sort_free_nodes().
void switch_jb_clear_flag | ( | switch_jb_t * | jb, |
switch_jb_flag_t | flag | ||
) |
Definition at line 826 of file switch_jitterbuffer.c.
References switch_clear_flag.
switch_status_t switch_jb_create | ( | switch_jb_t ** | jbp, |
switch_jb_type_t | type, | ||
uint32_t | min_frame_len, | ||
uint32_t | max_frame_len, | ||
switch_memory_pool_t * | pool | ||
) |
Definition at line 970 of file switch_jitterbuffer.c.
References switch_jb_s::frame_len, switch_jb_s::free_pool, switch_jb_s::highest_frame_len, switch_jb_s::list_mutex, switch_jb_s::max_frame_len, switch_jb_s::min_frame_len, switch_jb_s::missing_seq_hash, switch_jb_s::mutex, switch_jb_s::node_hash, pool, switch_jb_s::pool, SJB_VIDEO, switch_core_alloc, switch_core_inthash_init(), switch_core_new_memory_pool, switch_mutex_init(), SWITCH_MUTEX_NESTED, SWITCH_STATUS_SUCCESS, and switch_jb_s::type.
Referenced by rtp_common_write(), switch_ivr_delay_echo(), switch_rtp_activate_jitter_buffer(), and switch_rtp_set_video_buffer_size().
void switch_jb_debug_level | ( | switch_jb_t * | jb, |
uint8_t | level | ||
) |
Definition at line 841 of file switch_jitterbuffer.c.
Referenced by switch_ivr_delay_echo(), and switch_rtp_debug_jitter_buffer().
switch_status_t switch_jb_destroy | ( | switch_jb_t ** | jbp | ) |
Definition at line 1001 of file switch_jitterbuffer.c.
References free_nodes(), switch_jb_s::free_pool, switch_jb_s::missing_seq_hash, switch_jb_s::node_hash, switch_jb_s::node_hash_ts, switch_jb_s::pool, SJB_VIDEO, switch_core_destroy_memory_pool, switch_core_inthash_destroy(), SWITCH_STATUS_SUCCESS, and switch_jb_s::type.
Referenced by read_rtp_packet(), switch_ivr_delay_echo(), and switch_rtp_destroy().
int switch_jb_frame_count | ( | switch_jb_t * | jb | ) |
Definition at line 836 of file switch_jitterbuffer.c.
switch_status_t switch_jb_get_frames | ( | switch_jb_t * | jb, |
uint32_t * | min_frame_len, | ||
uint32_t * | max_frame_len, | ||
uint32_t * | cur_frame_len, | ||
uint32_t * | highest_frame_len | ||
) |
Definition at line 916 of file switch_jitterbuffer.c.
References switch_mutex_lock(), switch_mutex_unlock(), and SWITCH_STATUS_SUCCESS.
Referenced by switch_rtp_get_stats(), and switch_rtp_get_video_buffer_size().
switch_size_t switch_jb_get_last_read_len | ( | switch_jb_t * | jb | ) |
switch_status_t switch_jb_get_packet | ( | switch_jb_t * | jb, |
switch_rtp_packet_t * | packet, | ||
switch_size_t * | len | ||
) |
Definition at line 1195 of file switch_jitterbuffer.c.
References switch_rtp_packet_t::body, CF_VIDEO_BITRATE_UNMANAGABLE, switch_core_session_message::from, switch_rtp_packet_t::header, hide_node(), jb_debug, jb_frame_inc, jb_next_packet(), switch_jb_node_s::len, switch_core_session_message::message_id, switch_core_session_message::numeric_arg, switch_jb_node_s::packet, PERIOD_LEN, switch_rtp_hdr_t::seq, SJB_VIDEO, switch_channel_clear_flag(), switch_channel_set_flag, switch_channel_test_flag(), switch_core_session_receive_message, switch_core_session_request_video_refresh(), switch_goto_status, switch_jb_reset(), SWITCH_MESSAGE_INDICATE_BITRATE_REQ, switch_mutex_lock(), switch_mutex_unlock(), SWITCH_STATUS_BREAK, SWITCH_STATUS_MORE_DATA, SWITCH_STATUS_NOTFOUND, SWITCH_STATUS_RESTART, SWITCH_STATUS_SUCCESS, SWITCH_TRUE, thin_frames(), and switch_rtp_hdr_t::ts.
Referenced by read_rtp_packet(), and switch_ivr_delay_echo().
switch_status_t switch_jb_get_packet_by_seq | ( | switch_jb_t * | jb, |
uint16_t | seq, | ||
switch_rtp_packet_t * | packet, | ||
switch_size_t * | len | ||
) |
Definition at line 1169 of file switch_jitterbuffer.c.
References switch_rtp_packet_t::body, jb_debug, switch_jb_node_s::len, switch_jb_node_s::packet, switch_core_inthash_find(), switch_mutex_lock(), switch_mutex_unlock(), SWITCH_STATUS_NOTFOUND, and SWITCH_STATUS_SUCCESS.
Referenced by handle_nack().
switch_status_t switch_jb_peek_frame | ( | switch_jb_t * | jb, |
uint32_t | ts, | ||
uint16_t | seq, | ||
int | peek, | ||
switch_frame_t * | frame | ||
) |
Definition at line 890 of file switch_jitterbuffer.c.
References switch_rtp_packet_t::body, switch_rtp_packet_t::header, switch_jb_node_s::len, switch_rtp_hdr_t::m, switch_jb_node_s::packet, switch_rtp_hdr_t::seq, switch_core_inthash_find(), SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and switch_rtp_hdr_t::ts.
int switch_jb_poll | ( | switch_jb_t * | jb | ) |
uint32_t switch_jb_pop_nack | ( | switch_jb_t * | jb | ) |
Definition at line 1024 of file switch_jitterbuffer.c.
References jb_debug, RENACK_TIME, SJB_VIDEO, switch_core_hash_first, switch_core_hash_next(), switch_core_hash_this(), switch_core_inthash_delete(), switch_core_inthash_insert(), switch_mutex_lock(), switch_mutex_unlock(), and switch_time_now().
Referenced by check_rtcp_and_ice().
switch_status_t switch_jb_put_packet | ( | switch_jb_t * | jb, |
switch_rtp_packet_t * | packet, | ||
switch_size_t | len | ||
) |
Definition at line 1104 of file switch_jitterbuffer.c.
References add_node(), drop_oldest_frame(), jb_debug, jb_frame_inc, SJB_AUDIO, SJB_QUEUE_ONLY, SWITCH_CHANNEL_LOG, switch_core_inthash_delete(), switch_core_inthash_insert(), switch_core_session_request_video_refresh(), switch_jb_reset(), switch_log_printf(), SWITCH_LOG_WARNING, switch_mutex_lock(), switch_mutex_unlock(), SWITCH_SIZE_T_FMT, SWITCH_STATUS_SUCCESS, and switch_test_flag.
Referenced by read_rtp_packet(), rtp_common_write(), and switch_ivr_delay_echo().
void switch_jb_reset | ( | switch_jb_t * | jb | ) |
Definition at line 846 of file switch_jitterbuffer.c.
References hide_nodes(), jb_debug, SJB_VIDEO, switch_core_inthash_destroy(), switch_core_inthash_init(), switch_core_session_request_video_refresh(), switch_mutex_lock(), and switch_mutex_unlock().
Referenced by add_node(), do_flush(), handle_rfc2833(), process_rtcp_report(), read_rtp_packet(), switch_jb_get_packet(), switch_jb_put_packet(), switch_rtp_del_dtls(), switch_rtp_pause_jitter_buffer(), switch_rtp_reset_jb(), switch_rtp_reset_vb(), and switch_rtp_set_flag().
void switch_jb_set_flag | ( | switch_jb_t * | jb, |
switch_jb_flag_t | flag | ||
) |
Definition at line 821 of file switch_jitterbuffer.c.
References switch_set_flag.
Referenced by rtp_common_write().
switch_status_t switch_jb_set_frames | ( | switch_jb_t * | jb, |
uint32_t | min_frame_len, | ||
uint32_t | max_frame_len | ||
) |
Definition at line 938 of file switch_jitterbuffer.c.
References switch_mutex_lock(), switch_mutex_unlock(), and SWITCH_STATUS_SUCCESS.
Referenced by switch_rtp_activate_jitter_buffer(), and switch_rtp_set_video_buffer_size().
void switch_jb_set_session | ( | switch_jb_t * | jb, |
switch_core_session_t * | session | ||
) |
Definition at line 804 of file switch_jitterbuffer.c.
References SJB_VIDEO, switch_channel_get_variable_dup(), switch_core_session_get_channel(), and SWITCH_FALSE.
Referenced by switch_rtp_activate_jitter_buffer(), and switch_rtp_set_video_buffer_size().
void switch_jb_ts_mode | ( | switch_jb_t * | jb, |
uint32_t | samples_per_frame, | ||
uint32_t | samples_per_second | ||
) |
Definition at line 797 of file switch_jitterbuffer.c.
References switch_core_inthash_init().
Referenced by switch_rtp_activate_jitter_buffer().
|
inlinestatic |
Definition at line 368 of file switch_jitterbuffer.c.
References switch_jb_s::complete_frames, drop_ts(), switch_rtp_packet_t::header, switch_jb_s::list_mutex, switch_jb_s::max_frame_len, switch_jb_node_s::next, switch_jb_s::node_list, switch_jb_node_s::packet, sort_free_nodes(), switch_mutex_lock(), switch_mutex_unlock(), switch_rtp_hdr_t::ts, and switch_jb_node_s::visible.
Referenced by switch_jb_get_packet().