Changeset 1761
- Timestamp:
- Jan 31, 2008 8:11:30 AM (17 years ago)
- Location:
- pjproject/trunk/pjmedia
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/jbuf.h
r974 r1761 236 236 char *p_frm_type); 237 237 238 /** 239 * Get a frame from the jitter buffer. The jitter buffer will return the 240 * oldest frame from it's buffer, when it is available. 241 * 242 * @param jb The jitter buffer. 243 * @param frame Buffer to receive the payload from the jitter buffer. 244 * @see pjmedia_jbuf_get_frame(). 245 * @param size Pointer to receive frame size. 246 * @param p_frm_type Pointer to receive frame type. 247 * @see pjmedia_jbuf_get_frame(). 248 */ 249 PJ_DECL(void) pjmedia_jbuf_get_frame2(pjmedia_jbuf *jb, 250 void *frame, 251 pj_size_t *size, 252 char *p_frm_type); 253 238 254 239 255 /** -
pjproject/trunk/pjmedia/src/pjmedia/jbuf.c
r1266 r1761 35 35 char *flist_buffer; 36 36 int *flist_frame_type; 37 pj_size_t *flist_content_len; 37 38 unsigned flist_frame_size; 38 39 unsigned flist_max_count; … … 110 111 framelist->flist_max_count); 111 112 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 112 117 framelist->flist_empty = 1; 113 118 … … 135 140 136 141 static pj_bool_t jb_framelist_get(jb_framelist_t *framelist, 137 void *frame, 142 void *frame, pj_size_t *size, 138 143 pjmedia_jb_frame_type *p_type) 139 144 { … … 145 150 *p_type = (pjmedia_jb_frame_type) 146 151 framelist->flist_frame_type[framelist->flist_head]; 152 *size = framelist->flist_content_len[framelist->flist_head]; 147 153 148 154 pj_bzero(framelist->flist_buffer + … … 151 157 framelist->flist_frame_type[framelist->flist_head] = 152 158 PJMEDIA_JB_MISSING_FRAME; 159 framelist->flist_content_len[framelist->flist_head] = 0; 153 160 154 161 framelist->flist_origin++; … … 195 202 PJMEDIA_JB_MISSING_FRAME, 196 203 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])); 197 206 198 207 if (step2) { … … 202 211 PJMEDIA_JB_MISSING_FRAME, 203 212 step2*sizeof(framelist->flist_frame_type[0])); 213 pj_bzero (framelist->flist_content_len, 214 step2*sizeof(framelist->flist_content_len[0])); 204 215 } 205 216 … … 258 269 259 270 framelist->flist_frame_type[where] = PJMEDIA_JB_NORMAL_FRAME; 271 framelist->flist_content_len[where] = frame_size; 260 272 261 273 return PJ_TRUE; … … 511 523 char *p_frame_type) 512 524 { 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 */ 533 PJ_DEF(void) pjmedia_jbuf_get_frame2(pjmedia_jbuf *jb, 534 void *frame, 535 pj_size_t *size, 536 char *p_frame_type) 537 { 513 538 pjmedia_jb_frame_type ftype; 514 539 … … 531 556 *p_frame_type = PJMEDIA_JB_ZERO_PREFETCH_FRAME; 532 557 558 *size = 0; 559 533 560 return; 534 561 } 535 562 536 563 /* 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) { 538 565 /* Can't return frame because jitter buffer is empty! */ 539 566 pj_bzero(frame, jb->jb_frame_size); 540 567 *p_frame_type = PJMEDIA_JB_ZERO_EMPTY_FRAME; 568 *size = 0; 541 569 542 570 return; -
pjproject/trunk/pjmedia/src/pjmedia/stream.c
r1667 r1761 193 193 { 194 194 char frame_type; 195 pj_size_t frame_size; 195 196 196 197 /* Get frame from jitter buffer. */ 197 pjmedia_jbuf_get_frame(stream->jb, channel->out_pkt, &frame_type); 198 pjmedia_jbuf_get_frame2(stream->jb, channel->out_pkt, &frame_size, 199 &frame_type); 198 200 199 201 if (frame_type == PJMEDIA_JB_MISSING_FRAME) { … … 326 328 /* Decode */ 327 329 frame_in.buf = channel->out_pkt; 328 frame_in.size = stream->frame_size;330 frame_in.size = frame_size; 329 331 frame_in.type = PJMEDIA_FRAME_TYPE_AUDIO; /* ignored */ 330 332
Note: See TracChangeset
for help on using the changeset viewer.