Hi, Perhaps the problem starts from different supported sample rates between recorder and player (kind of weird!), while by default pjsua (& snd_test) will only open recorder & player with the same sample rate. So, if that's the case, I am afraid running sample application pjsua won't be straight away, some modifications may be needed. Here are some tricky steps on application level (pjsua_app.c) that theoretically should work, I have never tried this myself though: - make sure recfile works fine with sample rate 24kHz. - create a custom function to setup the sound device in pjsua_app.c, here is the pseudocode: setup_own_sound_device() { pjmedia_port *conf, *resample; pjmedia_snd_port *player, *recorder; unsigned opt; /* disable sound & get master port of conf bridge */ conf = pjsua_set_no_snd_dev(); /* setup recorder */ pjmedia_snd_port_create_rec(pool, -1 /* dev id */, 24000, ... , &recorder); opt = PJMEDIA_RESAMPLE_USE_SMALL_FILTER; pjmedia_resample_port_create(pool, conf, 24000, opt, &resample); pjmedia_snd_port_connect(recorder, resample); /* setup player */ pjmedia_snd_port_create_player(pool, -1 /* dev id */, 48000, ... , &player); pjmedia_snd_port_connect(player, conf); } - put a call to setup_own_sound_device() in app_init() of pjsua_app.c - run pjsua with --clock-rate 48000 and --null-audio However, since it seems you are working on embedded linux which may have limited processing speed, I think it would be better to use sound device with support for sample rate 8 or 16kHz (which are commonly used by voice codecs) to reduce processing on resampling, please note that the resample above is using small filter for processing load reason (or you may use linear, it will be much lighter). And also a sound device that supports for symmetric sample rate might be nice :) Regards, nanang On Sat, Nov 15, 2008 at 3:20 PM, fukunaga <fukunaga at cew.co.jp> wrote: > Hi all, > > I examined my problem and found that option --clock-rate is needed(?). > From 'dmesg' USB audio has > usbaudio: valid input sample rate 24000 > usbaudio: valid output sample rate 48000 > > If I use 48k wav file, 'playfile' works good! > But 'pjsua' stalls. > ------------------------------------------------------------------------ > [root at a220-0 (ttyAM0) /mnt/nand/pjsip/pjsip-apps/bin]# > ./pjsua-arm-unknown-linux-gnu --play-file /mnt/nand/EBalloon_48.wav > --clock-rate=24000 --app-log-level=5 > > ..... > >>>> cl > Conference ports: > Port #00[24KHz/20ms/1] Master/sound transmitting to: > Port #01[48KHz/20ms/1] /mnt/nand/EBalloon_48.wav transmitting to: > Port #02[24KHz/20ms/1] ringback transmitting to: > Port #03[24KHz/20ms/1] ring transmitting to: >>>> cc 1 0 > 12:58:51.820 pjsua_media.c pjsua_set_snd_dev(): attempting to open > devices @24000 Hz > 12:58:51.838 pasound.c Opened device /dev/dsp(OSS)//dev/dsp(OSS) for > recording and playback, sample rate=24000, ch=1, bits=16, 480 samples per > frame, input latency=85 ms, output latency=85 ms > 12:58:51.839 pasound.c Starting /dev/dsp stream.. > ------------------------------------------------------------------------ > > What happends???? > > Regards, > fukunaga > > > > At 15:50 08/11/14, you wrote: >> >> Hi, >> >> I tried to run pjsua on enbedded linux( Armadillo-220 ) with USB audio >> device. >> Error message "Invalid sample rate" occurs when I test --play-file as >> follows. >> >> ------------------------------------------------------------------------ >> ./pjsua-arm-unknown-linux-gnu --play-file /mnt/nand/DBaloon.wav >> >> >>> cl >> Conference ports: >> Port #00[16KHz/20ms/1] Master/sound transmitting to: >> Port #01[16KHz/20ms/1] /mnt/nand/DBaloon.wav transmitting to: >> Port #02[16KHz/20ms/1] ringback transmitting to: >> Port #03[16KHz/20ms/1] ring transmitting to: >> >> >>> cc 1 0 >> 12:26:12.300 pjsua_media.c pjsua_set_snd_dev(): attempting to >> open devices @16000 Hz >> 12:26:12.331 pjsua_media.c ..failed: Invalid sample rate >> 12:26:12.332 pjsua_media.c pjsua_set_snd_dev(): attempting to >> open devices @44100 Hz >> 12:26:12.362 pjsua_media.c ..failed: Invalid sample rate >> 12:26:12.363 pjsua_media.c pjsua_set_snd_dev(): attempting to >> open devices @48000 Hz >> 12:26:12.393 pjsua_media.c ..failed: Invalid sample rate >> 12:26:12.394 pjsua_media.c pjsua_set_snd_dev(): attempting to >> open devices @32000 Hz >> 12:26:12.423 pjsua_media.c ..failed: Invalid sample rate >> 12:26:12.424 pjsua_media.c pjsua_set_snd_dev(): attempting to >> open devices @16000 Hz >> 12:26:12.454 pjsua_media.c ..failed: Invalid sample rate >> 12:26:12.455 pjsua_media.c pjsua_set_snd_dev(): attempting to >> open devices @8000 Hz >> 12:26:12.485 pjsua_media.c ..failed: Invalid sample rate >> 12:26:12.486 pjsua_media.c Unable to open sound device: Invalid >> sample rate [status=269996] >> 12:26:12.486 pjsua_media.c Error opening sound device: Invalid >> sample rate [status=269996] >> ERROR!! >> >> ------------------------------------------------------------------------ >> playfile log is as follows. >> >> [root at a220-0 (ttyAM0) /mnt/nand/pjsip/pjsip-apps/bin/samples]# >> ./playfile-arm-unknown-linux-gnu /mnt/nand/DBaloon.wav >> 12:28:43.254 os_core_unix.c pjlib 1.0 for POSIX initialized >> 12:28:43.697 pasound.c PortAudio sound library initialized, >> status=0 >> 12:28:43.698 pasound.c PortAudio host api count=1 >> 12:28:43.698 pasound.c Sound device count=1 >> 12:28:43.700 pjlib select() I/O Queue created (0x8bed4) >> 12:28:43.706 wav_player.c File player '/mnt/nand/DBaloon.wav' >> created: samp.rate=16000, ch=1, bufsize=4KB, filesize=4KB >> 12:28:43.714 pasound.c PA message: Expression >> 'paInvalidSampleRate' failed in >> 'src/../../../portaudio/src/hostapi/oss/pa_unix_oss.c', line: 1042 >> >> 12:28:43.715 pasound.c PA message: Expression >> 'PaOssStreamComponent_Configure( component, sampleRate, framesPerBuffer, >> StreamMode_Out, master )' failed in >> 'src/../../../portaudio/src/hostapi/oss/pa_unix_oss.c', line: 1130 >> >> 12:28:43.715 pasound.c PA message: Expression >> 'PaOssStream_Configure( stream, sampleRate, framesPerBuffer, &inLatency, >> &outLatency )' failed in >> 'src/../../../portaudio/src/hostapi/oss/pa_unix_oss.c', line: 1236 >> >> 12:28:43.716 playfile.c Unable to open sound device: Invalid >> sample rate [code=269996] >> >> ------------------------------------------------------------------------ >> mp3play runs good. >> >> [root at a220-0 (ttyAM0) /mnt/nand]# mp3play /mnt/nand/short.mp3 >> /mnt/nand/short.mp3: MPEG1-III (166 ms) >> >> ------------------------------------------------------------------------ >> >> please teach me what I should do next. >> >> Regards, >> fukunaga >> >> >> >> _______________________________________________ >> Visit our blog: http://blog.pjsip.org >> >> pjsip mailing list >> pjsip at lists.pjsip.org >> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >