Changeset 343 for pjproject/trunk
- Timestamp:
- Mar 20, 2006 5:42:37 PM (19 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/samples/confsample.c
r337 r343 20 20 #include <pjmedia.h> 21 21 22 /* 23 * FILE: 24 * 25 * confsample.c 26 * 27 * PURPOSE: 28 * 29 * Demonstrate how to use conference bridge. 30 * 31 * USAGE: 32 * 33 * confsample [file1.wav] [file2.wav] ... 34 * 35 * where: 36 * fileN.wav are optional WAV files to be connected to the conference 37 * bridge. The WAV files MUST have single channel (mono) and 16 bit PCM 38 * samples. It can have arbitrary sampling rate. 39 * 40 * DESCRIPTION: 41 * 42 * Here we create a conference bridge, with at least one port (port zero 43 * is always created for the sound device). 44 * 45 * If WAV files are specified, the WAV file player ports will be connected 46 * to slot starting from number one in the bridge. The WAV files can have 47 * arbitrary sampling rate; the bridge will convert it to its clock rate. 48 * However, the files MUST have a single audio channel only (i.e. mono). 49 */ 22 static const char *desc = 23 " FILE: \n" 24 " \n" 25 " confsample.c \n" 26 " \n" 27 " PURPOSE: \n" 28 " \n" 29 " Demonstrate how to use conference bridge. \n" 30 " \n" 31 " USAGE: \n" 32 " \n" 33 " confsample [file1.wav] [file2.wav] ... \n" 34 " \n" 35 " where: \n" 36 " fileN.wav are optional WAV files to be connected to the conference \n" 37 " bridge. The WAV files MUST have single channel (mono) and 16 bit PCM \n" 38 " samples. It can have arbitrary sampling rate. \n" 39 " \n" 40 " DESCRIPTION: \n" 41 " \n" 42 " Here we create a conference bridge, with at least one port (port zero \n" 43 " is always created for the sound device). \n" 44 " \n" 45 " If WAV files are specified, the WAV file player ports will be connected \n" 46 " to slot starting from number one in the bridge. The WAV files can have \n" 47 " arbitrary sampling rate; the bridge will convert it to its clock rate. \n" 48 " However, the files MUST have a single audio channel only (i.e. mono). \n"; 50 49 51 50 #include <pjmedia.h> … … 59 58 #define THIS_FILE "confsample.c" 60 59 60 /* Constants */ 61 #define CLOCK_RATE 44100 62 #define NSAMPLES (CLOCK_RATE * 20 / 1000) 63 #define NCHANNELS 1 64 #define NBITS 16 65 66 61 67 /* 62 68 * Prototypes: … … 174 180 status = pjmedia_conf_create( pool, /* pool to use */ 175 181 port_count,/* number of ports */ 176 16000,/* sampling rate */177 1,/* # of channels. */178 320,/* samples per frame */179 16,/* bits per sample */182 CLOCK_RATE,/* sampling rate */ 183 NCHANNELS,/* # of channels. */ 184 NSAMPLES, /* samples per frame */ 185 NBITS, /* bits per sample */ 180 186 0, /* options */ 181 187 &conf /* result */ -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r318 r343 181 181 pjmedia_endpt *med_endpt; /**< Media endpoint. */ 182 182 unsigned clock_rate; /**< Internal clock rate. */ 183 pj_bool_t has_wb; /**< Include wideband codecs */ 184 pj_bool_t has_uwb; /**< Include ultra-wideband codecs */ 183 185 pjmedia_conf *mconf; /**< Media conference. */ 184 186 pj_bool_t null_audio; /**< Null audio flag. */ -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r322 r343 78 78 79 79 /* Default for media: */ 80 #if defined(PJ_DARWINOS) && PJ_DARWINOS!=0 81 pjsua.clock_rate = 44100; 82 #else 80 83 pjsua.clock_rate = 8000; 84 #endif 81 85 pjsua.complexity = -1; 82 86 pjsua.quality = 4; 87 pjsua.has_wb = 0; 88 pjsua.has_uwb = 0; 83 89 84 90 … … 622 628 623 629 /* Register speex. */ 624 if (pjsua. clock_rate >= 16000)625 option &= ~ (PJMEDIA_SPEEX_NO_WB);626 if (pjsua. clock_rate >= 32000)627 option &= ~ (PJMEDIA_SPEEX_NO_UWB);630 if (pjsua.has_wb) 631 option &= ~PJMEDIA_SPEEX_NO_WB; 632 if (pjsua.has_uwb) 633 option &= ~PJMEDIA_SPEEX_NO_UWB; 628 634 629 635 status = pjmedia_codec_speex_init(pjsua.med_endpt, option, … … 690 696 691 697 /* Register speex. */ 692 if (pjsua. clock_rate >= 16000)698 if (pjsua.has_wb) 693 699 option &= ~(PJMEDIA_SPEEX_NO_WB); 694 if (pjsua. clock_rate >= 32000)700 if (pjsua.has_uwb) 695 701 option &= ~(PJMEDIA_SPEEX_NO_UWB); 696 702 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_settings.c
r325 r343 87 87 puts (" --wb Enable wideband codecs and set clock-rate to 16KHz"); 88 88 puts (" --uwb Enable ultra-wideband codecs and set clock-rate to 32KHz"); 89 puts (" --clock-rate=N Override sound device clock rate"); 89 90 puts (" --null-audio Use NULL audio device"); 90 91 puts (" --no-mic Disable microphone device"); … … 227 228 OPT_ADD_BUDDY, OPT_OFFER_X_MS_MSG, OPT_NO_PRESENCE, 228 229 OPT_AUTO_ANSWER, OPT_AUTO_HANGUP, OPT_AUTO_PLAY, OPT_AUTO_LOOP, 229 OPT_AUTO_CONF, 230 OPT_AUTO_CONF, OPT_CLOCK_RATE, 230 231 OPT_PLAY_FILE, OPT_WB, OPT_UWB, OPT_RTP_PORT, OPT_ADD_CODEC, 231 232 OPT_COMPLEXITY, OPT_QUALITY, … … 242 243 { "wb", 0, 0, OPT_WB}, 243 244 { "uwb", 0, 0, OPT_UWB}, 245 { "clock-rate", 1, 0, OPT_CLOCK_RATE}, 244 246 { "null-audio", 0, 0, OPT_NULL_AUDIO}, 245 247 { "no-mic", 0, 0, OPT_NO_MIC}, … … 352 354 353 355 case OPT_WB: 354 pjsua. clock_rate = 16000;356 pjsua.has_wb = 1; 355 357 break; 356 358 357 359 case OPT_UWB: 358 pjsua.clock_rate = 32000; 360 pjsua.has_uwb = 1; 361 break; 362 363 case OPT_CLOCK_RATE: 364 lval = pj_strtoul(pj_cstr(&tmp, pj_optarg)); 365 if (lval < 8000 || lval > 48000) { 366 printf("Error: expecting value between 8000-48000 for clock rate\n"); 367 return PJ_EINVAL; 368 } 369 pjsua.clock_rate = (int)lval; 359 370 break; 360 371 … … 573 584 return PJ_EINVAL; 574 585 } 586 587 /* Adjust clock rate */ 588 if (pjsua.clock_rate == 8000 && pjsua.has_uwb) 589 pjsua.clock_rate = 32000; 590 else if (pjsua.clock_rate == 8000 && pjsua.has_wb) 591 pjsua.clock_rate = 16000; 575 592 576 593 return PJ_SUCCESS; … … 906 923 } 907 924 /* Media clock rate. */ 908 if (pjsua. clock_rate >= 32000)925 if (pjsua.has_uwb) 909 926 pj_strcat2(&cfg, "--uwb\n"); 910 else if (pjsua.clock_rate >= 16000) 927 928 if (pjsua.has_wb) 911 929 pj_strcat2(&cfg, "--wb\n"); 930 931 pj_ansi_sprintf(line, "--clock-rate %d\n", 932 pjsua.clock_rate); 933 pj_strcat2(&cfg, line); 934 912 935 913 936 /* Encoding quality and complexity */
Note: See TracChangeset
for help on using the changeset viewer.