pjsua on Raspberry Pi (SEKCobra - John) - answer by Silvio

S
SL
Fri, Dec 2, 2016 10:14 AM

Hi John,
Raspberry doesn't have a direct audio input for microphone and dealing
with stereo audio output through o/s layer can lead you to trouble in
getting good audio.
I have solved this problem from scratch by designing an hardware audio
codec and its user space driver that works directly with PjMedia audio
packets, through SPI interface.
Aimed to build a video-doorphone, I build my board with all hardware
needed for it.
You can have a look to my video-doorphone pet-project in my English site:
http://www.lugato.co.uk
The development board you can see surfing my site is full functional and
tested: it has all the hardware needed to easily build an "hassle free"
IP video-doorphone system based on Raspberry PI (both internal and
external stations).
It is currently assembled by an Italian firm for internal development of
IP video-doorphone hardware.
If you are interested to have a sample of this board, feel free to
contact me through the contact form you can find in my site.
Please note that it is currently based on Rasbpian Wheezy and Pjproject
2.3, since PjMedia running on Raspbian Jessie isn't able to recognize
Raspicam and I had no time to spend in finding the reason of this
problem, since it was actually not needed: Raspicam works perfectly with
PjMedia running on Rasbpian Wheezy... but I would be curious to know the
reason why Raspicam doesn't work with PjMedia+Jessie.
Please take also in account that H264 video compression works fine only
on Raspberry PI 2 and 3, since the old Raspberry board doesn't have
enough computational power for it, but old Raspberry can manage H263+
video compression quite well. I recommend using PI3 ;)
If you just need audio, you can install Rasbpian Jessie with the last
version of Pjproject on Raspberry PI connected to this board.
Have fun!
Silvio

Message: 1
Date: Tue, 22 Nov 2016 23:23:59 +0100
From: SEKCobra sekcobra@gmail.com
To: pjsip@lists.pjsip.org
Subject: [pjsip] pjsua on Raspberry Pi
Message-ID: 7cd7f109-9928-cd8d-fd4f-222b80940332@gmail.com
Content-Type: text/plain; charset="utf-8"; Format="flowed"

Hey people,

I hope I'm in the right place bothering all of you, but I need some help
with getting a little project going. Background:
I'm trying to connect my apartments door intercom to a USB soundcard and
then be able to connect to it when someone rings the door.

I've hit a somewhat significant issue tho: I was able to compile
pjproject 2.1.0 without a hiccup, but there are several issues
interfacing with the soundcard.

First of all, there's zero audio. You can tell there is a change in
status when pjsua is started because of slight noise setting in, but
in-call there's nothing but silence, the call being ended because of
inactivity after a bit. Testing it with the onboard audio output, there
actually is (Very quiet and bad) audio being transmitted.

When a call is ended, I always get this and the program seems to hang
somewhat:
23:16:10.115    pjsua_aud.c  .Closing USB Audio Device: USB Audio
(hw:1,0) sound playback device and USB Audio Device: USB Audio (hw:1,0)
sound capture device

I can play wav's fine through aplay. pjsystest's "Play Tone" also works,
with the hang I described above occuring. When I use the "Device Test" I
get the following:

1
23:22:54.598      systest.c  Running Audio Device Test
Expression 'SetApproximateSampleRate( pcm, hwParams, sr )' failed in
'src/../../../portaudio/src/hostapi/alsa/pa_linux_alsa.c', line: 1294
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture,
inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in
'src/../../../portaudio/src/hostapi/alsa/pa_linux_alsa.c', line: 1870
Expression 'PaAlsaStream_Configure( stream, inputParameters,
outputParameters, sampleRate, framesPerBuffer, &inputLatency,
&outputLatency, &hostBufferSizeMode )' failed in
'src/../../../portaudio/src/hostapi/alsa/pa_linux_alsa.c', line: 1994
Expression 'SetApproximateSampleRate( pcm, hwParams, sr )' failed in
'src/../../../portaudio/src/hostapi/alsa/pa_linux_alsa.c', line: 1294
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture,
inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in
'src/../../../portaudio/src/hostapi/alsa/pa_linux_alsa.c', line: 1870
Expression 'PaAlsaStream_Configure( stream, inputParameters,
outputParameters, sampleRate, framesPerBuffer, &inputLatency,
&outputLatency, &hostBufferSizeMode )' failed in
'src/../../../portaudio/src/hostapi/alsa/pa_linux_alsa.c', line: 1994
Unable to open device: Invalid sample rate (err=469996)
Error
Sorry we encountered error with the testInvalid sample rate

