diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2009-04-07 23:16:24 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2009-04-07 23:16:24 +0000 |
commit | 598b40fa8df56ad814fa0f2b6712c4e242c5c436 (patch) | |
tree | a2a1df977c1bd3a7ad45120f3ee1ddb28e61e34e /pjmedia/src | |
parent | ebc2eccffb43b2f13433038d5fe23b4672e8a7ab (diff) |
Ticket #762: Fixed jbuf in handling far sequence jump (the distance is over jbuf capacity) while jbuf is empty.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2583 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/src')
-rw-r--r-- | pjmedia/src/pjmedia/jbuf.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/pjmedia/src/pjmedia/jbuf.c b/pjmedia/src/pjmedia/jbuf.c index dd45d781..71891212 100644 --- a/pjmedia/src/pjmedia/jbuf.c +++ b/pjmedia/src/pjmedia/jbuf.c @@ -335,17 +335,25 @@ static pj_status_t jb_framelist_put_at(jb_framelist_t *framelist, } } - /* too soon or jump too far */ + /* get distance of this frame to the first frame in the buffer */ distance = index - framelist->origin; + + /* far jump, the distance is greater than buffer capacity */ if (distance >= (int)framelist->max_count) { if (distance > MAX_DROPOUT) { - /* jump too far */ + /* jump too far, reset the buffer */ jb_framelist_reset(framelist); framelist->origin = index; distance = 0; } else { - /* too soon, buffer is not enough */ - return PJ_ETOOMANY; + if (framelist->size == 0) { + /* if jbuf is empty, process the frame */ + framelist->origin = index; + distance = 0; + } else { + /* otherwise, reject the frame */ + return PJ_ETOOMANY; + } } } |