Ignore:
Timestamp:
Jan 31, 2008 8:11:30 AM (16 years ago)
Author:
bennylp
Message:

Ticket #464: jitter buffer should return frame length information

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/jbuf.c

    r1266 r1761  
    3535    char        *flist_buffer; 
    3636    int         *flist_frame_type; 
     37    pj_size_t   *flist_content_len; 
    3738    unsigned     flist_frame_size; 
    3839    unsigned     flist_max_count; 
     
    110111                                framelist->flist_max_count); 
    111112 
     113    framelist->flist_content_len = (pj_size_t*) 
     114        pj_pool_zalloc(pool, sizeof(framelist->flist_content_len[0]) *  
     115                                framelist->flist_max_count); 
     116 
    112117    framelist->flist_empty = 1; 
    113118 
     
    135140 
    136141static pj_bool_t jb_framelist_get(jb_framelist_t *framelist, 
    137                                   void *frame, 
     142                                  void *frame, pj_size_t *size, 
    138143                                  pjmedia_jb_frame_type *p_type)  
    139144{ 
     
    145150        *p_type = (pjmedia_jb_frame_type)  
    146151                  framelist->flist_frame_type[framelist->flist_head]; 
     152        *size   = framelist->flist_content_len[framelist->flist_head]; 
    147153 
    148154        pj_bzero(framelist->flist_buffer +  
     
    151157        framelist->flist_frame_type[framelist->flist_head] =  
    152158            PJMEDIA_JB_MISSING_FRAME; 
     159        framelist->flist_content_len[framelist->flist_head] = 0; 
    153160 
    154161        framelist->flist_origin++; 
     
    195202                  PJMEDIA_JB_MISSING_FRAME, 
    196203                  step1*sizeof(framelist->flist_frame_type[0])); 
     204        pj_bzero(framelist->flist_content_len+framelist->flist_head, 
     205                  step1*sizeof(framelist->flist_content_len[0])); 
    197206 
    198207        if (step2) { 
     
    202211                      PJMEDIA_JB_MISSING_FRAME, 
    203212                      step2*sizeof(framelist->flist_frame_type[0])); 
     213            pj_bzero (framelist->flist_content_len, 
     214                      step2*sizeof(framelist->flist_content_len[0])); 
    204215        } 
    205216 
     
    258269 
    259270    framelist->flist_frame_type[where] = PJMEDIA_JB_NORMAL_FRAME; 
     271    framelist->flist_content_len[where] = frame_size; 
    260272 
    261273    return PJ_TRUE; 
     
    511523                                     char *p_frame_type) 
    512524{ 
     525    pj_size_t size; 
     526 
     527    pjmedia_jbuf_get_frame2(jb, frame, &size, p_frame_type); 
     528} 
     529 
     530/* 
     531 * Get frame from jitter buffer. 
     532 */ 
     533PJ_DEF(void) pjmedia_jbuf_get_frame2(pjmedia_jbuf *jb,  
     534                                     void *frame,  
     535                                     pj_size_t *size, 
     536                                     char *p_frame_type) 
     537{ 
    513538    pjmedia_jb_frame_type ftype; 
    514539 
     
    531556            *p_frame_type = PJMEDIA_JB_ZERO_PREFETCH_FRAME; 
    532557 
     558        *size = 0; 
     559 
    533560        return; 
    534561    } 
    535562 
    536563    /* Retrieve a frame from frame list */ 
    537     if (jb_framelist_get(&jb->jb_framelist,frame,&ftype) == PJ_FALSE) { 
     564    if (jb_framelist_get(&jb->jb_framelist,frame,size,&ftype) == PJ_FALSE) { 
    538565        /* Can't return frame because jitter buffer is empty! */ 
    539566        pj_bzero(frame, jb->jb_frame_size); 
    540567        *p_frame_type = PJMEDIA_JB_ZERO_EMPTY_FRAME; 
     568        *size = 0; 
    541569 
    542570        return; 
Note: See TracChangeset for help on using the changeset viewer.