If anyone can help me out here, I'd really appreciate it greatly!

Best regards,
John

Hi John, Raspberry doesn't have a direct audio input for microphone and dealing with stereo audio output through o/s layer can lead you to trouble in getting good audio. I have solved this problem from scratch by designing an hardware audio codec and its user space driver that works directly with PjMedia audio packets, through SPI interface. Aimed to build a video-doorphone, I build my board with all hardware needed for it. You can have a look to my video-doorphone pet-project in my English site: http://www.lugato.co.uk The development board you can see surfing my site is full functional and tested: it has all the hardware needed to easily build an "hassle free" IP video-doorphone system based on Raspberry PI (both internal and external stations). It is currently assembled by an Italian firm for internal development of IP video-doorphone hardware. If you are interested to have a sample of this board, feel free to contact me through the contact form you can find in my site. Please note that it is currently based on Rasbpian Wheezy and Pjproject 2.3, since PjMedia running on Raspbian Jessie isn't able to recognize Raspicam and I had no time to spend in finding the reason of this problem, since it was actually not needed: Raspicam works perfectly with PjMedia running on Rasbpian Wheezy... but I would be curious to know the reason why Raspicam doesn't work with PjMedia+Jessie. Please take also in account that H264 video compression works fine only on Raspberry PI 2 and 3, since the old Raspberry board doesn't have enough computational power for it, but old Raspberry can manage H263+ video compression quite well. I recommend using PI3 ;) If you just need audio, you can install Rasbpian Jessie with the last version of Pjproject on Raspberry PI connected to this board. Have fun! Silvio > Message: 1 > Date: Tue, 22 Nov 2016 23:23:59 +0100 > From: SEKCobra <sekcobra@gmail.com> > To: pjsip@lists.pjsip.org > Subject: [pjsip] pjsua on Raspberry Pi > Message-ID: <7cd7f109-9928-cd8d-fd4f-222b80940332@gmail.com> > Content-Type: text/plain; charset="utf-8"; Format="flowed" > > Hey people, > > I hope I'm in the right place bothering all of you, but I need some help > with getting a little project going. Background: > I'm trying to connect my apartments door intercom to a USB soundcard and > then be able to connect to it when someone rings the door. > > I've hit a somewhat significant issue tho: I was able to compile > pjproject 2.1.0 without a hiccup, but there are several issues > interfacing with the soundcard. > > First of all, there's zero audio. You can tell there is a change in > status when pjsua is started because of slight noise setting in, but > in-call there's nothing but silence, the call being ended because of > inactivity after a bit. Testing it with the onboard audio output, there > actually is (Very quiet and bad) audio being transmitted. > > When a call is ended, I always get this and the program seems to hang > somewhat: > 23:16:10.115 pjsua_aud.c .Closing USB Audio Device: USB Audio > (hw:1,0) sound playback device and USB Audio Device: USB Audio (hw:1,0) > sound capture device > > I can play wav's fine through aplay. pjsystest's "Play Tone" also works, > with the hang I described above occuring. When I use the "Device Test" I > get the following: > > 1 > 23:22:54.598 systest.c Running Audio Device Test > Expression 'SetApproximateSampleRate( pcm, hwParams, sr )' failed in > 'src/../../../portaudio/src/hostapi/alsa/pa_linux_alsa.c', line: 1294 > Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, > inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in > 'src/../../../portaudio/src/hostapi/alsa/pa_linux_alsa.c', line: 1870 > Expression 'PaAlsaStream_Configure( stream, inputParameters, > outputParameters, sampleRate, framesPerBuffer, &inputLatency, > &outputLatency, &hostBufferSizeMode )' failed in > 'src/../../../portaudio/src/hostapi/alsa/pa_linux_alsa.c', line: 1994 > Expression 'SetApproximateSampleRate( pcm, hwParams, sr )' failed in > 'src/../../../portaudio/src/hostapi/alsa/pa_linux_alsa.c', line: 1294 > Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, > inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in > 'src/../../../portaudio/src/hostapi/alsa/pa_linux_alsa.c', line: 1870 > Expression 'PaAlsaStream_Configure( stream, inputParameters, > outputParameters, sampleRate, framesPerBuffer, &inputLatency, > &outputLatency, &hostBufferSizeMode )' failed in > 'src/../../../portaudio/src/hostapi/alsa/pa_linux_alsa.c', line: 1994 > Unable to open device: Invalid sample rate (err=469996) > Error > Sorry we encountered error with the testInvalid sample rate > > If anyone can help me out here, I'd really appreciate it greatly! > > Best regards, > John