最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

PJSIP audio has low volume in beginning, if aec enabled - Stack Overflow

programmeradmin3浏览0评论

After a call negotiated and connected, for first 5 seconds (approx.), outgoing (tx) sound very low and many times distorted. If after a long time silence, same case occurred. If we disable aec (ec_length = 0), no problem occurred, but all noise cancelling, echo cancelling vs is unavailable :(.

Pjsip 2.9 - 2.15.1 Arm64, armhf, different hardwares all tested. Linux, 4.14 - 6.x.

I m tryed many different configuration options, such as, disable agc, different aec algorithms, different sampler and sample rates etc. Problem is always occurred. I think, problem source independent from these configurations.

A simple configuration for this situation:

  1. PJSIP 2.14.1 with configured by:

    ./aconfigure --prefix=/usr/local/pj214/ --disable-libyuv --disable-libsrtp

  2. After configure an make libs and belongated binaries (python wrappers), i'm link this libraries (static) to my codes (python pjsua.py) and C++ codes (Qt5).

  3. I m repeat this process for different hardware and OS versions, such as:

    a. FriendlyELEC Core4418 (ARM S5P4418 + ES8613 Codec)

    b. Orange PI Zero (Allwinner H3 CPU + Embedded CODEC)

    c. Allwinner V3S Custom board

  4. For OS, in generally based fo Ubuntu 16 LTS Editions. No GUI and video I/O used. I try disable video options and can't change everything..

    1. PJSUA Initialization for media (simplified):

          ec_tail_ms = 100;
          vad_disabled = 0;
          enable_ice = 0;
          aec_options = PJMEDIA_ECHO_AGGRESSIVENESS_DEFAULT|PJMEDIA_ECHO_DEFAULT;
          rec_latency = PJMEDIA_SND_DEFAULT_REC_LATENCY;
          play_latency = PJMEDIA_SND_DEFAULT_PLAY_LATENCY;
          resample_quality = 5;
          med_cfg->enable_ice = enable_ice;
      
      
      
          med_cfg->channel_count  = sys_aud_ch_count; // 1
          med_cfg->no_vad = vad_disabled; // 0
          med_cfg->ec_tail_len = ec_tail_ms; // 100
          med_cfg->ec_options  = aec_options; // PJMEDIA_ECHO_AGGRESSIVENESS_DEFAULT|PJMEDIA_ECHO_DEFAULT;
          med_cfg->snd_rec_latency = rec_latency; // default
          med_cfg->snd_play_latency = play_latency; // default
          med_cfg->quality = resample_quality; // 5
          med_cfg->max_media_ports = 254;
          status = pjsua_init(&ua_cfg, &log_cfg, &med_cfg);
      
  5. After compilation (no problems occurred generally), plug mic jack and test. But for first approx. 5 seconds, TX audio (from mic to remote) too low (most time) or very bad (rare). If change above configuration with:

       med_cfg->ec_tail_len = 0;

This problem not occurred, audio quality is good. For other AEC algorithms etc, not effect this case.. I m used only ALAW/ULAW codecs with 8000 sps rate. For another example with python pjsua, you can test this with mainstream provided sample script "call.py"

            global_lib = pj.Lib()
            ua = pj.UAConfig()
            # This snippet from pjsua python call sample..

            mc = pj.MediaConfig()
            mc.clock_rate = 48000         #-- specify the core clock rate of the audio, most notably the conference bridge.
            mc.snd_clock_rate = 48000     #-- optionally specify different clock rate for the sound device.
            mc.channel_count  = 1         # -- specify the number of channels to open the sound  device and the conference bridge.
            #mc.audio_frame_ptime = 160    # -- specify the length of audio frames in millisecond.
            mc.ec_tail_len = 0
            mc.vad_disabled = True
            ua.max_calls = 16
            global_lib.init(log_cfg = pj.LogConfig(level=LOG_LEVEL, console_level=LOG_LEVEL, callback=log_cb), ua_cfg = ua, media_cfg = mc)
发布评论

评论列表(0)

  1. 暂无评论