Changeset 5702


Ignore:
Timestamp:
Nov 27, 2017 3:29:07 AM (7 years ago)
Author:
ming
Message:

Fixed #2068: Add compile time option to enable/disable simple AGC in conference

Location:
pjproject/trunk/pjmedia
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/config.h

    r5643 r5702  
    7373#ifndef PJMEDIA_CONF_SWITCH_BOARD_BUF_SIZE 
    7474#   define PJMEDIA_CONF_SWITCH_BOARD_BUF_SIZE    PJMEDIA_MAX_MTU 
     75#endif 
     76 
     77/** 
     78 * Specify whether the conference bridge uses AGC, an automatic adjustment to 
     79 * avoid dramatic change in the signal level which can cause noise. 
     80 * 
     81 * Default: 1 (enabled) 
     82 */ 
     83#ifndef PJMEDIA_CONF_USE_AGC 
     84#   define PJMEDIA_CONF_USE_AGC             1 
    7585#endif 
    7686 
  • pjproject/trunk/pjmedia/src/pjmedia/conference.c

    r5698 r5702  
    7676 * in the port does not cause misaligned signal (which causes noise). 
    7777 */ 
    78 #define ATTACK_A    (conf->clock_rate / conf->samples_per_frame) 
    79 #define ATTACK_B    1 
    80 #define DECAY_A     0 
    81 #define DECAY_B     1 
    82  
    83 #define SIMPLE_AGC(last, target) \ 
     78#if defined(PJMEDIA_CONF_USE_AGC) && PJMEDIA_CONF_USE_AGC != 0 
     79#   define ATTACK_A     ((conf->clock_rate / conf->samples_per_frame) >> 4) 
     80#   define ATTACK_B     1 
     81#   define DECAY_A      0 
     82#   define DECAY_B      1 
     83 
     84#   define SIMPLE_AGC(last, target) \ 
    8485    if (target >= last) \ 
    8586        target = (ATTACK_A*(last+1)+ATTACK_B*target)/(ATTACK_A+ATTACK_B); \ 
    8687    else \ 
    8788        target = (DECAY_A*last+DECAY_B*target)/(DECAY_A+DECAY_B) 
     89#else 
     90#   define SIMPLE_AGC(last, target) 
     91#endif 
    8892 
    8993#define MAX_LEVEL   (32767) 
Note: See TracChangeset for help on using the changeset viewer.