- Timestamp:
- Jun 16, 2006 3:54:43 PM (18 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/include/pj/doxygen.h
r66 r513 35 35 * @section intro_sec What is PJLIB 36 36 * 37 * PJLIB is a small foundation library written in C for making scalable38 * applications. Because of its small footprint, it can be used in embedded39 * applications (we hope so!), but yet the library is also aimed for40 * facilitating high performance protocol stacks.41 * 42 * PJLIB is released under LGPL terms.37 * PJLIB is an Open Source, small footprint framework library written in C for 38 * making scalable applications. Because of its small footprint, it can be used 39 * in embedded applications (we hope so!), but yet the library is also aimed for 40 * facilitating the creation of high performance protocol stacks. 41 * 42 * PJLIB is released under GPL terms. 43 43 * 44 44 * @section download_sec Download … … 56 56 * @subsection doc_ver_subsec Version 57 57 * 58 * This document corresponds to PJLIB version 0. 3-pre2.58 * This document corresponds to PJLIB version 0.5.6. 59 59 * 60 60 * … … 115 115 * @subsection open_source_feat It's Open Source! 116 116 * 117 * PJLIB is currently released on LGPL license. We may release PJLIB under 118 * additional schemes in the future (such as GPL or MPL) to incorporate 119 * linking with specific application, however, one thing for sure is 120 * we will NEVER be able to make PJLIB a proprietary software. 117 * PJLIB is currently released on GPL license, but other arrangements 118 * can be made with the author. 121 119 * 122 120 * @subsection extreme_portable_feat Extreme Portability … … 128 126 * It can even run in environment where no ANSI LIBC is available. 129 127 * 130 * Currently PJLIB is being ported to:131 * - x86, Win32(Win95/98/ME, NT/2000/XP/2003, mingw).132 * - x86, Linux (user mode and as <b>kernel module</b>(!)).133 * - alpha, Linux134 * And coming up:135 * - x86, eCos136 * - ultra-II, Solaris.137 * - powerpc, MacOS138 * - m68k, PalmOS.139 * - arm, PocketPC140 * 141 * No other library is known to have this extreme portability!128 * Currently PJLIB is known to run on these platforms: 129 * - Win32/x86 (Win95/98/ME, NT/2000/XP/2003, mingw). 130 * - arm, WinCE and Windows Mobile. 131 * - Linux/x86, (user mode and as <b>kernel module</b>(!)). 132 * - Linux/alpha 133 * - Solaris/ultra. 134 * - MacOS X/powerpc 135 * - RTEMS (x86 and powerpc). 136 * 137 * And efforts is under way to port PJLIB on: 138 * - Symbian OS 139 * 142 140 * 143 141 * @subsection small_size_feat Small in Size … … 152 150 * For more info, please see @ref pj_config. 153 151 * 152 * 153 * @subsection big_perform_feat Big in Performance 154 * 155 * Almost everything in PJLIB is designed to achieve the highest possible 156 * performance out of the target platform. 157 * 158 * 154 159 * @subsection no_dyn_mem No Dynamic Memory Allocations 155 160 * … … 165 170 * destroyed. 166 171 * 167 * The performance gained on some systems can be as high as 10x speed up 168 * against \a malloc() and \a free(). 172 * The performance gained on some systems can be as high as 30x speed up 173 * against \a malloc() and \a free() on certain configurations, but of 174 * course your mileage may vary. 169 175 * 170 176 * For more information, see \ref PJ_POOL_GROUP … … 384 390 * 385 391 * You MUST NOT use \a malloc() or any other memory allocation functions. 386 * Use PJLIB poolinstead! It's faster and most portable.392 * Use PJLIB @ref PJ_POOL_GROUP instead! It's faster and most portable. 387 393 * 388 394 * @subsection logging_subsubsec Use Logging for Text Display 389 395 * 390 * DO NOT use <stdio.h> for text output. Use PJLIB logginginstead.396 * DO NOT use <stdio.h> for text output. Use PJLIB @ref PJ_LOG instead. 391 397 * 392 398 * -
pjproject/trunk/pjmedia/include/pjmedia/conference.h
r492 r513 45 45 pjmedia_port_op tx_setting; /**< Transmit settings. */ 46 46 pjmedia_port_op rx_setting; /**< Receive settings. */ 47 pj_bool_t *listener; /**< Array of listeners. */ 47 unsigned listener_cnt; /**< Number of listeners. */ 48 unsigned *listener_slots; /**< Array of listeners. */ 48 49 unsigned clock_rate; /**< Clock rate of the port. */ 49 50 unsigned channel_count; /**< Number of channels. */ -
pjproject/trunk/pjmedia/include/pjmedia/types.h
r506 r513 21 21 22 22 #include <pjmedia/config.h> 23 #include <pj/sock.h> 23 #include <pj/sock.h> /* pjmedia_sock_info */ 24 #include <pj/string.h> /* pj_memcpy(), pj_memset() */ 25 24 26 25 27 /** … … 125 127 PJ_INLINE(void) pjmedia_zero_samples(pj_int16_t *samples, unsigned count) 126 128 { 129 #if 1 130 pj_memset(samples, 0, count*sizeof(pj_int16_t)); 131 #elif 0 127 132 unsigned i; 128 for (i=0; i<count; ++i) 129 samples[i] = 0; 133 for (i=0; i<count; ++i) samples[i] = 0; 134 #else 135 unsigned i; 136 count >>= 1; 137 for (i=0; i<count; ++i) ((pj_int32_t*)samples)[i] = (pj_int32_t)0; 138 #endif 130 139 } 131 140 … … 140 149 unsigned count) 141 150 { 151 #if 1 152 pj_memcpy(dst, src, count*sizeof(pj_int16_t)); 153 #elif 0 142 154 unsigned i; 143 for (i=0; i<count; ++i) 144 dst[i] = src[i]; 155 for (i=0; i<count; ++i) dst[i] = src[i]; 156 #else 157 unsigned i; 158 count >>= 1; 159 for (i=0; i<count; ++i) 160 ((pj_int32_t*)dst)[i] = ((pj_int32_t*)src)[i]; 161 #endif 145 162 } 146 163 -
pjproject/trunk/pjmedia/src/pjmedia/conference.c
r506 r513 24 24 #include <pjmedia/sound_port.h> 25 25 #include <pjmedia/stream.h> 26 #include <pj/array.h> 26 27 #include <pj/assert.h> 27 28 #include <pj/log.h> … … 58 59 59 60 #define NORMAL_LEVEL 128 61 #define SLOT_TYPE unsigned 62 #define INVALID_SLOT ((SLOT_TYPE)-1) 60 63 61 64 … … 79 82 pjmedia_port_op rx_setting; /**< Can we receive from this port */ 80 83 pjmedia_port_op tx_setting; /**< Can we transmit to this port */ 81 int listener_cnt; /**< Number of listeners. */ 82 pj_bool_t *listeners; /**< Array of listeners. */ 84 unsigned listener_cnt; /**< Number of listeners. */ 85 SLOT_TYPE *listener_slots;/**< Array of listeners. */ 86 unsigned transmitter_cnt;/**<Number of transmitters. */ 83 87 pjmedia_silence_det *vad; /**< VAD for this port. */ 84 88 … … 88 92 89 93 /* Calculated signal levels: */ 90 pj_bool_t need_tx_level; /**< Need to calculate tx level? */91 94 unsigned tx_level; /**< Last tx level to this port. */ 92 95 unsigned rx_level; /**< Last rx level from this port. */ … … 122 125 * received by this port from all other ports. Samples from all ports 123 126 * that are transmitting to this port will be accumulated here, then 124 * they will be divided by the source s countbefore the samples are put127 * they will be divided by the source level before the samples are put 125 128 * to the TX buffer of this port. 126 129 * … … 130 133 * Note that the samples here are unsigned 32bit. 131 134 */ 132 unsigned sources; /**< Number of sources. */ 135 unsigned src_level; /**< Sum of input levels */ 136 unsigned src_cnt; /**< Number of sources. */ 133 137 pj_uint32_t *mix_buf; /**< Total sum of signal. */ 134 138 … … 224 228 225 229 /* Create transmit flag array */ 226 conf_port->listeners = pj_pool_zalloc(pool, 227 conf->max_ports*sizeof(pj_bool_t)); 228 PJ_ASSERT_RETURN(conf_port->listeners, PJ_ENOMEM); 229 230 conf_port->listener_slots = pj_pool_zalloc(pool, 231 conf->max_ports * sizeof(SLOT_TYPE)); 232 PJ_ASSERT_RETURN(conf_port->listener_slots, PJ_ENOMEM); 230 233 231 234 /* Save some port's infos, for convenience. */ … … 667 670 struct conf_port *src_port, *dst_port; 668 671 pj_bool_t start_sound = PJ_FALSE; 672 unsigned i; 669 673 670 674 /* Check arguments */ … … 684 688 dst_port = conf->ports[sink_slot]; 685 689 686 if (src_port->listeners[sink_slot] == 0) { 687 src_port->listeners[sink_slot] = 1; 690 /* Check if connection has been made */ 691 for (i=0; i<src_port->listener_cnt; ++i) { 692 if (src_port->listener_slots[i] == sink_slot) 693 break; 694 } 695 696 if (i == src_port->listener_cnt) { 697 src_port->listener_slots[src_port->listener_cnt] = sink_slot; 688 698 ++conf->connect_cnt; 689 699 ++src_port->listener_cnt; 700 ++dst_port->transmitter_cnt; 690 701 691 702 if (conf->connect_cnt == 1) 692 703 start_sound = 1; 693 704 694 PJ_LOG(4,(THIS_FILE,"Port %.*s transmitting to port %.*s", 705 PJ_LOG(4,(THIS_FILE,"Port %d (%.*s) transmitting to port %d (%.*s)", 706 src_slot, 695 707 (int)src_port->name.slen, 696 708 src_port->name.ptr, 709 sink_slot, 697 710 (int)dst_port->name.slen, 698 711 dst_port->name.ptr)); … … 719 732 { 720 733 struct conf_port *src_port, *dst_port; 734 unsigned i; 721 735 722 736 /* Check arguments */ … … 733 747 dst_port = conf->ports[sink_slot]; 734 748 735 if (src_port->listeners[sink_slot] != 0) { 736 src_port->listeners[sink_slot] = 0; 749 /* Check if connection has been made */ 750 for (i=0; i<src_port->listener_cnt; ++i) { 751 if (src_port->listener_slots[i] == sink_slot) 752 break; 753 } 754 755 if (i != src_port->listener_cnt) { 756 pj_assert(src_port->listener_cnt > 0 && 757 src_port->listener_cnt < conf->max_ports); 758 pj_assert(dst_port->transmitter_cnt > 0 && 759 dst_port->transmitter_cnt < conf->max_ports); 760 pj_array_erase(src_port->listener_slots, sizeof(SLOT_TYPE), 761 src_port->listener_cnt, i); 737 762 --conf->connect_cnt; 738 763 --src_port->listener_cnt; 739 740 PJ_LOG(4,(THIS_FILE,"Port %.*s stop transmitting to port %.*s", 764 --dst_port->transmitter_cnt; 765 766 PJ_LOG(4,(THIS_FILE, 767 "Port %d (%.*s) stop transmitting to port %d (%.*s)", 768 src_slot, 741 769 (int)src_port->name.slen, 742 770 src_port->name.ptr, 771 sink_slot, 743 772 (int)dst_port->name.slen, 744 773 dst_port->name.ptr)); … … 785 814 /* Remove this port from transmit array of other ports. */ 786 815 for (i=0; i<conf->max_ports; ++i) { 816 unsigned j; 817 787 818 conf_port = conf->ports[i]; 788 819 … … 790 821 continue; 791 822 792 if (conf_port->listeners[port] != 0) { 793 --conf->connect_cnt; 794 --conf_port->listener_cnt; 795 conf_port->listeners[port] = 0; 823 if (conf_port->listener_cnt == 0) 824 continue; 825 826 for (j=0; j<conf_port->listener_cnt; ++j) { 827 if (conf_port->listener_slots[j] == port) { 828 pj_array_erase(conf_port->listener_slots, sizeof(SLOT_TYPE), 829 conf_port->listener_cnt, j); 830 --conf->connect_cnt; 831 --conf_port->listener_cnt; 832 break; 833 } 796 834 } 797 835 } 798 836 799 /* Remove all ports listening from this port. */837 /* Update conf's connection count. */ 800 838 conf_port = conf->ports[port]; 801 for (i=0; i<conf->max_ports; ++i) { 802 if (conf_port->listeners[i]) { 803 --conf->connect_cnt; 804 --conf_port->listener_cnt; 805 } 806 } 839 conf->connect_cnt -= conf_port->listener_cnt; 807 840 808 841 /* Remove the port. */ … … 865 898 info->tx_setting = conf_port->tx_setting; 866 899 info->rx_setting = conf_port->rx_setting; 867 info->listener = conf_port->listeners; 900 info->listener_cnt = conf_port->listener_cnt; 901 info->listener_slots = conf_port->listener_slots; 868 902 info->clock_rate = conf_port->clock_rate; 869 903 info->channel_count = conf->channel_count; … … 917 951 918 952 if (tx_level != NULL) { 919 conf_port->need_tx_level = 1;920 953 *tx_level = conf_port->tx_level; 921 954 } … … 1121 1154 */ 1122 1155 /* note: 1123 * the "cport->s ources==0" checking will cause discontinuous1156 * the "cport->src_level==0" checking will cause discontinuous 1124 1157 * transmission for RTP stream. 1125 1158 */ 1126 if (cport->tx_setting == PJMEDIA_PORT_MUTE || cport->s ources==0) {1159 if (cport->tx_setting == PJMEDIA_PORT_MUTE || cport->src_level==0) { 1127 1160 1128 1161 pjmedia_frame frame; … … 1144 1177 } 1145 1178 1179 buf = (pj_int16_t*)cport->mix_buf; 1180 1181 /* This is the convention set in get_frame(). For optimization purpose, 1182 * if we only have one transmitter transmitting to this port, then 1183 * the transmitter will directly copy the original 16bit frame to 1184 * mix_buf. 1185 */ 1186 if (cport->transmitter_cnt==1 && cport->src_cnt == 1) { 1187 1188 /* But still see if we need to adjust the level */ 1189 if (cport->tx_adj_level != NORMAL_LEVEL) { 1190 pj_int16_t *input = buf; 1191 pj_int32_t adj = cport->tx_adj_level; 1192 1193 for (j=0; j<conf->samples_per_frame; ++j) { 1194 pj_int32_t itemp; 1195 1196 /* For the level adjustment, we need to store the sample to 1197 * a temporary 32bit integer value to avoid overflowing the 1198 * 16bit sample storage. 1199 */ 1200 itemp = input[j]; 1201 itemp = itemp * adj / NORMAL_LEVEL; 1202 1203 /* Clip the signal if it's too loud */ 1204 if (itemp > 32767) itemp = 32767; 1205 else if (itemp < -32768) itemp = -32768; 1206 1207 input[j] = (pj_int16_t) itemp; 1208 } 1209 } 1210 1211 } 1146 1212 /* If there are sources in the mix buffer, convert the mixed samples 1147 1213 * to the mixed samples itself. This is possible because mixed sample … … 1151 1217 * TX signal, we adjust is here too. 1152 1218 */ 1153 buf = (pj_int16_t*)cport->mix_buf; 1154 1155 if (cport->tx_adj_level != NORMAL_LEVEL && cport->sources) { 1219 else if (cport->tx_adj_level != NORMAL_LEVEL && cport->src_level) { 1156 1220 1157 1221 unsigned adj_level = cport->tx_adj_level; … … 1164 1228 * 16bit signed integer. 1165 1229 */ 1166 itemp = unsigned2pcm(cport->mix_buf[j] / cport->s ources);1230 itemp = unsigned2pcm(cport->mix_buf[j] / cport->src_level); 1167 1231 1168 1232 /* Adjust the level */ … … 1177 1241 } 1178 1242 1179 } else if (cport->s ources) {1243 } else if (cport->src_level) { 1180 1244 /* No need to adjust signal level. */ 1181 1245 for (j=0; j<conf->samples_per_frame; ++j) { 1182 buf[j] = unsigned2pcm(cport->mix_buf[j] / cport->s ources);1246 buf[j] = unsigned2pcm(cport->mix_buf[j] / cport->src_level); 1183 1247 } 1184 1248 } else { 1185 1249 // Not necessarry. Buffer has been zeroed before. 1186 1250 // pjmedia_zero_samples(buf, conf->samples_per_frame); 1187 pj_assert(buf[0] == 0); 1251 //pj_assert(buf[0] == 0); 1252 1253 // This shouldn't happen. Function should've already bailed out when 1254 // cport->src_level == 0. 1255 pj_assert(0); 1188 1256 } 1189 1257 … … 1197 1265 * indication of the signal level of the port. 1198 1266 */ 1199 if (cport->need_tx_level && cport->sources) { 1200 pj_uint32_t level; 1201 1202 /* Get the signal level. */ 1203 level = pjmedia_calc_avg_signal(buf, conf->samples_per_frame); 1204 1205 /* Convert level to 8bit complement ulaw */ 1206 cport->tx_level = linear2ulaw(level) ^ 0xff; 1207 1267 if (cport->src_cnt) { 1268 cport->tx_level = cport->src_level / cport->src_cnt; 1208 1269 } else { 1209 1270 cport->tx_level = 0; … … 1311 1372 conf->bits_per_sample / 8); 1312 1373 1313 /* Must lock mutex (must we??)*/1374 /* Must lock mutex */ 1314 1375 pj_mutex_lock(conf->mutex); 1315 1376 1316 /* Zero all port's temporary buffers. */ 1377 /* Reset port source count. We will only reset port's mix 1378 * buffer when we have someone transmitting to it. 1379 */ 1317 1380 for (i=0, ci=0; i<conf->max_ports && ci < conf->port_cnt; ++i) { 1318 1381 struct conf_port *conf_port = conf->ports[i]; 1319 pj_uint32_t *mix_buf;1320 1382 1321 1383 /* Skip empty slot. */ … … 1325 1387 ++ci; 1326 1388 1327 conf_port->sources = 0; 1328 mix_buf = conf_port->mix_buf; 1329 1330 pj_memset(mix_buf, 0, conf->samples_per_frame*sizeof(mix_buf[0])); 1389 /* Reset sources */ 1390 conf_port->src_level = 0; 1391 conf_port->src_cnt = 0; 1331 1392 } 1332 1393 … … 1442 1503 conf_port->rx_level = level; 1443 1504 1505 /* Skip processing frame if level is zero */ 1506 if (level == 0) 1507 continue; 1508 1444 1509 /* Convert the buffer to unsigned 16bit value */ 1445 1510 for (j=0; j<conf->samples_per_frame; ++j) … … 1447 1512 1448 1513 /* Add the signal to all listeners. */ 1449 for (j=0, cj=0; 1450 j<conf->max_ports && cj<(unsigned)conf_port->listener_cnt; 1451 ++j) 1514 for (cj=0; cj < conf_port->listener_cnt; ++cj) 1452 1515 { 1453 struct conf_port *listener = conf->ports[j];1516 struct conf_port *listener; 1454 1517 pj_uint32_t *mix_buf; 1455 1518 unsigned k; 1456 1519 1457 if (listener == 0) 1458 continue; 1459 1460 /* Skip if this is not the listener. */ 1461 if (!conf_port->listeners[j]) 1462 continue; 1463 1464 /* Var "cj" is the number of listeners we have visited so far */ 1465 ++cj; 1520 listener = conf->ports[conf_port->listener_slots[cj]]; 1466 1521 1467 1522 /* Skip if this listener doesn't want to receive audio */ … … 1469 1524 continue; 1470 1525 1471 /* Mix the buffer */ 1526 /* Mix the buffer. If this is the first source for target port, 1527 * zero the mix buffer of target port first. 1528 */ 1472 1529 mix_buf = listener->mix_buf; 1473 for (k=0; k<conf->samples_per_frame; ++k) 1474 mix_buf[k] += (conf->uns_buf[k] * level); 1475 1476 listener->sources += level; 1530 if (listener->src_level == 0) { 1531 pj_memset(mix_buf, 0, 1532 conf->samples_per_frame*sizeof(mix_buf[0])); 1533 } 1534 1535 /* A little bit of optimization: 1536 * When "conf_port" is the only transmitter to "listener", 1537 * just add copy the frame directly from the original 1538 * 16bit frame (avoiding unsigned2pcm() conversion). 1539 * But write_port() needs to be aware of this trick! 1540 */ 1541 if (listener->transmitter_cnt == 1) { 1542 pjmedia_copy_samples((pj_int16_t*)mix_buf, 1543 frame->buf, conf->samples_per_frame); 1544 listener->src_level = level; 1545 } else { 1546 for (k=0; k<conf->samples_per_frame; ++k) 1547 mix_buf[k] += (conf->uns_buf[k] * level); 1548 1549 listener->src_level += level; 1550 } 1551 listener->src_cnt++; 1477 1552 } 1478 1553 } … … 1511 1586 1512 1587 /* Return sound playback frame. */ 1513 if (conf->ports[0]->s ources) {1588 if (conf->ports[0]->src_level) { 1514 1589 TRACE_((THIS_FILE, "write to audio, count=%d", 1515 1590 conf->samples_per_frame)); -
pjproject/trunk/pjmedia/src/pjmedia/dsound.c
r470 r513 369 369 if SUCCEEDED(hr) { 370 370 // Read from pointers. 371 CopyMemory(lpbSoundData, lpvPtr1, dwBytes1);371 pj_memcpy(lpbSoundData, lpvPtr1, dwBytes1); 372 372 if (lpvPtr2 != NULL) 373 CopyMemory(lpbSoundData+dwBytes1, lpvPtr2, dwBytes2);373 pj_memcpy(lpbSoundData+dwBytes1, lpvPtr2, dwBytes2); 374 374 375 375 // Release the data back to DirectSound. … … 408 408 } 409 409 if SUCCEEDED(hr) { 410 CopyMemory(lpvPtr1, lpbSoundData, dwBytes1);410 pj_memcpy(lpvPtr1, lpbSoundData, dwBytes1); 411 411 if (NULL != lpvPtr2) 412 CopyMemory(lpvPtr2, lpbSoundData+dwBytes1, dwBytes2);412 pj_memcpy(lpvPtr2, lpbSoundData+dwBytes1, dwBytes2); 413 413 414 414 hr = IDirectSoundBuffer_Unlock(lpDsb, lpvPtr1, dwBytes1, lpvPtr2, dwBytes2); -
pjproject/trunk/pjmedia/src/pjmedia/resample.c
r495 r513 59 59 * - move stddefs.h and resample.h to this file. 60 60 * - const correctness. 61 * - fixed SrcLinear() may write pass output buffer.62 * - assume the same for SrcUp() and SrcUD(), so put the same63 * protection.64 61 */ 65 62 #include <pjmedia/resample.h> … … 261 258 Yend = Ystart + (unsigned)(nx * pFactor); 262 259 endTime = time + (1<<Np)*(WORD)nx; 263 while (time < endTime && Y < Yend) /* bennylp fix: added Y < Yend */260 while (time < endTime) 264 261 { 265 262 iconst = (time) & Pmask; … … 400 397 Yend = Ystart + (unsigned)(nx * pFactor); 401 398 endTime = time + (1<<Np)*(WORD)nx; 402 while (time < endTime && Y < Yend) /* bennylp fix: protect Y */399 while (time < endTime) 403 400 { 404 401 xp = &X[time>>Np]; /* Ptr to current input sample */ … … 444 441 Yend = Ystart + (unsigned)(nx * pFactor); 445 442 endTime = time + (1<<Np)*(WORD)nx; 446 while (time < endTime && Y < Yend) /* bennylp fix: protect Y */443 while (time < endTime) 447 444 { 448 445 xp = &X[time>>Np]; /* Ptr to current input sample */ … … 496 493 /* 497 494 * If we're downsampling, always use the fast algorithm since it seems 498 * to yield the same performance.495 * to yield the same quality. 499 496 */ 500 497 if (rate_out < rate_in) { 498 //no this is not a good idea. It sounds pretty good with speech, 499 //but very poor with background noise etc. 501 500 //high_quality = 0; 502 501 } … … 534 533 if (high_quality) { 535 534 unsigned size; 536 unsigned i;537 535 538 536 /* This is a bug in xoff calculation, thanks Stephane Lussier … … 552 550 PJ_ASSERT_RETURN(resample->buffer, PJ_ENOMEM); 553 551 554 for (i=0; i<resample->xoff*2; ++i) { 555 resample->buffer[i] = 0; 556 } 552 pjmedia_zero_samples(resample->buffer, resample->xoff*2); 557 553 558 554 … … 562 558 563 559 *p_resample = resample; 560 561 PJ_LOG(5,(THIS_FILE, "resample created: %s qualiy, %s filter, in/out " 562 "rate=%d/%d", 563 (high_quality?"high":"low"), 564 (large_filter?"large":"small"), 565 rate_in, rate_out)); 564 566 return PJ_SUCCESS; 565 567 } … … 574 576 575 577 if (resample->high_quality) { 576 unsigned i;577 578 pj_int16_t *dst_buf; 578 579 const pj_int16_t *src_buf; … … 645 646 */ 646 647 dst_buf = resample->buffer + resample->xoff*2; 647 for (i=0; i<resample->frame_size; ++i) dst_buf[i] = input[i];648 pjmedia_copy_samples(dst_buf, input, resample->frame_size); 648 649 649 650 if (resample->factor >= 1) { … … 689 690 dst_buf = resample->buffer; 690 691 src_buf = input + resample->frame_size - resample->xoff*2; 691 for (i=0; i<resample->xoff * 2; ++i) { 692 dst_buf[i] = src_buf[i]; 693 } 692 pjmedia_copy_samples(dst_buf, src_buf, resample->xoff * 2); 694 693 695 694 } else { -
pjproject/trunk/pjsip-apps/build/Samples-vc.mak
r464 r513 37 37 38 38 SAMPLES = $(BINDIR)\confsample.exe \ 39 $(BINDIR)\confbench.exe \ 39 40 $(BINDIR)\level.exe \ 40 41 $(BINDIR)\playfile.exe \ -
pjproject/trunk/pjsip-apps/build/samples.dsp
r464 r513 87 87 # Begin Source File 88 88 89 SOURCE=..\src\samples\confbench.c 90 # End Source File 91 # Begin Source File 92 89 93 SOURCE=..\src\samples\confsample.c 90 94 # End Source File -
pjproject/trunk/pjsip-apps/src/samples/confsample.c
r412 r513 476 476 477 477 txlist[0] = '\0'; 478 for (j=0; j< count; ++j) {478 for (j=0; j<port_info->listener_cnt; ++j) { 479 479 char s[10]; 480 if (port_info->listener[j]) { 481 pj_ansi_sprintf(s, "#%d ", j); 482 pj_ansi_strcat(txlist, s); 483 } 480 pj_ansi_sprintf(s, "#%d ", port_info->listener_slots[j]); 481 pj_ansi_strcat(txlist, s); 482 484 483 } 485 484 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r507 r513 549 549 550 550 /* Build array of listeners */ 551 count = pjsua_var.media_cfg.max_media_ports; 552 for (i=0; i<count; ++i) { 553 if (cinfo.listener[i]) { 554 info->listeners[info->listener_cnt++] = i; 555 } 551 info->listener_cnt = cinfo.listener_cnt; 552 for (i=0; i<cinfo.listener_cnt; ++i) { 553 info->listeners[i] = cinfo.listener_slots[i]; 556 554 } 557 555
Note: See TracChangeset
for help on using the changeset viewer.