- Timestamp:
- Jun 6, 2018 8:38:29 AM (6 years ago)
- Location:
- pjproject/trunk/pjmedia
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/jbuf.h
r5734 r5803 282 282 * @param bit_info Bit precise info of the frame, e.g: a frame may not 283 283 * exactly start and end at the octet boundary, so this 284 * field may be used for specifying start & end bit offset. 284 * field may be used for specifying start & end bit 285 * offset. 285 286 * @param frame_seq The frame sequence number. 286 287 * @param discarded Flag whether the frame is discarded by jitter buffer. … … 307 308 * @param bit_info Bit precise info of the frame, e.g: a frame may not 308 309 * exactly start and end at the octet boundary, so this 309 * field may be used for specifying start & end bit offset. 310 * field may be used for specifying start & end bit 311 * offset. 310 312 * @param frame_seq The frame sequence number. 311 313 * @param frame_ts The frame timestamp. … … 355 357 * @param frame Buffer to receive the payload from the jitter buffer. 356 358 * @see pjmedia_jbuf_get_frame(). 357 * @param size Pointer to receive frame size. 359 * @param size On input, it points to maximum buffer length. 360 * On output, it will be filled with received frame size. 358 361 * @param p_frm_type Pointer to receive frame type. 359 362 * @see pjmedia_jbuf_get_frame(). 360 363 * @param bit_info Bit precise info of the frame, e.g: a frame may not 361 364 * exactly start and end at the octet boundary, so this 362 * field may be used for specifying start & end bit offset. 365 * field may be used for specifying start & end bit 366 * offset. 363 367 */ 364 368 PJ_DECL(void) pjmedia_jbuf_get_frame2(pjmedia_jbuf *jb, … … 376 380 * @param frame Buffer to receive the payload from the jitter buffer. 377 381 * @see pjmedia_jbuf_get_frame(). 378 * @param size Pointer to receive frame size. 382 * @param size On input, it points to maximum buffer length. 383 * On output, it will be filled with received frame size. 379 384 * @param p_frm_type Pointer to receive frame type. 380 385 * @see pjmedia_jbuf_get_frame(). 381 386 * @param bit_info Bit precise info of the frame, e.g: a frame may not 382 387 * exactly start and end at the octet boundary, so this 383 * field may be used for specifying start & end bit offset. 388 * field may be used for specifying start & end bit 389 * offset. 384 390 * @param ts Frame timestamp. 385 391 * @param seq Frame sequence number. … … 407 413 * @param bit_info Bit precise info of the frame, e.g: a frame may not 408 414 * exactly start and end at the octet boundary, so this 409 * field may be used for specifying start & end bit offset. 415 * field may be used for specifying start & end bit 416 * offset. 410 417 * @param ts Frame timestamp. 411 418 * @param seq Frame sequence number. -
pjproject/trunk/pjmedia/src/pjmedia/jbuf.c
r5734 r5803 296 296 *bit_info = 0; 297 297 } else { 298 pj_size_t frm_size = framelist->content_len[framelist->head]; 299 pj_size_t max_size = size? *size : frm_size; 300 pj_size_t copy_size = PJ_MIN(max_size, frm_size); 301 302 /* Buffer size should not be smaller than frame size. */ 303 if (max_size < frm_size) { 304 pj_assert(!"Buffer too small"); 305 PJ_LOG(4, (THIS_FILE, "Warning: buffer too small for the " 306 "retrieved frame!")); 307 } 308 298 309 pj_memcpy(frame, 299 310 framelist->content + 300 311 framelist->head * framelist->frame_size, 301 framelist->frame_size);312 copy_size); 302 313 *p_type = (pjmedia_jb_frame_type) 303 314 framelist->frame_type[framelist->head]; 304 315 if (size) 305 *size = framelist->content_len[framelist->head];316 *size = copy_size; 306 317 if (bit_info) 307 318 *bit_info = framelist->bit_info[framelist->head]; … … 988 999 cur_size = jb_framelist_eff_size(&jb->jb_framelist); 989 1000 1001 /* Check if frame size is larger than JB frame size */ 1002 if (frame_size > jb->jb_frame_size) { 1003 PJ_LOG(4, (THIS_FILE, "Warning: frame too large for jitter buffer, " 1004 "it will be truncated!")); 1005 } 1006 990 1007 /* Attempt to store the frame */ 991 1008 min_frame_size = PJ_MIN(frame_size, jb->jb_frame_size); -
pjproject/trunk/pjmedia/src/pjmedia/stream.c
r5799 r5803 87 87 unsigned out_pkt_size; /**< Size of output buffer. */ 88 88 void *out_pkt; /**< Output buffer. */ 89 unsigned out_pkt_len; /**< Length of data in buffer. */90 89 pjmedia_rtp_session rtp; /**< RTP session. */ 91 90 }; … … 531 530 for (samples_count=0; samples_count < samples_required;) { 532 531 char frame_type; 533 pj_size_t frame_size ;532 pj_size_t frame_size = channel->out_pkt_size; 534 533 pj_uint32_t bit_info; 535 534 … … 822 821 while (f->samples_cnt < samples_required) { 823 822 char frame_type; 824 pj_size_t frame_size ;823 pj_size_t frame_size = channel->out_pkt_size; 825 824 pj_uint32_t bit_info; 826 825 … … 2077 2076 2078 2077 if (param->type == PJMEDIA_TYPE_AUDIO) { 2079 channel->out_pkt_size = sizeof(pjmedia_rtp_hdr) + 2080 stream->codec_param.info.max_bps * 2081 PJMEDIA_MAX_FRAME_DURATION_MS / 2082 8 / 1000; 2078 unsigned max_rx_based_size; 2079 unsigned max_bps_based_size; 2080 2081 /* out_pkt buffer is used for sending and receiving, so lets calculate 2082 * its size based on both. For receiving, we have stream->frame_size, 2083 * which is used in configuring jitter buffer frame length. 2084 * For sending, it is based on codec max_bps info. 2085 */ 2086 max_rx_based_size = stream->frame_size; 2087 max_bps_based_size = stream->codec_param.info.max_bps * 2088 PJMEDIA_MAX_FRAME_DURATION_MS / 8 / 1000; 2089 channel->out_pkt_size = PJ_MAX(max_rx_based_size, max_bps_based_size); 2090 2091 /* Also include RTP header size (for sending) */ 2092 channel->out_pkt_size += sizeof(pjmedia_rtp_hdr); 2093 2083 2094 if (channel->out_pkt_size > PJMEDIA_MAX_MTU - 2084 2095 PJMEDIA_STREAM_RESV_PAYLOAD_LEN)
Note: See TracChangeset
for help on using the changeset viewer.