Latency tweaks for Windows Mobile 6

JM
Jerry Monteiro
Wed, Jan 13, 2010 1:09 AM

Hi Johan

We have done some tests using the below settings;

media_cfg.clock_rate = 8000;
media_cfg.ptime = 20;
media_cfg.audio_frame_ptime = 20; // GSM codec
media_cfg.ec_tail_len = 100; // 0
media_cfg.snd_rec_latency = 100;
media_cfg.snd_play_latency = 100;

  1. sip to sip call - the sound was okay
  2. sip client to mobile - the sound was bad at remote end, my end using
    touch pro the sound was 'tinnie'
  3. sip client to landline - the sound was okay and usable, but my end still
    sounded 'tinnie'

Would you be able to suggest any settings to try?
Also Benny/Johan, what would you suggest to use as a value for
PJMEDIA_SOUND_BUFFER_COUNT ?
In the mailing list, there are some people using 6, 16 or should I leave
default as 32?

Any help is greatly appreciated.

BR,
Jerry


Message: 2
Date: Tue, 12 Jan 2010 17:44:27 +0700
From: Nanang Izzuddin nanang@pjsip.org
To: pjsip list pjsip@lists.pjsip.org
Subject: Re: [pjsip] Latency tweaks for Windows Mobile 6
Message-ID:
f8a01ced1001120244i3e69f451l4c67b579e3d9acec@mail.gmail.com
Content-Type: text/plain; charset=ISO-8859-1

Hi Jerry,

I don't think ec_tail should be included in the calculation, honestly,
not really sure how ec_tail works, just logically it buffers some
playout frames for echo reference without necessarily delaying the
playout (as much as ec_tail). Moreover, also not really sure whether
rec_latency will really affect latency as much (any audio device
expert could clarify this?).

Some people did experience high end-to-end latency on WM, and this has
been discussed before.

BR,
nanang

On Tue, Jan 12, 2010 at 5:11 AM, Jerry Monteiro
jerrym@matrixconsultants.com.au wrote:

?hi Johan & Benny

Thanks for the replies.
Ok if we use what Benny is suggesting the PLAY Latency=160; based on the
below settings I will have a minimum latency in the app of 540ms (being

the

total of frame_ptime+ec_tail+rec latency+play latency).
Is my calculations correct? If my calculations are correct, I think the
latency will be very high once the sound gets to the remote party on an
actual call. Benny what do you recommend for the RECORD Latency value?

media_cfg.clock_rate = 8000;
media_cfg.ptime = 20; //default codec ptime
media_cfg.audio_frame_ptime = 20; //
media_cfg.ec_tail_len = 200; // 0
media_cfg.snd_rec_latency = 160; // original 100
media_cfg.snd_play_latency = 160; // original 100
media_cfg.ec_options = PJMEDIA_ECHO_SIMPLE; // default = 0

Best regards
jerry

Message: 4
Date: Mon, 11 Jan 2010 09:54:09 +0100
From: Johan Lantz johan.lantz@genaker.net
To: pjsip@lists.pjsip.org
Subject: Re: [pjsip] Latency tweaks for Windows Mobile 6 (Jerry
? ? ? ?Monteiro)
Message-ID: 4B4AE731.1010008@genaker.net
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi Jerry

I have only done measurments with ptime 80 and 100 and these are ok.

One thing that caused me a lot of problems was that some of my phones was
not able to produce frames fast enough when
PJMEDIA_SND_DEFAULT_REC_LATENCY
?was 100 i.e. the old setting. I think Benny changed this to a higher

value

later on but I still have 200 on some old devices like HTC 3600 while more
powerful devices like Motorola Symbol can handle 100.

I have never played with the
PJMEDIA_CODEC_MAX_SILENCE_PERIOD

/Johan

Jerry wrote:
Hi all

I am hoping someone could advise some of the optimal settings you have

found

to work well for windows mobile 6 and above.

Reading through the mailing lists, I have found some people that have used
the settings below, but would like if you could post the Values you have
used and perhaps other settings apart from the ones below.

#define PJMEDIA_SND_DEFAULT_REC_LATENCY ?= ?

#define PJMEDIA_SND_DEFAULT_PLAY_LATENCY = ?

PJMEDIA_CODEC_MAX_SILENCE_PERIOD = ?

frame ptime = ?


Message: 8
Date: Mon, 11 Jan 2010 16:22:29 +0000
From: Benny Prijono bennylp@teluu.com
To: pjsip list pjsip@lists.pjsip.org
Subject: Re: [pjsip] Latency tweaks for Windows Mobile 6 (Jerry
? ? ? ?Monteiro)
Message-ID:
? ? ? ?49a4be81001110822t6bd263e4se372863b01f7ec15@mail.gmail.com
Content-Type: text/plain; charset=ISO-8859-1

Thanks for the info, Johan.

