[pjsip] Sound problem pjsua at raspberry pi

Bill Gardner billg at wavearts.com
Thu May 15 09:01:43 EDT 2014


Perhaps the driver is too "bursty", meaning it returns a lot of read 
buffers in a row then accepts a lot of write buffers. You'd have  to add 
some log messages to record the pattern of capture and playback 
callbacks to see. PJSIP prefers a regular pattern of 
read/write/read/write...

Bill

On 5/15/2014 12:50 AM, Herbert Falter wrote:
> Hi Bill,
> I have ty two other USB-SOUND-Adapter. One of this works acceptly with 
> pjsip. I don't understand that the all (3) adapter works with ./aplay 
> and also with ./playfile (at samples) but didn't work with pjsua.
> Thanks
> herbert
> *Gesendet:* Mittwoch, 14. Mai 2014 um 21:28 Uhr
> *Von:* "Bill Gardner" <billg at wavearts.com>
> *An:* "pjsip list" <pjsip at lists.pjsip.org>
> *Betreff:* Re: [pjsip] Sound problem pjsua at raspberry pi
> Try increasing PJMEDIA_SND_DEFAULT_PLAY_LATENCY from 140 to say 200 or 
> more? Seems that 140 msec should be plenty though. I'm stumped.
>
> Bill
> On 5/14/2014 3:09 PM, Herbert Falter wrote:
>
>     With options:
>      pjsua --play-file test.wav --ec-tail 0 --clock-rate 8000
>     >>> cc 1 0
>     21:05:41.772    pjsua_aud.c  Conf connect: 1 --> 0
>     21:05:41.774    pjsua_aud.c  .Set sound device: capture=-1,
>     playback=-2
>     21:05:41.775    pjsua_app.c  ..Turning sound device ON
>     21:05:41.776    pjsua_aud.c  ..Opening sound device PCM at 8000/1/20ms
>     21:05:41.826   conference.c  .Port 1 (test.wav) transmitting to
>     port 0 (default:CARD=Device)
>     Success
>     >>> ^C
>     Doesn't better
>     herbert
>     *Gesendet:* Mittwoch, 14. Mai 2014 um 21:04 Uhr
>     *Von:* "Herbert Falter" <herbert-f at gmx.de>
>     *An:* "pjsip list" <pjsip at lists.pjsip.org>
>     *Betreff:* Re: [pjsip] Sound problem pjsua at raspberry pi
>     Hi,
>     I know this: cc 1 0.
>     The quality ist too bad:
>     >>> cc 1 0
>     21:03:14.477    pjsua_aud.c  Conf connect: 1 --> 0
>     21:03:14.479    pjsua_aud.c  .Set sound device: capture=-1,
>     playback=-2
>     21:03:14.480    pjsua_app.c ..Turning sound device ON
>     21:03:14.482    pjsua_aud.c ..Opening sound device PCM at 16000/1/20ms
>     21:03:14.534     ec0xeed450 ...AEC created, clock_rate=16000,
>     channel=1, samples per frame=320, tail length=200 ms, latency=0 ms
>     21:03:14.537   conference.c  .Port 1 (test.wav) transmitting to
>     port 0 (default:CARD=Device)
>     Success
>     >>> 21:03:15.978 alsa_dev.c !ca_thread_func: overrun!
>     21:03:36.780     alsa_dev.c !ca_thread_func: overrun!
>     *Gesendet:* Mittwoch, 14. Mai 2014 um 20:48 Uhr
>     *Von:* "Bill Gardner" <billg at wavearts.com>
>     *An:* pjsip at lists.pjsip.org
>     *Betreff:* Re: [pjsip] Sound problem pjsua at raspberry pi
>     Hi Herbert,
>
>     The Master/sound underflows are indicative of a problem. You'd
>     expect these if CPU is exhausted, but since the AEC is off pjsip
>     is using negligible CPU. Perhaps try to increase the number of
>     audio buffers in ALSA driver?
>
>     Also in order to play a file to audio device using pjsua, you need
>     to specify WAV file using --play-file and then manually connect
>     the WAV file port to sound port using cc command.
>
>     Bill
>     On 5/14/2014 2:36 PM, Herbert Falter wrote:
>
>         Hi Bill,
>         thanks for your answer.
>         I have tried --ec-tail 0 --clock-rate 8000. It's not better,
>         the same.
>         Log:Connect src port # (empty to cancel):
>         >>> cc 0 0
>         20:29:51.604 pjsua_aud.c !Conf connect: 0 --> 0
>         20:29:51.606 pjsua_aud.c  .Set sound device: capture=-1,
>         playback=-2
>         20:29:51.608 pjsua_app.c ..Turning sound device ON
>         20:29:51.609 pjsua_aud.c ..Opening sound device PCM at 8000/1/20ms
>         20:29:51.658 conference.c  .Port 0 (default:CARD=Device)
>         transmitting to port 0 (default:CARD=Device)
>         Success
>         >>> 20:29:51.664 Master/sound !Underflow, buf_cnt=0, will
>         generate 1 frame
>         20:29:51.666 Master/sound Underflow, buf_cnt=0, will generate
>         1 frame
>         20:29:51.669 Master/sound Underflow, buf_cnt=0, will generate
>         1 frame
>         20:29:51.672 Master/sound Underflow, buf_cnt=0, will generate
>         1 frame
>         20:29:51.675 Master/sound Underflow, buf_cnt=0, will generate
>         1 frame
>         20:29:51.678 Master/sound Underflow, buf_cnt=0, will generate
>         1 frame
>         20:29:51.681 Master/sound Underflow, buf_cnt=0, will generate
>         1 frame
>         20:29:51.684 Master/sound Underflow, buf_cnt=0, will generate
>         1 frame
>         20:29:51.687 Master/sound Underflow, buf_cnt=0, will generate
>         1 frame
>         20:29:52.189 Master/sound  Buffer size adjusted from 960 to
>         880 (eff_cnt=640)
>         .....
>         The follows works fine:
>
>         playfile THEFILE.WAV
>
>         this didn't work:
>         pjsua --play-file THEFILE.WAV
>         What can I do?
>
>         *Gesendet:* Mittwoch, 14. Mai 2014 um 18:58 Uhr
>         *Von:* "Bill Gardner" <billg at wavearts.com>
>         *An:* pjsip at lists.pjsip.org
>         *Betreff:* Re: [pjsip] Sound problem pjsua at raspberry pi
>         Hi Herbert,
>
>         Try disabling AEC and see if the "cc 0 0" test works better.
>         AEC may be consuming all the CPU?
>
>         Bill
>         On 5/14/2014 12:50 AM, Herbert Falter wrote:
>
>             Hi,
>
>             I have a Raspberry PI with Raspbian and a USB-Sound-Device.
>
>             **** Liste der Hardware-Geräte (PLAYBACK) ****
>             Karte 0: Device [USB PnP Sound Device], Gerät 0: USB Audio
>             [USB Audio]
>               Sub-Geräte: 1/1
>               Sub-Gerät #0: subdevice #0
>             Karte 1: ALSA [bcm2835 ALSA], Gerät 0: bcm2835 ALSA
>             [bcm2835 ALSA]
>               Sub-Geräte: 8/8
>               Sub-Gerät #0: subdevice #0
>               Sub-Gerät #1: subdevice #1
>               Sub-Gerät #2: subdevice #2
>               Sub-Gerät #3: subdevice #3
>               Sub-Gerät #4: subdevice #4
>               Sub-Gerät #5: subdevice #5
>               Sub-Gerät #6: subdevice #6
>               Sub-Gerät #7: subdevice #7
>
>             The USB-Sound Device works great (very good quality) with
>             alsa:
>
>             aplay /usr/share/scratch/Media/Sounds/Vocals/Singer2.wav
>
>             and recording with:
>
>             arecord -D plughw:0 --duration=10 -f cd -vv test.wav
>
>             I read the site:
>             http://trac.pjsip.org/repos/wiki/sound-problems.
>
>             The playback-sound at "cc 0 0" is very bad.
>             Abort at:
>
>             >>> cc 1 0
>             22:52:13.499 pjsua_aud.c Conf connect: 1 --> 0
>             22:52:13.500 pjsua_aud.c .Set sound device: capture=-1,
>             playback=-2
>             22:52:13.502 pjsua_app.c ..Turning sound device ON
>             22:52:13.504 pjsua_aud.c ..Opening sound device
>             PCM at 16000/1/20ms
>             22:52:13.558 ec0x2c7460 ...AEC created, clock_rate=16000,
>             channel=1, samples per frame=320, tail length=200 ms,
>             latency=0 ms
>             22:52:13.561 conference.c .Port 1
>             (/usr/share/scratch/Media/Sounds/Vocals/Singer2.wav)
>             transmitting to port 0 (default:CARD=Device)
>             Success
>             >>> pjsua: ../src/pjmedia/conference.c:1498: read_port:
>             Assertion `cport->rx_buf_count <= cport->rx_buf_cap' failed.
>             Abgebrochen
>
>             What can I do?
>
>             My configuration is:
>             sudo apt-get update
>             sudo apt-get upgrade
>             sudo apt-get install alsaplayer-alsa libv4l-dev
>             libx264-dev libssl-dev libasound2-dev
>             cd
>             sudo wget
>             http://www.pjsip.org/release/2.2/pjproject-2.2.tar.bz2
>             sudo tar xvfj pjproject-2.2.tar.bz2
>             cd pjproject-2.2/
>             sudo ./configure --disable-video --disable-l16-codec
>             --disable-gsm-codec --disable-g722-codec
>             --disable-g7221-codec --disable-ilbc-codec
>             echo "PJSIP: use ALSA instead of Portaudio"
>             sudo cat << PJ > pjlib/include/pj/config_site.h
>             #define PJMEDIA_AUDIO_DEV_HAS_ALSA 1
>             #define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0
>             PJ
>             sudo make dep && make
>             sudo make install
>
>             sudo cp
>             /home/pi/pjproject-2.2/pjsip-apps/bin/pjsua-armv6l-unknown-linux-gnueabihf
>             /usr/bin/pjsua
>
>             Please help.
>
>             bye
>             herbert
>
>             _______________________________________________
>             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
>
>         _______________________________________________
>         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
>     _______________________________________________ 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
>
>
> _______________________________________________ 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20140515/15c33f47/attachment-0002.html>


More information about the pjsip mailing list