diff options
Diffstat (limited to 'pjmedia/src/pjmedia/jbuf.c')
-rw-r--r-- | pjmedia/src/pjmedia/jbuf.c | 215 |
1 files changed, 108 insertions, 107 deletions
diff --git a/pjmedia/src/pjmedia/jbuf.c b/pjmedia/src/pjmedia/jbuf.c index e7fdfe42..373352f6 100644 --- a/pjmedia/src/pjmedia/jbuf.c +++ b/pjmedia/src/pjmedia/jbuf.c @@ -1,5 +1,5 @@ /* $Id$ */ -/* +/* * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> * @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * Based on implementation kindly contributed by Switchlab, Ltd. @@ -35,7 +35,7 @@ /* Invalid sequence number, used as the initial value. */ #define INVALID_OFFSET -9999 -/* Maximum burst length, whenever an operation is bursting longer than +/* Maximum burst length, whenever an operation is bursting longer than * this value, JB will assume that the opposite operation was idle. */ #define MAX_BURST_MSEC 1000 @@ -46,8 +46,8 @@ #define INIT_CYCLE 10 -/* Minimal difference between JB size and 2*burst-level to perform - * JB shrinking in static discard algorithm. +/* Minimal difference between JB size and 2*burst-level to perform + * JB shrinking in static discard algorithm. */ #define STA_DISC_SAFE_SHRINKING_DIFF 1 @@ -67,13 +67,13 @@ typedef struct jb_framelist_t pj_size_t *content_len; /**< frame length array */ pj_uint32_t *bit_info; /**< frame bit info array */ pj_uint32_t *ts; /**< timestamp array */ - + /* States */ unsigned head; /**< index of head, pointed frame will be returned by next GET */ - unsigned size; /**< current size of framelist, + unsigned size; /**< current size of framelist, including discarded frames. */ - unsigned discarded_num; /**< current number of discarded + unsigned discarded_num; /**< current number of discarded frames. */ int origin; /**< original index of flist_head */ @@ -91,14 +91,14 @@ struct pjmedia_jbuf pj_str_t jb_name; /**< jitter buffer name */ pj_size_t jb_frame_size; /**< frame size */ unsigned jb_frame_ptime; /**< frame duration. */ - pj_size_t jb_max_count; /**< capacity of jitter buffer, + pj_size_t jb_max_count; /**< capacity of jitter buffer, in frames */ int jb_init_prefetch; /**< Initial prefetch */ int jb_min_prefetch; /**< Minimum allowable prefetch */ int jb_max_prefetch; /**< Maximum allowable prefetch */ int jb_max_burst; /**< maximum possible burst, whenever - burst exceeds this value, it - won't be included in level + burst exceeds this value, it + won't be included in level calculation */ int jb_min_shrink_gap; /**< How often can we shrink */ discard_algo jb_discard_algo; /**< Discard algorithm */ @@ -107,27 +107,27 @@ struct pjmedia_jbuf jb_framelist_t jb_framelist; /**< the buffer */ /* States */ - int jb_level; /**< delay between source & - destination (calculated according - of the number of burst get/put + int jb_level; /**< delay between source & + destination (calculated according + of the number of burst get/put operations) */ - int jb_max_hist_level; /**< max level during the last level + int jb_max_hist_level; /**< max level during the last level calculations */ - int jb_stable_hist; /**< num of times the delay has been + int jb_stable_hist; /**< num of times the delay has been lower then the prefetch num */ - int jb_last_op; /**< last operation executed + int jb_last_op; /**< last operation executed (put/get) */ int jb_eff_level; /**< effective burst level */ - int jb_prefetch; /**< no. of frame to insert before - removing some (at the beginning - of the framelist->content + int jb_prefetch; /**< no. of frame to insert before + removing some (at the beginning + of the framelist->content operation), the value may be continuously updated based on current frame burst level. */ pj_bool_t jb_prefetching; /**< flag if jbuf is prefetching. */ - int jb_status; /**< status is 'init' until the first + int jb_status; /**< status is 'init' until the first 'put' operation */ - int jb_init_cycle_cnt; /**< status is 'init' until the first + int jb_init_cycle_cnt; /**< status is 'init' until the first 'put' operation */ int jb_discard_ref; /**< Seq # of last frame deleted or @@ -136,7 +136,7 @@ struct pjmedia_jbuf to perform discard (in frm) */ /* Statistics */ - pj_math_stat jb_delay; /**< Delay statistics of jitter buffer + pj_math_stat jb_delay; /**< Delay statistics of jitter buffer (in ms) */ pj_math_stat jb_burst; /**< Burst statistics (in frames) */ unsigned jb_lost; /**< Number of lost frames. */ @@ -164,7 +164,7 @@ struct pjmedia_jbuf -/* Enabling this would log the jitter buffer state about once per +/* Enabling this would log the jitter buffer state about once per * second. */ #if 0 @@ -180,7 +180,7 @@ static unsigned jb_framelist_remove_head(jb_framelist_t *framelist, static pj_status_t jb_framelist_init( pj_pool_t *pool, jb_framelist_t *framelist, unsigned frame_size, - unsigned max_count) + unsigned max_count) { PJ_ASSERT_RETURN(pool && framelist, PJ_EINVAL); @@ -188,24 +188,24 @@ static pj_status_t jb_framelist_init( pj_pool_t *pool, framelist->frame_size = frame_size; framelist->max_count = max_count; - framelist->content = (char*) + framelist->content = (char*) pj_pool_alloc(pool, - framelist->frame_size* + framelist->frame_size* framelist->max_count); framelist->frame_type = (int*) - pj_pool_alloc(pool, + pj_pool_alloc(pool, sizeof(framelist->frame_type[0])* framelist->max_count); framelist->content_len = (pj_size_t*) - pj_pool_alloc(pool, + pj_pool_alloc(pool, sizeof(framelist->content_len[0])* framelist->max_count); framelist->bit_info = (pj_uint32_t*) - pj_pool_alloc(pool, + pj_pool_alloc(pool, sizeof(framelist->bit_info[0])* framelist->max_count); framelist->ts = (pj_uint32_t*) - pj_pool_alloc(pool, + pj_pool_alloc(pool, sizeof(framelist->ts[0])* framelist->max_count); @@ -213,13 +213,13 @@ static pj_status_t jb_framelist_init( pj_pool_t *pool, } -static pj_status_t jb_framelist_destroy(jb_framelist_t *framelist) +static pj_status_t jb_framelist_destroy(jb_framelist_t *framelist) { PJ_UNUSED_ARG(framelist); return PJ_SUCCESS; } -static pj_status_t jb_framelist_reset(jb_framelist_t *framelist) +static pj_status_t jb_framelist_reset(jb_framelist_t *framelist) { framelist->head = 0; framelist->origin = INVALID_OFFSET; @@ -227,39 +227,39 @@ static pj_status_t jb_framelist_reset(jb_framelist_t *framelist) framelist->discarded_num = 0; - //pj_bzero(framelist->content, - // framelist->frame_size * + //pj_bzero(framelist->content, + // framelist->frame_size * // framelist->max_count); pj_memset(framelist->frame_type, PJMEDIA_JB_MISSING_FRAME, - sizeof(framelist->frame_type[0]) * + sizeof(framelist->frame_type[0]) * framelist->max_count); - pj_bzero(framelist->content_len, - sizeof(framelist->content_len[0]) * + pj_bzero(framelist->content_len, + sizeof(framelist->content_len[0]) * framelist->max_count); //pj_bzero(framelist->bit_info, - // sizeof(framelist->bit_info[0]) * + // sizeof(framelist->bit_info[0]) * // framelist->max_count); return PJ_SUCCESS; } -static unsigned jb_framelist_size(const jb_framelist_t *framelist) +static unsigned jb_framelist_size(const jb_framelist_t *framelist) { return framelist->size; } -static unsigned jb_framelist_eff_size(const jb_framelist_t *framelist) +static unsigned jb_framelist_eff_size(const jb_framelist_t *framelist) { return (framelist->size - framelist->discarded_num); } -static int jb_framelist_origin(const jb_framelist_t *framelist) +static int jb_framelist_origin(const jb_framelist_t *framelist) { return framelist->origin; } @@ -270,7 +270,7 @@ static pj_bool_t jb_framelist_get(jb_framelist_t *framelist, pjmedia_jb_frame_type *p_type, pj_uint32_t *bit_info, pj_uint32_t *ts, - int *seq) + int *seq) { if (framelist->size) { pj_bool_t prev_discarded = PJ_FALSE; @@ -295,11 +295,11 @@ static pj_bool_t jb_framelist_get(jb_framelist_t *framelist, if (bit_info) *bit_info = 0; } else { - pj_memcpy(frame, - framelist->content + + pj_memcpy(frame, + framelist->content + framelist->head * framelist->frame_size, framelist->frame_size); - *p_type = (pjmedia_jb_frame_type) + *p_type = (pjmedia_jb_frame_type) framelist->frame_type[framelist->head]; if (size) *size = framelist->content_len[framelist->head]; @@ -311,7 +311,7 @@ static pj_bool_t jb_framelist_get(jb_framelist_t *framelist, if (seq) *seq = framelist->origin; - //pj_bzero(framelist->content + + //pj_bzero(framelist->content + // framelist->head * framelist->frame_size, // framelist->frame_size); framelist->frame_type[framelist->head] = PJMEDIA_JB_MISSING_FRAME; @@ -322,7 +322,7 @@ static pj_bool_t jb_framelist_get(jb_framelist_t *framelist, framelist->origin++; framelist->head = (framelist->head + 1) % framelist->max_count; framelist->size--; - + return PJ_TRUE; } } @@ -341,7 +341,7 @@ static pj_bool_t jb_framelist_peek(jb_framelist_t *framelist, pjmedia_jb_frame_type *type, pj_uint32_t *bit_info, pj_uint32_t *ts, - int *seq) + int *seq) { unsigned pos, idx; @@ -366,7 +366,7 @@ static pj_bool_t jb_framelist_peek(jb_framelist_t *framelist, if (frame) *frame = framelist->content + pos*framelist->frame_size; if (type) - *type = (pjmedia_jb_frame_type) + *type = (pjmedia_jb_frame_type) framelist->frame_type[pos]; if (size) *size = framelist->content_len[pos]; @@ -383,9 +383,9 @@ static pj_bool_t jb_framelist_peek(jb_framelist_t *framelist, /* Remove oldest frames as many as param 'count' */ static unsigned jb_framelist_remove_head(jb_framelist_t *framelist, - unsigned count) + unsigned count) { - if (count > framelist->size) + if (count > framelist->size) count = framelist->size; if (count) { @@ -409,7 +409,7 @@ static unsigned jb_framelist_remove_head(jb_framelist_t *framelist, } } - //pj_bzero(framelist->content + + //pj_bzero(framelist->content + // framelist->head * framelist->frame_size, // step1*framelist->frame_size); pj_memset(framelist->frame_type+framelist->head, @@ -439,7 +439,7 @@ static unsigned jb_framelist_remove_head(jb_framelist_t *framelist, framelist->head = (framelist->head + count) % framelist->max_count; framelist->size -= count; } - + return count; } @@ -548,9 +548,9 @@ enum pjmedia_jb_op }; -PJ_DEF(pj_status_t) pjmedia_jbuf_create(pj_pool_t *pool, +PJ_DEF(pj_status_t) pjmedia_jbuf_create(pj_pool_t *pool, const pj_str_t *name, - unsigned frame_size, + unsigned frame_size, unsigned ptime, unsigned max_count, pjmedia_jbuf **p_jb) @@ -596,7 +596,7 @@ PJ_DEF(pj_status_t) pjmedia_jbuf_set_fixed( pjmedia_jbuf *jb, PJ_ASSERT_RETURN(jb, PJ_EINVAL); PJ_ASSERT_RETURN(prefetch <= jb->jb_max_count, PJ_EINVAL); - jb->jb_min_prefetch = jb->jb_max_prefetch = + jb->jb_min_prefetch = jb->jb_max_prefetch = jb->jb_prefetch = jb->jb_init_prefetch = prefetch; pjmedia_jbuf_set_discard(jb, PJMEDIA_JB_DISCARD_NONE); @@ -675,12 +675,12 @@ PJ_DEF(pj_status_t) pjmedia_jbuf_destroy(pjmedia_jbuf *jb) " delay (min/max/avg/dev)=%d/%d/%d/%d ms\n" " burst (min/max/avg/dev)=%d/%d/%d/%d frames\n" " lost=%d discard=%d empty=%d", - jb_framelist_size(&jb->jb_framelist), - jb_framelist_eff_size(&jb->jb_framelist), + jb_framelist_size(&jb->jb_framelist), + jb_framelist_eff_size(&jb->jb_framelist), jb->jb_prefetch, jb->jb_eff_level, - jb->jb_delay.min, jb->jb_delay.max, jb->jb_delay.mean, + jb->jb_delay.min, jb->jb_delay.max, jb->jb_delay.mean, pj_math_stat_get_stddev(&jb->jb_delay), - jb->jb_burst.min, jb->jb_burst.max, jb->jb_burst.mean, + jb->jb_burst.min, jb->jb_burst.max, jb->jb_burst.mean, pj_math_stat_get_stddev(&jb->jb_burst), jb->jb_lost, jb->jb_discard, jb->jb_empty)); @@ -704,14 +704,14 @@ static void jbuf_calculate_jitter(pjmedia_jbuf *jb) if (jb->jb_level < jb->jb_eff_level) { enum { STABLE_HISTORY_LIMIT = 20 }; - + jb->jb_stable_hist++; - - /* Only update the effective level (and prefetch) if 'stable' + + /* Only update the effective level (and prefetch) if 'stable' * condition is reached (not just short time impulse) */ if (jb->jb_stable_hist > STABLE_HISTORY_LIMIT) { - + diff = (jb->jb_eff_level - jb->jb_max_hist_level) / 3; if (diff < 1) @@ -723,7 +723,7 @@ static void jbuf_calculate_jitter(pjmedia_jbuf *jb) /* Update prefetch based on level */ if (jb->jb_init_prefetch) { jb->jb_prefetch = jb->jb_eff_level; - if (jb->jb_prefetch < jb->jb_min_prefetch) + if (jb->jb_prefetch < jb->jb_min_prefetch) jb->jb_prefetch = jb->jb_min_prefetch; if (jb->jb_prefetch > jb->jb_max_prefetch) jb->jb_prefetch = jb->jb_max_prefetch; @@ -735,6 +735,7 @@ static void jbuf_calculate_jitter(pjmedia_jbuf *jb) TRACE__((jb->jb_name.ptr,"jb updated(1), lvl=%d pre=%d, size=%d", jb->jb_eff_level, jb->jb_prefetch, cur_size)); + PJ_UNUSED_ARG(cur_size); /* Warning about unused var */ } } @@ -758,7 +759,7 @@ static void jbuf_calculate_jitter(pjmedia_jbuf *jb) /* Do not reset max_hist_level. */ //jb->jb_max_hist_level = 0; - TRACE__((jb->jb_name.ptr,"jb updated(2), lvl=%d pre=%d, size=%d", + TRACE__((jb->jb_name.ptr,"jb updated(2), lvl=%d pre=%d, size=%d", jb->jb_eff_level, jb->jb_prefetch, cur_size)); } @@ -777,11 +778,11 @@ static void jbuf_discard_static(pjmedia_jbuf *jb) * its size is twice of current burst level, there can be drift. * * Moreover, normally drift level is quite low, so JB shouldn't need - * to shrink aggresively, it will shrink maximum one frame per - * PJMEDIA_JBUF_DISC_MIN_GAP ms. Theoritically, JB may handle drift level + * to shrink aggresively, it will shrink maximum one frame per + * PJMEDIA_JBUF_DISC_MIN_GAP ms. Theoritically, JB may handle drift level * as much as = FRAME_PTIME/PJMEDIA_JBUF_DISC_MIN_GAP * 100% * - * Whenever there is drift, where PUT > GET, this method will keep + * Whenever there is drift, where PUT > GET, this method will keep * the latency (JB size) as much as twice of burst level. */ @@ -796,8 +797,8 @@ static void jbuf_discard_static(pjmedia_jbuf *jb) if (diff >= STA_DISC_SAFE_SHRINKING_DIFF) { int seq_origin; - /* Check and adjust jb_discard_ref, in case there was - * seq restart + /* Check and adjust jb_discard_ref, in case there was + * seq restart */ seq_origin = jb_framelist_origin(&jb->jb_framelist); if (seq_origin < jb->jb_discard_ref) @@ -813,7 +814,7 @@ static void jbuf_discard_static(pjmedia_jbuf *jb) jb->jb_discard_ref = jb_framelist_origin(&jb->jb_framelist); jb->jb_discard += diff; - TRACE__((jb->jb_name.ptr, + TRACE__((jb->jb_name.ptr, "JB shrinking %d frame(s), cur size=%d", diff, jb_framelist_eff_size(&jb->jb_framelist))); } @@ -845,7 +846,7 @@ static void jbuf_discard_progressive(pjmedia_jbuf *jb) else if (burst_level >= PJMEDIA_JBUF_PRO_DISC_MAX_BURST) T = PJMEDIA_JBUF_PRO_DISC_T2; else - T = PJMEDIA_JBUF_PRO_DISC_T1 + + T = PJMEDIA_JBUF_PRO_DISC_T1 + (PJMEDIA_JBUF_PRO_DISC_T2 - PJMEDIA_JBUF_PRO_DISC_T1) * (burst_level - PJMEDIA_JBUF_PRO_DISC_MIN_BURST) / (PJMEDIA_JBUF_PRO_DISC_MAX_BURST-PJMEDIA_JBUF_PRO_DISC_MIN_BURST); @@ -873,14 +874,14 @@ static void jbuf_discard_progressive(pjmedia_jbuf *jb) /* Check if we need to discard now */ if (last_seq >= (jb->jb_discard_ref + (int)jb->jb_discard_dist)) { int discard_seq; - + discard_seq = jb->jb_discard_ref + jb->jb_discard_dist; if (discard_seq < jb_framelist_origin(&jb->jb_framelist)) discard_seq = jb_framelist_origin(&jb->jb_framelist); jb_framelist_discard(&jb->jb_framelist, discard_seq); - TRACE__((jb->jb_name.ptr, + TRACE__((jb->jb_name.ptr, "Discard #%d: ref=#%d dist=%d orig=%d size=%d/%d " "burst=%d/%d", discard_seq, @@ -896,7 +897,7 @@ static void jbuf_discard_progressive(pjmedia_jbuf *jb) jb->jb_discard_ref = discard_seq; } } - + PJ_INLINE(void) jbuf_update(pjmedia_jbuf *jb, int oper) { @@ -904,8 +905,8 @@ PJ_INLINE(void) jbuf_update(pjmedia_jbuf *jb, int oper) jb->jb_last_op = oper; if (jb->jb_status == JB_STATUS_INITIALIZING) { - /* Switch status 'initializing' -> 'processing' after some OP - * switch cycles and current OP is GET (burst level is calculated + /* Switch status 'initializing' -> 'processing' after some OP + * switch cycles and current OP is GET (burst level is calculated * based on PUT burst), so burst calculation is guaranted to be * performed right after the status switching. */ @@ -921,10 +922,10 @@ PJ_INLINE(void) jbuf_update(pjmedia_jbuf *jb, int oper) } } - /* Perform jitter calculation based on PUT burst-level only, since + /* Perform jitter calculation based on PUT burst-level only, since * GET burst-level may not be accurate, e.g: when VAD is active. * Note that when burst-level is too big, i.e: exceeds jb_max_burst, - * the GET op may be idle, in this case, we better skip the jitter + * the GET op may be idle, in this case, we better skip the jitter * calculation. */ if (oper == JB_OP_GET && jb->jb_level <= jb->jb_max_burst) @@ -939,28 +940,28 @@ PJ_INLINE(void) jbuf_update(pjmedia_jbuf *jb, int oper) } } -PJ_DEF(void) pjmedia_jbuf_put_frame( pjmedia_jbuf *jb, - const void *frame, - pj_size_t frame_size, +PJ_DEF(void) pjmedia_jbuf_put_frame( pjmedia_jbuf *jb, + const void *frame, + pj_size_t frame_size, int frame_seq) { pjmedia_jbuf_put_frame3(jb, frame, frame_size, 0, frame_seq, 0, NULL); } -PJ_DEF(void) pjmedia_jbuf_put_frame2(pjmedia_jbuf *jb, - const void *frame, - pj_size_t frame_size, +PJ_DEF(void) pjmedia_jbuf_put_frame2(pjmedia_jbuf *jb, + const void *frame, + pj_size_t frame_size, pj_uint32_t bit_info, int frame_seq, pj_bool_t *discarded) { - pjmedia_jbuf_put_frame3(jb, frame, frame_size, bit_info, frame_seq, 0, + pjmedia_jbuf_put_frame3(jb, frame, frame_size, bit_info, frame_seq, 0, discarded); } -PJ_DEF(void) pjmedia_jbuf_put_frame3(pjmedia_jbuf *jb, - const void *frame, - pj_size_t frame_size, +PJ_DEF(void) pjmedia_jbuf_put_frame3(pjmedia_jbuf *jb, + const void *frame, + pj_size_t frame_size, pj_uint32_t bit_info, int frame_seq, pj_uint32_t ts, @@ -977,7 +978,7 @@ PJ_DEF(void) pjmedia_jbuf_put_frame3(pjmedia_jbuf *jb, status = jb_framelist_put_at(&jb->jb_framelist, frame_seq, frame, (unsigned)min_frame_size, bit_info, ts, PJMEDIA_JB_NORMAL_FRAME); - + /* Jitter buffer is full, remove some older frames */ while (status == PJ_ETOOMANY) { int distance; @@ -1009,7 +1010,7 @@ PJ_DEF(void) pjmedia_jbuf_put_frame3(pjmedia_jbuf *jb, if (status == PJ_SUCCESS) { if (jb->jb_prefetching) { - TRACE__((jb->jb_name.ptr, "PUT prefetch_cnt=%d/%d", + TRACE__((jb->jb_name.ptr, "PUT prefetch_cnt=%d/%d", new_size, jb->jb_prefetch)); if (new_size >= jb->jb_prefetch) jb->jb_prefetching = PJ_FALSE; @@ -1023,8 +1024,8 @@ PJ_DEF(void) pjmedia_jbuf_put_frame3(pjmedia_jbuf *jb, /* * Get frame from jitter buffer. */ -PJ_DEF(void) pjmedia_jbuf_get_frame( pjmedia_jbuf *jb, - void *frame, +PJ_DEF(void) pjmedia_jbuf_get_frame( pjmedia_jbuf *jb, + void *frame, char *p_frame_type) { pjmedia_jbuf_get_frame3(jb, frame, NULL, p_frame_type, NULL, @@ -1034,8 +1035,8 @@ PJ_DEF(void) pjmedia_jbuf_get_frame( pjmedia_jbuf *jb, /* * Get frame from jitter buffer. */ -PJ_DEF(void) pjmedia_jbuf_get_frame2(pjmedia_jbuf *jb, - void *frame, +PJ_DEF(void) pjmedia_jbuf_get_frame2(pjmedia_jbuf *jb, + void *frame, pj_size_t *size, char *p_frame_type, pj_uint32_t *bit_info) @@ -1047,8 +1048,8 @@ PJ_DEF(void) pjmedia_jbuf_get_frame2(pjmedia_jbuf *jb, /* * Get frame from jitter buffer. */ -PJ_DEF(void) pjmedia_jbuf_get_frame3(pjmedia_jbuf *jb, - void *frame, +PJ_DEF(void) pjmedia_jbuf_get_frame3(pjmedia_jbuf *jb, + void *frame, pj_size_t *size, char *p_frame_type, pj_uint32_t *bit_info, @@ -1077,7 +1078,7 @@ PJ_DEF(void) pjmedia_jbuf_get_frame3(pjmedia_jbuf *jb, pj_bool_t res; /* Try to retrieve a frame from frame list */ - res = jb_framelist_get(&jb->jb_framelist, frame, size, &ftype, + res = jb_framelist_get(&jb->jb_framelist, frame, size, &ftype, bit_info, ts, seq); if (res) { /* We've successfully retrieved a frame from the frame list, but @@ -1096,7 +1097,7 @@ PJ_DEF(void) pjmedia_jbuf_get_frame3(pjmedia_jbuf *jb, /* We've just retrieved one frame, so add one to cur_size */ cur_size = jb_framelist_eff_size(&jb->jb_framelist) + 1; - pj_math_stat_update(&jb->jb_delay, + pj_math_stat_update(&jb->jb_delay, cur_size*jb->jb_frame_ptime); } } else { @@ -1128,16 +1129,16 @@ PJ_DEF(pj_status_t) pjmedia_jbuf_get_state( const pjmedia_jbuf *jb, state->frame_size = (unsigned)jb->jb_frame_size; state->min_prefetch = jb->jb_min_prefetch; state->max_prefetch = jb->jb_max_prefetch; - + state->burst = jb->jb_eff_level; state->prefetch = jb->jb_prefetch; state->size = jb_framelist_eff_size(&jb->jb_framelist); - + state->avg_delay = jb->jb_delay.mean; state->min_delay = jb->jb_delay.min; state->max_delay = jb->jb_delay.max; state->dev_delay = pj_math_stat_get_stddev(&jb->jb_delay); - + state->avg_burst = jb->jb_burst.mean; state->empty = jb->jb_empty; state->discard = jb->jb_discard; @@ -1149,8 +1150,8 @@ PJ_DEF(pj_status_t) pjmedia_jbuf_get_state( const pjmedia_jbuf *jb, PJ_DEF(void) pjmedia_jbuf_peek_frame( pjmedia_jbuf *jb, unsigned offset, - const void **frame, - pj_size_t *size, + const void **frame, + pj_size_t *size, char *p_frm_type, pj_uint32_t *bit_info, pj_uint32_t *ts, @@ -1170,7 +1171,7 @@ PJ_DEF(void) pjmedia_jbuf_peek_frame( pjmedia_jbuf *jb, } -PJ_DEF(unsigned) pjmedia_jbuf_remove_frame(pjmedia_jbuf *jb, +PJ_DEF(unsigned) pjmedia_jbuf_remove_frame(pjmedia_jbuf *jb, unsigned frame_cnt) { unsigned count, last_discard_num; |