[jitsi-dev] Bad Audio quality


#1

All,

after updating to the new jitsi repository the audio quality is
bad if I build Jitsi from repository sources. Audio stutters when
I call an announcement / echo test service (btw. iptel's music and
echo service aren't active). I use "sip:echo@proxy01.sipphone.com" .
When I call the same service with twinkle I have perfect sound. Same
happens with another echo service.

Was something changed in the audio stuff lately? I switched on/off
echo and noise surpression but that didn't change the result.

I have monitored the network traffic with wireshark and have the
protocol files available. I can listen to the RTP stream with
wireshark and can hear the announcements without any problems.

Any ideas?

Regards,
Werner


#2

Dear Werner,

after updating to the new jitsi repository the audio quality is
bad if I build Jitsi from repository sources. Audio stutters when
I call an announcement / echo test service (btw. iptel's music and
echo service aren't active). I use "sip:echo@proxy01.sipphone.com" .
When I call the same service with twinkle I have perfect sound. Same
happens with another echo service.

I tried a call to sip:echo@proxy01.sipphone.com on Windows 7 and the
sound sounded perfect to me.

Was something changed in the audio stuff lately? I switched on/off
echo and noise surpression but that didn't change the result.

I think the last major changes were related to the echo cancellation
and suppression. I suppose they may be tracked in the Subversion logs
of src/net/java/sip/communicator/impl/neomedia in order to determine
whether they fall into your understanding of "lately" :wink:

Regards,
Lyubomir

···

On Sun, Feb 6, 2011 at 11:42 AM, Werner Dittmann <Werner.Dittmann@t-online.de> wrote:


#3

Hi Lyubomir,

I'm steadily fighting this audio problem and have checked some
stuff already, including portaudio, different Alsa settings
(no pulseaudio installed on my system). Portaudio and Alsa is
working fine on my system, all test programs, tone generators
work as expected.

During my debugging sessions I saw some stuff that makes me wonder.
I inserted a time print

System.out.println("time: " + System.currentTimeMillis());

just before calling PortAudio.Pa_WriteStream() and got some strange
results. My expectation is that We write a buffer roughly every
20ms to portaudio. This is indeed not the fact, see the following
time line:

     [java] time: 1299085030482
     [java] time: 1299085030486
     [java] time: 1299085030488
     [java] time: 1299085030492
     [java] time: 1299085030497
     [java] time: 1299085030499
     [java] time: 1299085030500
     [java] time: 1299085030512
     [java] time: 1299085030513
     [java] time: 1299085030515
     [java] time: 1299085030522
     [java] time: 1299085030524
     [java] time: 1299085030526
     [java] time: 1299085030528

···

---
     [java] time: 1299085030765
     [java] time: 1299085030766
     [java] time: 1299085030766
     [java] time: 1299085030768
     [java] time: 1299085030772
     [java] time: 1299085030774
     [java] time: 1299085030775
     [java] time: 1299085030777
     [java] time: 1299085030779
     [java] time: 1299085030781
     [java] time: 1299085030786
     [java] time: 1299085030786
     [java] time: 1299085030787
---
     [java] time: 1299085031012
     [java] time: 1299085031014
     [java] time: 1299085031014
     [java] time: 1299085031015
     [java] time: 1299085031015
     [java] time: 1299085031017
     [java] time: 1299085031019
     [java] time: 1299085031021
     [java] time: 1299085031022
     [java] time: 1299085031023
     [java] time: 1299085031024
     [java] time: 1299085031027
---
     [java] time: 1299085031263
     [java] time: 1299085031264
     [java] time: 1299085031265

(I inserted the --- marks to show the burst behaviour).
As you can see PortAudioRenderer receive 12-14 packets in a burst,
then we have a pause of more than 200ms, next burst. This often leads
to a bad jitter during audio output, in particular if the output device
has a smaller buffer.

This behaviour is not triggered by the network - wireshark shows that
Jitsi receives a RTP packet every 20ms. Wireshark also shows a similar
behaviour when Jitsi sends packets: Jitsi sends audio packets in a burst
mode: very often 8 - 10 packet in a burst, then pauses, next burst
(sometimes a small bursts of 2 packets, but mostly bigger bursts).

So some questions here: which part of the audio output machinery
performs the upsampling from 8000Hz (G.711 a/uLAW) to 44100Hz (or 48000Hz)?
Is there some buffering involved? Same questions for ouput.

Can you check this or give me a link where to look next to check this
behaviour?

In my next e-mail I'll report some stuff to check in the coding (not directly
related to this specific burst problem).

Best regards,
Werner

Am 14.02.2011 19:08, schrieb Lyubomir Marinov:

Dear Werner,

On Sun, Feb 6, 2011 at 11:42 AM, Werner Dittmann > <Werner.Dittmann@t-online.de> wrote:

after updating to the new jitsi repository the audio quality is
bad if I build Jitsi from repository sources. Audio stutters when
I call an announcement / echo test service (btw. iptel's music and
echo service aren't active). I use "sip:echo@proxy01.sipphone.com" .
When I call the same service with twinkle I have perfect sound. Same
happens with another echo service.

I tried a call to sip:echo@proxy01.sipphone.com on Windows 7 and the
sound sounded perfect to me.

Was something changed in the audio stuff lately? I switched on/off
echo and noise surpression but that didn't change the result.

I think the last major changes were related to the echo cancellation
and suppression. I suppose they may be tracked in the Subversion logs
of src/net/java/sip/communicator/impl/neomedia in order to determine
whether they fall into your understanding of "lately" :wink:

Regards,
Lyubomir


#4

Hi Lyubomir, all

some more info regarding this topic: this burst behaviour
(at least at the playback side) is induced by portaudio/Alsa
combination. Also Portaudio adds quite some load on top of
nromal Alsa processing (compared for example to Twinkle that uses
plain Alsa). I'm digging into this and keep you informed - at
all it's a somwhat "nasty" stuff :slight_smile: .

Regards,
Werner

···

Am 02.03.2011 18:20, schrieb Werner Dittmann:

Hi Lyubomir,

I'm steadily fighting this audio problem and have checked some
stuff already, including portaudio, different Alsa settings
(no pulseaudio installed on my system). Portaudio and Alsa is
working fine on my system, all test programs, tone generators
work as expected.

During my debugging sessions I saw some stuff that makes me wonder.
I inserted a time print

System.out.println("time: " + System.currentTimeMillis());

just before calling PortAudio.Pa_WriteStream() and got some strange
results. My expectation is that We write a buffer roughly every
20ms to portaudio. This is indeed not the fact, see the following
time line:

     [java] time: 1299085030482
     [java] time: 1299085030486
     [java] time: 1299085030488
     [java] time: 1299085030492
     [java] time: 1299085030497
     [java] time: 1299085030499
     [java] time: 1299085030500
     [java] time: 1299085030512
     [java] time: 1299085030513
     [java] time: 1299085030515
     [java] time: 1299085030522
     [java] time: 1299085030524
     [java] time: 1299085030526
     [java] time: 1299085030528
---
     [java] time: 1299085030765
     [java] time: 1299085030766
     [java] time: 1299085030766
     [java] time: 1299085030768
     [java] time: 1299085030772
     [java] time: 1299085030774
     [java] time: 1299085030775
     [java] time: 1299085030777
     [java] time: 1299085030779
     [java] time: 1299085030781
     [java] time: 1299085030786
     [java] time: 1299085030786
     [java] time: 1299085030787
---
     [java] time: 1299085031012
     [java] time: 1299085031014
     [java] time: 1299085031014
     [java] time: 1299085031015
     [java] time: 1299085031015
     [java] time: 1299085031017
     [java] time: 1299085031019
     [java] time: 1299085031021
     [java] time: 1299085031022
     [java] time: 1299085031023
     [java] time: 1299085031024
     [java] time: 1299085031027
---
     [java] time: 1299085031263
     [java] time: 1299085031264
     [java] time: 1299085031265

(I inserted the --- marks to show the burst behaviour).
As you can see PortAudioRenderer receive 12-14 packets in a burst,
then we have a pause of more than 200ms, next burst. This often leads
to a bad jitter during audio output, in particular if the output device
has a smaller buffer.

This behaviour is not triggered by the network - wireshark shows that
Jitsi receives a RTP packet every 20ms. Wireshark also shows a similar
behaviour when Jitsi sends packets: Jitsi sends audio packets in a burst
mode: very often 8 - 10 packet in a burst, then pauses, next burst
(sometimes a small bursts of 2 packets, but mostly bigger bursts).

So some questions here: which part of the audio output machinery
performs the upsampling from 8000Hz (G.711 a/uLAW) to 44100Hz (or 48000Hz)?
Is there some buffering involved? Same questions for ouput.

Can you check this or give me a link where to look next to check this
behaviour?

In my next e-mail I'll report some stuff to check in the coding (not directly
related to this specific burst problem).

Best regards,
Werner

Am 14.02.2011 19:08, schrieb Lyubomir Marinov:

Dear Werner,

On Sun, Feb 6, 2011 at 11:42 AM, Werner Dittmann >> <Werner.Dittmann@t-online.de> wrote:

after updating to the new jitsi repository the audio quality is
bad if I build Jitsi from repository sources. Audio stutters when
I call an announcement / echo test service (btw. iptel's music and
echo service aren't active). I use "sip:echo@proxy01.sipphone.com" .
When I call the same service with twinkle I have perfect sound. Same
happens with another echo service.

I tried a call to sip:echo@proxy01.sipphone.com on Windows 7 and the
sound sounded perfect to me.

Was something changed in the audio stuff lately? I switched on/off
echo and noise surpression but that didn't change the result.

I think the last major changes were related to the echo cancellation
and suppression. I suppose they may be tracked in the Subversion logs
of src/net/java/sip/communicator/impl/neomedia in order to determine
whether they fall into your understanding of "lately" :wink:

Regards,
Lyubomir


#5

Hello

I'm steadily fighting this audio problem and have checked some
stuff already, including portaudio, different Alsa settings
(no pulseaudio installed on my system). Portaudio and Alsa is
working fine on my system, all test programs, tone generators
work as expected.

I can confirm audio jitter problems on my system, using latest 1.0-alpha6-nightly.build.3332 on Xubuntu 10.04 (Lucid) 64 bit. I made some recordings (music@iptel.org) to illustrate the issue, with a fresh config and using both G722/16000 [1] and speex/16000 [2] codecs. In these recordings the jitters mostly occur at about 20sec in the call.

The audio quality isn't always so bad, but when it is, it makes conversations with friends unbearable. My ALSA settings should be just fine since audio in Linphone is fine.

Are there some audio settings with which I could experiment? Please let me know if you need more info regarding my system. Regards
Liviu

[1] http://s000.tinyupload.com/index.php?file_id=49146650061141072103
[2] http://s000.tinyupload.com/index.php?file_id=88343286376027724234

···

On Wed, 02 Mar 2011 18:20:05 +0100, Werner Dittmann <Werner.Dittmann@t-online.de> wrote:


#6

Hi all,

I'm in the process to checkout what is the real case and I already
have some ideas, however, because portaudio ALSA is a little bit
spaghetti, it will take a few days. I'll keep you updated on my
findings and may be others can confirm/not confirm my findings.

The overall problem seems to be a combination of various, maybe overlapping
problems or facts:
- JMF has it's idea of a Jitter buffer and how to manage it (both input
  and output)
- Portaudio performs some buffer management
- ALSA driver has buffers (ringbuffer) and it's ideas
  when to trigger for new input or providing captured input - but this
  may be also a problem of wrong settings performed by Portaudio

Regards,
Werner

···

Am 03.03.2011 21:35, schrieb Liviu Andronic:

Hello

On Wed, 02 Mar 2011 18:20:05 +0100, Werner Dittmann > <Werner.Dittmann@t-online.de> wrote:

I'm steadily fighting this audio problem and have checked some
stuff already, including portaudio, different Alsa settings
(no pulseaudio installed on my system). Portaudio and Alsa is
working fine on my system, all test programs, tone generators
work as expected.

I can confirm audio jitter problems on my system, using latest
1.0-alpha6-nightly.build.3332 on Xubuntu 10.04 (Lucid) 64 bit. I made
some recordings (music@iptel.org) to illustrate the issue, with a fresh
config and using both G722/16000 [1] and speex/16000 [2] codecs. In
these recordings the jitters mostly occur at about 20sec in the call.

The audio quality isn't always so bad, but when it is, it makes
conversations with friends unbearable. My ALSA settings should be just
fine since audio in Linphone is fine.

Are there some audio settings with which I could experiment? Please let
me know if you need more info regarding my system. Regards
Liviu

[1] http://s000.tinyupload.com/index.php?file_id=49146650061141072103
[2] http://s000.tinyupload.com/index.php?file_id=88343286376027724234


#7

Hi all,

her are some results of the audio tests I did on my system. My
system is as follows:
- plain Alsa, no pulseaudio
- the audio device is: C-Media CMI8738 audio chip

I experimented with several setting of the portaudio in Jitsi and
had a protaudio software wih debugging enabled. I got the best
results when I use the following settings:

Input device: C-Media PCI DAC/ADC (hw:0,0) -- use the HW device for Input
Output device: dmix -- use mixer for output
Notification dev.: dmix -- use mixer for notifications

If you don't use dmix for output/notifications then it may happen
that you don't hear output or notification audio if Jitsi plays them at the
same or overlapping time. Only with dmix you can open 2 or more output
streams at the same time. Otherwise the second attempt to open an output
audio stream fails.

If I use the "default" device for input I get a lot of underruns
at the _output_ sound stream and portaudio restarts the Alsa _output_ sound
stream. These underruns are _not_ reported to Jitsi because portaudio
handles them internally.

When I use the HW device as input I saw output underrun conditions only
once in a while, often none in a long time. IMHO Alsa is not setup
correctly if not at least one HW device is used. I don't know if this
is a problem in portaudio code or if this is a generic Alsa problem.

According to Alsa documentation it is a bad idea to use the
"hw:0,0" device directly because some audio chips do not support
all sample rates and thus the application is fixed to the HW
supported sample rates. Alsa documentation strongly advises to use
"plughw:0,0" devices. In this case Alsa drivers would adapt sample
rates and applications may chose sample rates that are not directly
supported by the HW. To force portaudio to use the "plughw" device
names you must set the following environment variable in before
you start Jitsi (in the same shell session of course :slight_smile: ).

export PA_ALSA_PLUGHW=1

Hope this helps a little bit if somebody encounters a similar problem.
Feedback is welcome :slight_smile:

Best regards,
Werner

···

Am 04.03.2011 17:01, schrieb Werner Dittmann:

Hi all,

I'm in the process to checkout what is the real case and I already
have some ideas, however, because portaudio ALSA is a little bit
spaghetti, it will take a few days. I'll keep you updated on my
findings and may be others can confirm/not confirm my findings.

The overall problem seems to be a combination of various, maybe overlapping
problems or facts:
- JMF has it's idea of a Jitter buffer and how to manage it (both input
  and output)
