- Timestamp:
- May 14, 2006 10:54:44 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/stream.c
r438 r440 428 428 429 429 for (ts=0; ts<ts_len; ts += samples_per_frame) { 430 pjmedia_frame tmp_frame; 431 unsigned max_size; 432 433 tmp_frame.buf = ((char*)frame_out.buf) + frame_out.size; 430 pjmedia_frame tmp_out_frame, tmp_in_frame; 431 unsigned bytes_per_sample, max_size; 432 433 bytes_per_sample = stream->codec_param.info.pcm_bits_per_sample/8; 434 435 tmp_in_frame.buf = ((char*)frame->buf) + ts * bytes_per_sample; 436 tmp_in_frame.size = samples_per_frame * bytes_per_sample; 437 tmp_in_frame.type = PJMEDIA_FRAME_TYPE_AUDIO; 438 439 tmp_out_frame.buf = ((char*)frame_out.buf) + frame_out.size; 434 440 435 441 max_size = channel->out_pkt_size - sizeof(pjmedia_rtp_hdr) - 436 442 frame_out.size; 437 443 438 status = stream->codec->op->encode( stream->codec, frame, 439 max_size, 440 &tmp_frame); 444 status = stream->codec->op->encode( stream->codec, &tmp_in_frame, 445 max_size, &tmp_out_frame); 441 446 if (status != PJ_SUCCESS) { 442 447 LOGERR_((stream->port.info.name.ptr, … … 445 450 } 446 451 447 frame_out.size += tmp_ frame.size;452 frame_out.size += tmp_out_frame.size; 448 453 } 449 454 … … 712 717 enum { MAX = 16 }; 713 718 pj_timestamp ts; 714 unsigned i, count; 719 unsigned i, count = MAX; 720 unsigned samples_per_frame; 715 721 pjmedia_frame frames[MAX]; 716 722 … … 733 739 734 740 /* Put each frame to jitter buffer. */ 741 samples_per_frame = stream->codec_param.info.frm_ptime * 742 stream->codec_param.info.clock_rate * 743 stream->codec_param.info.channel_cnt / 744 1000; 745 735 746 for (i=0; i<count; ++i) { 736 747 unsigned ext_seq; 737 748 738 749 ext_seq = (unsigned)(frames[i].timestamp.u64 / 739 s tream->port.info.samples_per_frame);750 samples_per_frame); 740 751 pjmedia_jbuf_put_frame(stream->jb, frames[i].buf, 741 752 frames[i].size, ext_seq);
Note: See TracChangeset
for help on using the changeset viewer.