Re: AEC echo cancelling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I suggest editing echo_webrtc.c and remove passing echo tail to webrtc process function and instead pass 0. I don't have code in front of me. Alternatively you could use 1 which would be a negligible latency estimate of 1 msec, and PJSIP will still enable AEC.

Don't change sndPlayLatency/andRecLatency, those define the audio buffer sizes.

Regards,

Bill

On 8/31/2016 11:23 AM, Severin Birrer wrote:
Hi Bill,

With the mobile AEC we're getting much better result's. It is now just a little noisy in the start of a call for a few seconds, but there is no echo :)
Thank you all so far^^

With "passing 0 as the latency estimate (in place of echo tail)" do you mean, i have to set the ecTailLen=0?
But then the AEC get's disabled with pjsua2.

Or do you mean set sndPlayLatency/sndRecLatency to 0.

Or how do I set the latency estimate?

Best Regards
Severin

Best Options so far:
       EpConfig ep_cfg;
       ep_cfg.medConfig.noVad=true;
       ep_cfg.medConfig.ecTailLen=1;
       ep_cfg.medConfig.sndRecLatency=0;
       ep_cfg.medConfig.sndPlayLatency=0;
       ep_cfg.medConfig.ecOptions=PJMEDIA_ECHO_WEBRTC|PJMEDIA_ECHO_USE_NOISE_SUPPRESSOR|PJMEDIA_ECHO_AGGRESSIVENESS_AGGRESSIVE;

Log:
07:00:40.169 echo_webrtc.c ........WebRTC AEC mobile successfully created with options 899
07:00:40.170   ec0x74e1bf50  ........WebRTC AEC created, clock_rate=16000, channel=1, samples per frame=320, tail length=1 ms, latency=25 ms


----- Ursprüngliche Mail -----
Von: "Bill Gardner" <billg@xxxxxxxxxxxx>
An: "pjsip" <pjsip@xxxxxxxxxxxxxxx>
Gesendet: Mittwoch, 31. August 2016 15:46:43
Betreff: Re:  AEC echo cancelling

Hi Severin,

It's very misleading that PSJIP passes the echo tail length to WebRTC.
WebRTC wants an estimate of the latency, not the echo tail length. If
you pass in too high a value, the echo cancellation will not work. I
think PJSIP implemented it this way because one can use the echo tail
parameter to pass a command line value all the way down to the AEC.

The mobile AEC does not have the automatic latency estimator, but it can
handle a much larger variation in latency and therefore does not need
an accurate estimate. I'd recommend using the mobile AEC and passing 0
as the latency estimate (in place of echo tail).

If not using mobile AEC, I'd still recommend using 0 as the latency
estimate. Note that the PJSIP echo framework automatically compensates
for audio buffer latency and passes signals to the echo canceller that
are more or less properly aligned. The recorded audio has to be delayed
somewhat from the playback audio or echo cancellation will completely
fail. But hopefully the echo framework has removed a lot of the recorded
delay due to buffering.

Regards,

Bill



On 8/31/2016 8:11 AM, Severin Birrer wrote:
Hi Riza,
With the Information in #1954 I could successfully build webrtc aec (SVN trunk rev 5435).

The results were a lot better as with SPEEX aec. But only if I wait for about 20 seconds. (Because of wrong tail-length I think)
But I still have some trouble to find the correct tail-length value. I enabled the printing of the log line with the median (set SHOW_DELAY_METRICS 250 and disabled PJMEDIA_WEBRTC_AEC_USE_MOBILE). But still get the same results (about 20 seconds of waiting with echo) if I adjust the EC tail value to the median value of 4 (strange value?) i got from log.
Do I miss something?

Kind Regards,
Severin

Config:
      EpConfig ep_cfg;
      ep_cfg.medConfig.noVad=true;
      ep_cfg.medConfig.ecTailLen=25;
      ep_cfg.medConfig.ecOptions=PJMEDIA_ECHO_WEBRTC|PJMEDIA_ECHO_USE_NOISE_SUPPRESSOR|PJMEDIA_ECHO_AGGRESSIVENESS_AGGRESSIVE;
      ep.libInit( ep_cfg );