Actually I changed PJMEDIA_SND_DEFAULT_PLAY_LATENCY (i.e. not REC)
from 100ms to 160ms for WM and to 140 on Win32, on release 1.5 (see
ticket #983).

Cheers
?Benny

On Mon, Jan 11, 2010 at 8:54 AM, Johan Lantz johan.lantz@genaker.net
wrote:

Hi Jerry

I have only done measurments with ptime 80 and 100 and these are ok.

One thing that caused me a lot of problems was that some of my phones was
not able to produce frames fast enough when

PJMEDIA_SND_DEFAULT_REC_LATENCY

was 100 i.e. the old setting. I think Benny changed this to a higher

value

later on but I still have 200 on some old devices like HTC 3600 while

more

powerful devices like Motorola Symbol can handle 100.

I have never played with the PJMEDIA_CODEC_MAX_SILENCE_PERIOD

/Johan

Hi Johan We have done some tests using the below settings; >media_cfg.clock_rate = 8000; > media_cfg.ptime = 20; > media_cfg.audio_frame_ptime = 20; // GSM codec > media_cfg.ec_tail_len = 100; // 0 > media_cfg.snd_rec_latency = 100; > media_cfg.snd_play_latency = 100; 1. sip to sip call - the sound was okay 2. sip client to mobile - the sound was bad at remote end, my end using touch pro the sound was 'tinnie' 3. sip client to landline - the sound was okay and usable, but my end still sounded 'tinnie' Would you be able to suggest any settings to try? Also Benny/Johan, what would you suggest to use as a value for PJMEDIA_SOUND_BUFFER_COUNT ? In the mailing list, there are some people using 6, 16 or should I leave default as 32? Any help is greatly appreciated. BR, Jerry ------------------------------ Message: 2 Date: Tue, 12 Jan 2010 17:44:27 +0700 From: Nanang Izzuddin <nanang@pjsip.org> To: pjsip list <pjsip@lists.pjsip.org> Subject: Re: [pjsip] Latency tweaks for Windows Mobile 6 Message-ID: <f8a01ced1001120244i3e69f451l4c67b579e3d9acec@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Hi Jerry, I don't think ec_tail should be included in the calculation, honestly, not really sure how ec_tail works, just logically it buffers some playout frames for echo reference without necessarily delaying the playout (as much as ec_tail). Moreover, also not really sure whether rec_latency will really affect latency as much (any audio device expert could clarify this?). Some people did experience high end-to-end latency on WM, and this has been discussed before. BR, nanang On Tue, Jan 12, 2010 at 5:11 AM, Jerry Monteiro <jerrym@matrixconsultants.com.au> wrote: > ?hi Johan & Benny > > Thanks for the replies. > Ok if we use what Benny is suggesting the PLAY Latency=160; based on the > below settings I will have a minimum latency in the app of 540ms (being the > total of frame_ptime+ec_tail+rec latency+play latency). > Is my calculations correct? If my calculations are correct, I think the > latency will be very high once the sound gets to the remote party on an > actual call. Benny what do you recommend for the RECORD Latency value? > > media_cfg.clock_rate = 8000; > media_cfg.ptime = 20; //default codec ptime > media_cfg.audio_frame_ptime = 20; // > media_cfg.ec_tail_len = 200; // 0 > media_cfg.snd_rec_latency = 160; // original 100 > media_cfg.snd_play_latency = 160; // original 100 > media_cfg.ec_options = PJMEDIA_ECHO_SIMPLE; // default = 0 > > Best regards > jerry > ------------------------------ > > Message: 4 > Date: Mon, 11 Jan 2010 09:54:09 +0100 > From: Johan Lantz <johan.lantz@genaker.net> > To: pjsip@lists.pjsip.org > Subject: Re: [pjsip] Latency tweaks for Windows Mobile 6 (Jerry > ? ? ? ?Monteiro) > Message-ID: <4B4AE731.1010008@genaker.net> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Hi Jerry > > I have only done measurments with ptime 80 and 100 and these are ok. > > One thing that caused me a lot of problems was that some of my phones was > not able to produce frames fast enough when > PJMEDIA_SND_DEFAULT_REC_LATENCY > ?was 100 i.e. the old setting. I think Benny changed this to a higher value > later on but I still have 200 on some old devices like HTC 3600 while more > powerful devices like Motorola Symbol can handle 100. > > I have never played with the > PJMEDIA_CODEC_MAX_SILENCE_PERIOD > > > /Johan > > Jerry wrote: > Hi all > > I am hoping someone could advise some of the optimal settings you have found > to work well for windows mobile 6 and above. > > Reading through the mailing lists, I have found some people that have used > the settings below, but would like if you could post the Values you have > used and perhaps other settings apart from the ones below. > > > > #define PJMEDIA_SND_DEFAULT_REC_LATENCY ?= ? > > #define PJMEDIA_SND_DEFAULT_PLAY_LATENCY = ? > > PJMEDIA_CODEC_MAX_SILENCE_PERIOD = ? > > frame ptime = ? > > ------------------------------ > > > Message: 8 > Date: Mon, 11 Jan 2010 16:22:29 +0000 > From: Benny Prijono <bennylp@teluu.com> > To: pjsip list <pjsip@lists.pjsip.org> > Subject: Re: [pjsip] Latency tweaks for Windows Mobile 6 (Jerry > ? ? ? ?Monteiro) > Message-ID: > ? ? ? ?<49a4be81001110822t6bd263e4se372863b01f7ec15@mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > Thanks for the info, Johan. > > Actually I changed PJMEDIA_SND_DEFAULT_PLAY_LATENCY (i.e. not REC) > from 100ms to 160ms for WM and to 140 on Win32, on release 1.5 (see > ticket #983). > > Cheers > ?Benny > > On Mon, Jan 11, 2010 at 8:54 AM, Johan Lantz <johan.lantz@genaker.net> > wrote: >> Hi Jerry >> >> I have only done measurments with ptime 80 and 100 and these are ok. >> >> One thing that caused me a lot of problems was that some of my phones was >> not able to produce frames fast enough when > PJMEDIA_SND_DEFAULT_REC_LATENCY >> was 100 i.e. the old setting. I think Benny changed this to a higher value >> later on but I still have 200 on some old devices like HTC 3600 while more >> powerful devices like Motorola Symbol can handle 100. >> >> I have never played with the PJMEDIA_CODEC_MAX_SILENCE_PERIOD >> >> >> /Johan
BP
Benny Prijono
Wed, Jan 13, 2010 6:15 PM

On Wed, Jan 13, 2010 at 1:09 AM, Jerry Monteiro
jerrym@matrixconsultants.com.au wrote:

Hi Johan

We have done some tests using the below settings;

media_cfg.clock_rate = 8000;
media_cfg.ptime = 20;
media_cfg.audio_frame_ptime = 20; // GSM codec
media_cfg.ec_tail_len = 100; // 0
media_cfg.snd_rec_latency = 100;
media_cfg.snd_play_latency = 100;

  1. sip to sip call - the sound was okay
  2. sip client to mobile - the sound was bad at remote end, my end using
    touch pro the sound was 'tinnie'
  3. sip client to landline - the sound was okay and usable, but my end still
    sounded 'tinnie'

Would you be able to suggest any settings to try?
Also Benny/Johan, what would you suggest to use as a value for
PJMEDIA_SOUND_BUFFER_COUNT ?
In the mailing list, there are some people using 6, 16 or should I leave
default as 32?

On recent PJSIP version, the PJMEDIA_SOUND_BUFFER_COUNT would be
calculated based on your PJMEDIA_SND_DEFAULT_PLAY_LATENCY, so you
shouldn't need to set its value anymore.

Re: tinnie sound, if my understanding of "tinnie sound" is the same as
yours, this normally is caused by linear resampling, so make sure
there's no resampling anywhere in the end to end media path. You can
also try disabling the EC for now, see if it affects anything.

Other than these, I'm afraid I don't have any specific suggestions,
other than keep experimenting. :)

