summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pjmedia/build/Jbtest.dat8
-rw-r--r--pjmedia/src/pjmedia/jbuf.c19
2 files changed, 13 insertions, 14 deletions
diff --git a/pjmedia/build/Jbtest.dat b/pjmedia/build/Jbtest.dat
index 6c836f07..3e2169c4 100644
--- a/pjmedia/build/Jbtest.dat
+++ b/pjmedia/build/Jbtest.dat
@@ -184,14 +184,18 @@ G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG
%adaptive 0 0 10
!burst 1
!discard 0
-!lost 3
-!empty 1
+!lost 7
+!empty 3
!delay 3
PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG
# Some losts
LGPGPGLGPGPGPGLGPGPG
# Normal
PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG
+# More losts
+PLPGGGPPPGGGPLPGGGPG PLPGGGPPPGGGPLPGGGPG
+# Normal
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG
.
= Sequence restart
diff --git a/pjmedia/src/pjmedia/jbuf.c b/pjmedia/src/pjmedia/jbuf.c
index 1149503b..1df68a57 100644
--- a/pjmedia/src/pjmedia/jbuf.c
+++ b/pjmedia/src/pjmedia/jbuf.c
@@ -315,10 +315,6 @@ static pj_status_t jb_framelist_put_at(jb_framelist_t *framelist,
assert(frame_size <= framelist->frame_size);
- /* the first ever frame since inited/resetted. */
- if (framelist->origin == INVALID_OFFSET)
- framelist->origin = index;
-
/* too late or duplicated or sequence restart */
if (index < framelist->origin) {
if (framelist->origin - index < MAX_MISORDER) {
@@ -330,6 +326,11 @@ static pj_status_t jb_framelist_put_at(jb_framelist_t *framelist,
}
}
+ /* if jbuf is empty, just reset the origin */
+ if (framelist->size == 0) {
+ framelist->origin = index;
+ }
+
/* get distance of this frame to the first frame in the buffer */
distance = index - framelist->origin;
@@ -341,14 +342,8 @@ static pj_status_t jb_framelist_put_at(jb_framelist_t *framelist,
framelist->origin = index;
distance = 0;
} else {
- if (framelist->size == 0) {
- /* if jbuf is empty, process the frame */
- framelist->origin = index;
- distance = 0;
- } else {
- /* otherwise, reject the frame */
- return PJ_ETOOMANY;
- }
+ /* otherwise, reject the frame */
+ return PJ_ETOOMANY;
}
}