Log output:

03:38:48.615   pjsua_call.c  ..Answering call 0: code=200
03:38:48.616  pjsua_media.c  .....Call 0: updating media..
03:38:48.617  pjsua_media.c  ......Audio updated, stream #0:  (inactive)
03:38:48.617    pjsua_aud.c  ......Audio channel update..
03:38:48.619 strm0x74e1452c  .......Encoder stream started
03:38:48.620 strm0x74e1452c  .......Decoder stream started
03:38:48.620  pjsua_media.c  ......Audio updated, stream #1: G722 (sendrecv)
!*** Recording device is: sysdefault:CARD=imxsgtl5000 With ID: -1
!*** Playback device is: sysdefault:CARD=imxsgtl5000 With ID: -2
03:38:48.623    pjsua_aud.c  .....Conf connect: 2 --> 0
03:38:48.623    pjsua_aud.c  ......Set sound device: capture=-1, playback=-2
03:38:48.624    pjsua_aud.c  .......Opening sound device (speaker + mic) PCM@16000/1/20ms
03:38:48.656  echo_webrtc.c  ........WebRTC AEC successfully created with options 899
03:38:48.657   ec0x74e1bf50  ........WebRTC AEC created, clock_rate=16000, channel=1, samples per frame=320, tail length=25 ms, latency=100 ms
03:38:48.659   conference.c  ......Port 2 (sip:202@192.168.139.152;user=phone) transmitting to port 0 (sysdefault:CARD=imxsgtl5000)
03:38:48.660    pjsua_aud.c  .....Conf connect: 0 --> 2
03:38:48.661   conference.c  ......Port 0 (sysdefault:CARD=imxsgtl5000) transmitting to port 2 (sip:202@192.168.139.152;user=phone)
*****
03:38:48.687   Master/sound !Underflow, buf_cnt=0, will generate 1 frame
03:38:48.690   Master/sound  Underflow, buf_cnt=0, will generate 1 frame
03:38:48.696   Master/sound  Underflow, buf_cnt=0, will generate 1 frame
03:38:48.697   Master/sound  Underflow, buf_cnt=0, will generate 1 frame
03:38:48.701   Master/sound  Underflow, buf_cnt=0, will generate 1 frame
03:38:48.705   Master/sound  Underflow, buf_cnt=0, will generate 1 frame
03:38:48.708   Master/sound  Underflow, buf_cnt=0, will generate 1 frame
03:38:48.924       stream.c !G722 codec used, remote samples per frame detected = 80
03:38:53.695  echo_webrtc.c !WebRTC delay metrics: --> median=-28, std=48, fraction of poor delays=1.000000
03:38:58.587   ec0x74e1bf50 !Buffer size adjusted from 960 to 513 (eff_cnt=635)
03:38:58.695  echo_webrtc.c !WebRTC delay metrics: --> median=-28, std=0, fraction of poor delays=1.000000
03:39:03.695  echo_webrtc.c  WebRTC delay metrics: --> median=-28, std=0, fraction of poor delays=1.000000
03:39:08.695  echo_webrtc.c  WebRTC delay metrics: --> median=-24, std=4, fraction of poor delays=0.919200
03:39:13.695  echo_webrtc.c  WebRTC delay metrics: --> median=4, std=0, fraction of poor delays=0.000000
03:39:18.694  echo_webrtc.c  WebRTC delay metrics: --> median=4, std=0, fraction of poor delays=0.000000
03:39:23.694  echo_webrtc.c  WebRTC delay metrics: --> median=4, std=0, fraction of poor delays=0.000000
03:39:28.694  echo_webrtc.c  WebRTC delay metrics: --> median=4, std=0, fraction of poor delays=0.000000




----- Ursprüngliche Mail -----
Von: "Riza Sulistyo" <riza@xxxxxxxxx>
An: "pjsip" <pjsip@xxxxxxxxxxxxxxx>
Gesendet: Dienstag, 30. August 2016 11:08:45
Betreff: Re:  AEC echo cancelling

Hi Severin,
We have added webrtc aec on #1954 .
Maybe you can try that.
For tweaking purposes, the information on #1888 is still relevant.

