diff options
author | Benny Prijono <bennylp@teluu.com> | 2008-04-10 11:51:04 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2008-04-10 11:51:04 +0000 |
commit | 5d636438207abb1becc53c4391081461f4f56905 (patch) | |
tree | 54ad43f69e00139a7bc73b197ce397a891d38928 /pjmedia | |
parent | bde897c92dd995877d62fe8a84b3a33a97d5ede0 (diff) |
More ticket #505: the jitter buffer only discard one packet at a time when optimizing the delay
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1922 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r-- | pjmedia/src/pjmedia/jbuf.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/pjmedia/src/pjmedia/jbuf.c b/pjmedia/src/pjmedia/jbuf.c index 0070b4de..a1e2311d 100644 --- a/pjmedia/src/pjmedia/jbuf.c +++ b/pjmedia/src/pjmedia/jbuf.c @@ -83,7 +83,7 @@ struct pjmedia_jbuf * second. */ #if 1 -# define TRACE__(args) PJ_LOG(4,args) +# define TRACE__(args) PJ_LOG(5,args) #else # define TRACE__(args) #endif @@ -395,14 +395,14 @@ static void jbuf_calculate_jitter(pjmedia_jbuf *jb) /* Level is decreasing */ if (jb->jb_level < jb->jb_prefetch) { - static const int stable_history_limit = 100; + enum { STABLE_HISTORY_LIMIT = 100 }; jb->jb_stable_hist++; /* Only update the prefetch if 'stable' condition is reached * (not just short time impulse) */ - if (jb->jb_stable_hist > (int)stable_history_limit) { + if (jb->jb_stable_hist > STABLE_HISTORY_LIMIT) { diff = (jb->jb_prefetch - jb->jb_max_hist_level) / 3; if (diff < 1) @@ -444,12 +444,14 @@ static void jbuf_calculate_jitter(pjmedia_jbuf *jb) /* These code is used for shortening the delay in the jitter buffer. */ diff = jb_framelist_size(&jb->jb_framelist) - jb->jb_prefetch; if (diff > SAFE_SHRINKING_DIFF) { - - /* Drop some frames so jitter buffer size should be == jb_prefetch */ + /* Shrink slowly */ + diff = 1; + + /* Drop frame(s)! */ jb_framelist_remove_head(&jb->jb_framelist, diff); TRACE__((jb->name.ptr, - "JB shrinking %d frames, size=%d", diff, + "JB shrinking %d frame(s), size=%d", diff, jb_framelist_size(&jb->jb_framelist))); } |