Cheers
Benny

On Wed, Jan 13, 2010 at 1:09 AM, Jerry Monteiro <jerrym@matrixconsultants.com.au> wrote: > > Hi Johan > > We have done some tests using the below settings; > >>media_cfg.clock_rate = 8000; >> media_cfg.ptime = 20; >> media_cfg.audio_frame_ptime = 20; // GSM codec >> media_cfg.ec_tail_len = 100; // 0 >> media_cfg.snd_rec_latency = 100; >> media_cfg.snd_play_latency = 100; > > 1. sip to sip call - the sound was okay > 2. sip client to mobile - the sound was bad at remote end, my end using > touch pro the sound was 'tinnie' > 3. sip client to landline - the sound was okay and usable, but my end still > sounded 'tinnie' > > Would you be able to suggest any settings to try? > Also Benny/Johan, what would you suggest to use as a value for > PJMEDIA_SOUND_BUFFER_COUNT ? > In the mailing list, there are some people using 6, 16 or should I leave > default as 32? > On recent PJSIP version, the PJMEDIA_SOUND_BUFFER_COUNT would be calculated based on your PJMEDIA_SND_DEFAULT_PLAY_LATENCY, so you shouldn't need to set its value anymore. Re: tinnie sound, if my understanding of "tinnie sound" is the same as yours, this normally is caused by linear resampling, so make sure there's no resampling anywhere in the end to end media path. You can also try disabling the EC for now, see if it affects anything. Other than these, I'm afraid I don't have any specific suggestions, other than keep experimenting. :) Cheers Benny