Changeset 3292
- Timestamp:
- Aug 24, 2010 10:45:01 AM (14 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/port.h
r2506 r3292 219 219 unsigned bits_per_sample; /**< Bits/sample */ 220 220 unsigned samples_per_frame; /**< No of samples per frame. */ 221 unsigned bytes_per_frame; /**< No of samples per frame. */221 unsigned bytes_per_frame; /**< No of bytes per frame. */ 222 222 } pjmedia_port_info; 223 223 -
pjproject/trunk/pjmedia/src/pjmedia/stream.c
r3237 r3292 2031 2031 stream->codec_param.setting.frm_per_pkt / 2032 2032 1000; 2033 stream->port.info.bytes_per_frame = stream->codec_param.info.max_bps *2034 stream->codec_param.info.frm_ptime *2035 stream->codec_param.setting.frm_per_pkt /2036 8 / 1000;2037 if ((stream->codec_param.info.max_bps * stream->codec_param.info.frm_ptime *2038 stream->codec_param.setting.frm_per_pkt) % 8000 != 0)2039 {2040 ++stream->port.info.bytes_per_frame;2041 }2042 2043 2033 stream->port.info.format.id = stream->codec_param.info.fmt_id; 2044 2034 if (stream->codec_param.info.fmt_id == PJMEDIA_FORMAT_L16) { 2035 /* Raw format */ 2036 stream->port.info.bytes_per_frame = stream->port.info.samples_per_frame * 2037 stream->port.info.bits_per_sample / 8; 2038 2045 2039 stream->port.put_frame = &put_frame; 2046 2040 stream->port.get_frame = &get_frame; 2047 2041 } else { 2042 /* Encoded format */ 2043 stream->port.info.bytes_per_frame = stream->codec_param.info.max_bps * 2044 stream->codec_param.info.frm_ptime * 2045 stream->codec_param.setting.frm_per_pkt / 2046 8 / 1000; 2047 if ((stream->codec_param.info.max_bps * stream->codec_param.info.frm_ptime * 2048 stream->codec_param.setting.frm_per_pkt) % 8000 != 0) 2049 { 2050 ++stream->port.info.bytes_per_frame; 2051 } 2048 2052 stream->port.info.format.bitrate = stream->codec_param.info.avg_bps; 2049 2053 stream->port.info.format.vad = (stream->codec_param.setting.vad != 0); 2054 2050 2055 stream->port.put_frame = &put_frame; 2051 2056 stream->port.get_frame = &get_frame_ext; -
pjproject/trunk/pjsip-apps/src/samples/streamutil.c
r2408 r3292 90 90 91 91 /* Prototype */ 92 static void print_stream_stat(pjmedia_stream *stream); 92 static void print_stream_stat(pjmedia_stream *stream, 93 const pjmedia_codec_param *codec_param); 93 94 94 95 /* Prototype for LIBSRTP utility in file datatypes.c */ … … 274 275 /* Default values */ 275 276 const pjmedia_codec_info *codec_info; 277 pjmedia_codec_param codec_param; 276 278 pjmedia_dir dir = PJMEDIA_DIR_DECODING; 277 279 pj_sockaddr_in remote_addr; … … 488 490 goto on_exit; 489 491 492 /* Get codec default param for info */ 493 status = pjmedia_codec_mgr_get_default_param( 494 pjmedia_endpt_get_codec_mgr(med_endpt), 495 codec_info, 496 &codec_param); 497 /* Should be ok, as create_stream() above succeeded */ 498 pj_assert(status == PJ_SUCCESS); 490 499 491 500 /* Get the port interface of the stream */ … … 623 632 624 633 if (tmp[0] == 's') 625 print_stream_stat(stream );634 print_stream_stat(stream, &codec_param); 626 635 else if (tmp[0] == 'q') 627 636 break; … … 724 733 * Print stream statistics 725 734 */ 726 static void print_stream_stat(pjmedia_stream *stream) 735 static void print_stream_stat(pjmedia_stream *stream, 736 const pjmedia_codec_param *codec_param) 727 737 { 728 738 char duration[80], last_update[80]; … … 753 763 port->info.clock_rate, 754 764 port->info.samples_per_frame * 1000 / port->info.clock_rate, 755 good_number(bps, port->info.bytes_per_frame * port->info.clock_rate / 756 port->info.samples_per_frame), 757 good_number(ipbps, (port->info.bytes_per_frame+32) * 758 port->info.clock_rate / port->info.clock_rate)); 765 good_number(bps, (codec_param->info.avg_bps+7)/8), 766 good_number(ipbps, ((codec_param->info.avg_bps+7)/8) + 767 (40 * 1000 / 768 codec_param->setting.frm_per_pkt / 769 codec_param->info.frm_ptime))); 759 770 760 771 if (stat.rx.update_cnt == 0)
Note: See TracChangeset
for help on using the changeset viewer.