- Portaudio performs some buffer management
- ALSA driver has buffers (ringbuffer) and it's ideas
  when to trigger for new input or providing captured input - but this
  may be also a problem of wrong settings performed by Portaudio

Regards,
Werner

Am 03.03.2011 21:35, schrieb Liviu Andronic:

Hello

On Wed, 02 Mar 2011 18:20:05 +0100, Werner Dittmann >> <Werner.Dittmann@t-online.de> wrote:

I'm steadily fighting this audio problem and have checked some
stuff already, including portaudio, different Alsa settings
(no pulseaudio installed on my system). Portaudio and Alsa is
working fine on my system, all test programs, tone generators
work as expected.

I can confirm audio jitter problems on my system, using latest
1.0-alpha6-nightly.build.3332 on Xubuntu 10.04 (Lucid) 64 bit. I made
some recordings (music@iptel.org) to illustrate the issue, with a fresh
config and using both G722/16000 [1] and speex/16000 [2] codecs. In
these recordings the jitters mostly occur at about 20sec in the call.

The audio quality isn't always so bad, but when it is, it makes
conversations with friends unbearable. My ALSA settings should be just
fine since audio in Linphone is fine.

Are there some audio settings with which I could experiment? Please let
me know if you need more info regarding my system. Regards
Liviu

[1] http://s000.tinyupload.com/index.php?file_id=49146650061141072103
[2] http://s000.tinyupload.com/index.php?file_id=88343286376027724234


#8

Hello
I meant to write earlier but couldn't get the time to perform all the testing as I wanted.

her are some results of the audio tests I did on my system. My
system is as follows:
- plain Alsa, no pulseaudio
- the audio device is: C-Media CMI8738 audio chip

I experimented with several setting of the portaudio in Jitsi and
had a protaudio software wih debugging enabled. I got the best
results when I use the following settings:

Input device: C-Media PCI DAC/ADC (hw:0,0) -- use the HW device for Input
Output device: dmix -- use mixer for output
Notification dev.: dmix -- use mixer for notifications

[..]

Hope this helps a little bit if somebody encounters a similar problem.
Feedback is welcome :slight_smile:

Now I will focus on my findings with pre-beta builds (I've since upgraded to the betas and the behaviour seems different in some settings).

Win Vista 64bit: the sound was as jittery as on Linux, which suggests to me that the PortAudio issues in Jitsi may well affect non-ALSA setups. The following upload [1] contains an .mp3 recording of the jittery output from music@iptel.org, screen shots of my audio config in Jitsi and of the audio devices available.
[1] http://s000.tinyupload.com/index.php?file_id=90735638579400918904

Xubuntu 10.10 Maverick 64bit: strangely, initially I was getting more jitters when I was listening to the call than when re-playing the recording [2]. On a second try I got more jitters in the recording [3]. Again, [2] will provide a *.zip with mp3, logs and config. I used the settings suggested here. I also tried to
export PA_ALSA_PLUGHW=1

but that didn't seem to work; see screenshot.
[2] http://s000.tinyupload.com/index.php?file_id=00254896429802729626&gk=leasing
[3] http://s000.tinyupload.com/index.php?file_id=29358741103258063761&gk=leasing

Xubuntu 10.04 Lucid 64bit: here ALSA doesn't seem correctly configured and only Pulse is present. The jitters are unbearable and I didn't prepare any logs.

Again, all this is for the aplha builds. I'll provide some logs for the latest beta builds tomorrow. Cheers
Liviu

PS Please let me know if the logs contain any private information, to know if it's a good idea to make them publicly available.

···

On Tue, 08 Mar 2011 18:34:26 +0100, Werner Dittmann <Werner.Dittmann@t-online.de> wrote:


#9

Liviu,

have you tried without Pulse on a plain ALSA config? Regarding
to some feedback Pulse makes things worse. IMHO you need to uninstall
Pulse to make sure it is not used.

Regards,
Werner

···

Am 19.03.2011 00:25, schrieb Liviu Andronic:

Hello
I meant to write earlier but couldn't get the time to perform all the
testing as I wanted.

On Tue, 08 Mar 2011 18:34:26 +0100, Werner Dittmann > <Werner.Dittmann@t-online.de> wrote:

her are some results of the audio tests I did on my system. My
system is as follows:
- plain Alsa, no pulseaudio
- the audio device is: C-Media CMI8738 audio chip

I experimented with several setting of the portaudio in Jitsi and
had a protaudio software wih debugging enabled. I got the best
results when I use the following settings:

Input device: C-Media PCI DAC/ADC (hw:0,0) -- use the HW device
for Input
Output device: dmix -- use mixer for output
Notification dev.: dmix -- use mixer for
notifications

[..]

Hope this helps a little bit if somebody encounters a similar problem.
Feedback is welcome :slight_smile:

Now I will focus on my findings with pre-beta builds (I've since
upgraded to the betas and the behaviour seems different in some settings).

Win Vista 64bit: the sound was as jittery as on Linux, which suggests to
me that the PortAudio issues in Jitsi may well affect non-ALSA setups.
The following upload [1] contains an .mp3 recording of the jittery
output from music@iptel.org, screen shots of my audio config in Jitsi
and of the audio devices available.
[1] http://s000.tinyupload.com/index.php?file_id=90735638579400918904

Xubuntu 10.10 Maverick 64bit: strangely, initially I was getting more
jitters when I was listening to the call than when re-playing the
recording [2]. On a second try I got more jitters in the recording [3].
Again, [2] will provide a *.zip with mp3, logs and config. I used the
settings suggested here. I also tried to
export PA_ALSA_PLUGHW=1

but that didn't seem to work; see screenshot.
[2]
http://s000.tinyupload.com/index.php?file_id=00254896429802729626&gk=leasing

[3]
http://s000.tinyupload.com/index.php?file_id=29358741103258063761&gk=leasing

Xubuntu 10.04 Lucid 64bit: here ALSA doesn't seem correctly configured
and only Pulse is present. The jitters are unbearable and I didn't
prepare any logs.

Again, all this is for the aplha builds. I'll provide some logs for the
latest beta builds tomorrow. Cheers
Liviu

PS Please let me know if the logs contain any private information, to
know if it's a good idea to make them publicly available.


#10

have you tried without Pulse on a plain ALSA config?

The Maverick set-up is on plain ALSA (check the config shots in the zip). There 'libpulse0' is present, since removing it would uninstall a darn lot of applications. But 'pulseaudio' is removed. And for the debugs I used the configs you suggested earlier.

Regards
Liviu

···

On Sat, 19 Mar 2011 08:14:49 +0100, Werner Dittmann <Werner.Dittmann@t-online.de> wrote:

Regarding
to some feedback Pulse makes things worse. IMHO you need to uninstall
Pulse to make sure it is not used.

Regards,
Werner

Am 19.03.2011 00:25, schrieb Liviu Andronic:

Hello
I meant to write earlier but couldn't get the time to perform all the
testing as I wanted.

On Tue, 08 Mar 2011 18:34:26 +0100, Werner Dittmann >> <Werner.Dittmann@t-online.de> wrote:

her are some results of the audio tests I did on my system. My
system is as follows:
- plain Alsa, no pulseaudio
- the audio device is: C-Media CMI8738 audio chip

I experimented with several setting of the portaudio in Jitsi and
had a protaudio software wih debugging enabled. I got the best
results when I use the following settings:

Input device: C-Media PCI DAC/ADC (hw:0,0) -- use the HW device
for Input
Output device: dmix -- use mixer for output
Notification dev.: dmix -- use mixer for
notifications

[..]

Hope this helps a little bit if somebody encounters a similar problem.
Feedback is welcome :slight_smile:

Now I will focus on my findings with pre-beta builds (I've since
upgraded to the betas and the behaviour seems different in some settings).

Win Vista 64bit: the sound was as jittery as on Linux, which suggests to
me that the PortAudio issues in Jitsi may well affect non-ALSA setups.
The following upload [1] contains an .mp3 recording of the jittery
output from music@iptel.org, screen shots of my audio config in Jitsi
and of the audio devices available.
[1] http://s000.tinyupload.com/index.php?file_id=90735638579400918904

Xubuntu 10.10 Maverick 64bit: strangely, initially I was getting more
jitters when I was listening to the call than when re-playing the
recording [2]. On a second try I got more jitters in the recording [3].
Again, [2] will provide a *.zip with mp3, logs and config. I used the
settings suggested here. I also tried to
export PA_ALSA_PLUGHW=1

but that didn't seem to work; see screenshot.
[2]
http://s000.tinyupload.com/index.php?file_id=00254896429802729626&gk=leasing

[3]
http://s000.tinyupload.com/index.php?file_id=29358741103258063761&gk=leasing

Xubuntu 10.04 Lucid 64bit: here ALSA doesn't seem correctly configured
and only Pulse is present. The jitters are unbearable and I didn't
prepare any logs.

Again, all this is for the aplha builds. I'll provide some logs for the
latest beta builds tomorrow. Cheers
Liviu

PS Please let me know if the logs contain any private information, to
know if it's a good idea to make them publicly available.

--
Using Opera's revolutionary email client: http://www.opera.com/mail/