diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2010-12-14 20:39:47 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2010-12-14 20:39:47 +0000 |
commit | 15b441b54ac2bd78d650341bfe2805f01ea9d047 (patch) | |
tree | 004c1f66923133419a0f223ea868f013abd1ad88 /pjmedia/src | |
parent | b10d67a2cc2c07592174363a2de50d101c761391 (diff) |
Fix #1188:
- Fixed jitter buffer progressive discard by returning 'missing' frame after discarded frame(s) so the PLC will be invoked to align the audio signal.
- Modified conditions in jitter buffer test data for this fix.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3396 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/src')
-rw-r--r-- | pjmedia/src/pjmedia/jbuf.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/pjmedia/src/pjmedia/jbuf.c b/pjmedia/src/pjmedia/jbuf.c index 7a863f2a..fcd6723e 100644 --- a/pjmedia/src/pjmedia/jbuf.c +++ b/pjmedia/src/pjmedia/jbuf.c @@ -261,26 +261,39 @@ static pj_bool_t jb_framelist_get(jb_framelist_t *framelist, pj_uint32_t *bit_info) { if (framelist->size) { + pj_bool_t prev_discarded = PJ_FALSE; /* Skip discarded frames */ while (framelist->frame_type[framelist->head] == PJMEDIA_JB_DISCARDED_FRAME) { jb_framelist_remove_head(framelist, 1); + prev_discarded = PJ_TRUE; } /* Return the head frame if any */ if (framelist->size) { - pj_memcpy(frame, - framelist->content + - framelist->head * framelist->frame_size, - framelist->frame_size); - *p_type = (pjmedia_jb_frame_type) - framelist->frame_type[framelist->head]; - if (size) - *size = framelist->content_len[framelist->head]; - if (bit_info) - *bit_info = framelist->bit_info[framelist->head]; + if (prev_discarded) { + /* Ticket #1188: when previous frame(s) was discarded, return + * 'missing' frame to trigger PLC to get smoother signal. + */ + *p_type = PJMEDIA_JB_MISSING_FRAME; + if (size) + *size = 0; + if (bit_info) + *bit_info = 0; + } else { + pj_memcpy(frame, + framelist->content + + framelist->head * framelist->frame_size, + framelist->frame_size); + *p_type = (pjmedia_jb_frame_type) + framelist->frame_type[framelist->head]; + if (size) + *size = framelist->content_len[framelist->head]; + if (bit_info) + *bit_info = framelist->bit_info[framelist->head]; + } //pj_bzero(framelist->content + // framelist->head * framelist->frame_size, |