Best Regards,

Riza

On Tue, Aug 30, 2016 at 3:02 PM, Severin Birrer < severin.birrer@xxxxxxx > wrote:


I'm trying to get some better Results with the AEC. (pjproject Version 2.5.5)
I tried SPEEX AEC but the echo cancelling doesn't work as hoped for.
The cancelling works, but you still get a little echo and after some time (one minute or so) the background noise gets louder and I think the cancelling gets also worse.
Do I have to set some more parameters than the ecTailLen and ecOptions?

The other Thing i tried is to integrate WebRTC AEC (Mostly described in Ticket #1888). But no luck there to compile it in, because of a missing full-howto.
Steps done so far with WebRTC:
1. Get the depot_tools
2. Get/Build webrtc:
mkdir webrtc-checkout
cd webrtc-checkout
fetch --nohooks webrtc
gclient sync
gn gen out/Release
ninja -C out/Release
3. Configure pjsip:
./configure --with-webrtc=~/webrtc-checkout

Log output of configure:
Using webrtc prefix... /home/yocto/webrtc-checkout
checking for WebRtcAec_Process in -laudio_processing... no


I think the webrtc aec libraries (audio_processing, common_audio, system_wrappers) doesn't get built.
Is it due to the compatibility issue described in the ticket? Which Version do I have to get, or more, how do I get it?


My setup:
Buildsystem Ubuntu
Target Yocto Linux on a i.MX6 (ARM)
Loudspeaker & MIC
SGTL5000 Audiocodec
Latency: about 200ms (measured with pjsystest Latency Test)

My initialisation routine of EC is:
EpConfig ep_cfg;
ep_cfg.medConfig.noVad=true;
ep_cfg.medConfig.ecTailLen=300;
ep_cfg.medConfig.ecOptions=PJMEDIA_ECHO_SPEEX|PJMEDIA_ECHO_USE_NOISE_SUPPRESSOR|PJMEDIA_ECHO_USE_SW_ECHO|PJMEDIA_ECHO_AGGRESSIVENESS_AGGRESSIVE;
ep.libInit( ep_cfg );

Log output of SPEEX AEC:
10:37:54.669 pjsua_call.c ..Answering call 0: code=200
10:37:54.670 pjsua_media.c .....Call 0: updating media..
10:37:54.671 pjsua_media.c ......Audio updated, stream #0: (inactive)
10:37:54.672 pjsua_aud.c ......Audio channel update..
10:37:54.674 strm0x74d1452c .......Encoder stream started
10:37:54.674 strm0x74d1452c .......Decoder stream started
10:37:54.675 pjsua_media.c ......Audio updated, stream #1: G722 (sendrecv)
!*** Recording device is: sysdefault:CARD=imxsgtl5000 With ID: -1
!*** Playback device is: sysdefault:CARD=imxsgtl5000 With ID: -2
10:37:54.678 pjsua_aud.c .....Conf connect: 2 --> 0
10:37:54.678 pjsua_aud.c ......Set sound device: capture=-1, playback=-2
10:37:54.678 pjsua_aud.c .......Opening sound device (speaker + mic) PCM@16000/1/20ms
10:37:54.713 ec0x74d1bf50 ........AEC created, clock_rate=16000, channel=1, samples per frame=320, tail length=300 ms, latency=0 ms
10:37:54.715 conference.c ......Port 2 ( sip:203@192.168.139.152 ;user=phone) transmitting to port 0 (sysdefault:CARD=imxsgtl5000)
10:37:54.716 pjsua_aud.c .....Conf connect: 0 --> 2
10:37:54.717 conference.c ......Port 0 (sysdefault:CARD=imxsgtl5000) transmitting to port 2 ( sip:203@192.168.139.152 ;user=phone)

-----------------------------------------------------------------------------------
Severin Birrer

FELA Management AG Phone : +41 52 646 46 37
Basadingerstrasse 18 Fax : +41 52 646 46 96
CH-8253 Diessenhofen Mail : mailto: severin.birrer@xxxxxxx
http://www.fela.ch/

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org





_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org


_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org


_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org




[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux