- Timestamp:
- Mar 5, 2006 11:51:10 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-codec/speex_codec.c
r278 r282 677 677 { 678 678 struct spx_private *spx; 679 float tmp[64 0]; /* 20ms at 32KHz*/679 float tmp[642]; /* 20ms at 32KHz + 2 */ 680 680 pj_int16_t *samp_in; 681 unsigned i, samp_count ;681 unsigned i, samp_count, sz; 682 682 683 683 spx = (struct spx_private*) codec->codec_data; … … 693 693 /* Copy frame to float buffer. */ 694 694 samp_count = input->size / 2; 695 pj_assert(samp_count <= PJ_ARRAY_SIZE(tmp)); 695 696 samp_in = input->buf; 696 697 for (i=0; i<samp_count; ++i) { … … 703 704 /* Encode the frame */ 704 705 speex_encode(spx->enc, tmp, &spx->enc_bits); 706 707 /* Check size. */ 708 sz = speex_bits_nbytes(&spx->enc_bits); 709 pj_assert(sz <= output_buf_len); 705 710 706 711 /* Copy the bits to an array of char that can be written */ … … 722 727 { 723 728 struct spx_private *spx; 724 float tmp[64 0]; /* 20ms at 32KHz*/729 float tmp[642]; /* 20ms at 32KHz + 2 */ 725 730 pj_int16_t *dst_buf; 726 unsigned i, count ;731 unsigned i, count, sz; 727 732 728 733 spx = (struct spx_private*) codec->codec_data; … … 745 750 speex_decode(spx->dec, &spx->dec_bits, tmp); 746 751 752 /* Check size. */ 753 sz = speex_bits_nbytes(&spx->enc_bits); 754 pj_assert(sz <= output_buf_len); 755 756 /* Copy from float to short samples. */ 747 757 count = spx_factory.speex_param[spx->param_id].clock_rate * 20 / 1000; 758 pj_assert((count <= output_buf_len/2) && count <= PJ_ARRAY_SIZE(tmp)); 748 759 dst_buf = output->buf; 749 760 for (i=0; i<count; ++i) {
Note: See TracChangeset
for help on using the changeset viewer.