mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
clean up formatting (bug #3934)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5363 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
37
jitterbuf.c
37
jitterbuf.c
@@ -70,7 +70,8 @@ jitterbuf * jb_new()
|
||||
|
||||
|
||||
jb = malloc(sizeof(jitterbuf));
|
||||
if(!jb) return NULL;
|
||||
if (!jb)
|
||||
return NULL;
|
||||
|
||||
jb_reset(jb);
|
||||
|
||||
@@ -112,7 +113,8 @@ static void history_put(jitterbuf *jb, long ts, long now)
|
||||
long kicked;
|
||||
|
||||
/* don't add special/negative times to history */
|
||||
if(ts <= 0) return;
|
||||
if (ts <= 0)
|
||||
return;
|
||||
|
||||
kicked = jb->history[jb->hist_ptr & JB_HISTORY_SZ];
|
||||
|
||||
@@ -161,7 +163,8 @@ static void history_calc_maxbuf(jitterbuf *jb)
|
||||
{
|
||||
int i,j;
|
||||
|
||||
if(jb->hist_ptr == 0) return;
|
||||
if (jb->hist_ptr == 0)
|
||||
return;
|
||||
|
||||
|
||||
/* initialize maxbuf/minbuf to the latest value */
|
||||
@@ -249,7 +252,8 @@ static void history_get(jitterbuf *jb)
|
||||
index = count * JB_HISTORY_DROPPCT / 100;
|
||||
|
||||
/* sanity checks for index */
|
||||
if(index > (JB_HISTORY_MAXBUF_SZ - 1)) index = JB_HISTORY_MAXBUF_SZ - 1;
|
||||
if (index > (JB_HISTORY_MAXBUF_SZ - 1))
|
||||
index = JB_HISTORY_MAXBUF_SZ - 1;
|
||||
|
||||
|
||||
if (index < 0) {
|
||||
@@ -307,8 +311,6 @@ static void queue_put(jitterbuf *jb, void *data, int type, long ms, long ts)
|
||||
jb->frames = frame;
|
||||
frame->next = frame;
|
||||
frame->prev = frame;
|
||||
} else if(ts < jb->frames->ts) {
|
||||
frame->next = jb->frames;
|
||||
frame->prev = jb->frames->prev;
|
||||
|
||||
frame->next->prev = frame;
|
||||
@@ -334,14 +336,18 @@ static void queue_put(jitterbuf *jb, void *data, int type, long ms, long ts)
|
||||
|
||||
static long queue_next(jitterbuf *jb)
|
||||
{
|
||||
if(jb->frames) return jb->frames->ts;
|
||||
else return -1;
|
||||
if (jb->frames)
|
||||
return jb->frames->ts;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
static long queue_last(jitterbuf *jb)
|
||||
{
|
||||
if(jb->frames) return jb->frames->prev->ts;
|
||||
else return -1;
|
||||
if (jb->frames)
|
||||
return jb->frames->prev->ts;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
static jb_frame *_queue_get(jitterbuf *jb, long ts, int all)
|
||||
@@ -392,7 +398,8 @@ static jb_frame *queue_getall(jitterbuf *jb)
|
||||
/* some diagnostics */
|
||||
static void jb_dbginfo(jitterbuf *jb)
|
||||
{
|
||||
if(dbgf == NULL) return;
|
||||
if (dbgf == NULL)
|
||||
return;
|
||||
|
||||
jb_dbg("\njb info: fin=%ld fout=%ld flate=%ld flost=%ld fdrop=%ld fcur=%ld\n",
|
||||
jb->info.frames_in, jb->info.frames_out, jb->info.frames_late, jb->info.frames_lost, jb->info.frames_dropped, jb->info.frames_cur);
|
||||
@@ -505,6 +512,7 @@ static int _jb_get(jitterbuf *jb, jb_frame *frameout, long now)
|
||||
(((jb->info.last_adjustment + 2 * jb->info.last_voice_ms ) < now) ||
|
||||
/* we need to grow more than the "length" we have left */
|
||||
(diff > queue_last(jb) - queue_next(jb)) ) ) {
|
||||
|
||||
jb->info.current += jb->info.last_voice_ms;
|
||||
jb->info.last_adjustment = now;
|
||||
jb_dbg("G");
|
||||
@@ -643,7 +651,8 @@ long jb_next(jitterbuf *jb)
|
||||
history_get(jb);
|
||||
return next + jb->info.target;
|
||||
}
|
||||
else return JB_LONGMAX;
|
||||
else
|
||||
return JB_LONGMAX;
|
||||
} else {
|
||||
return jb->info.last_voice_ts + jb->info.last_voice_ms;
|
||||
}
|
||||
@@ -659,7 +668,9 @@ int jb_get(jitterbuf *jb, jb_frame *frameout, long now)
|
||||
if (thists && thists < lastts) jb_warn("XXXX timestamp roll-back!!!\n");
|
||||
lastts = thists;
|
||||
#endif
|
||||
if(ret == JB_INTERP) frameout->ms = jb->info.last_voice_ms;
|
||||
if(ret == JB_INTERP)
|
||||
frameout->ms = jb->info.last_voice_ms;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user