Changeset 931


Ignore:
Timestamp:
Feb 4, 2007 5:04:33 PM (13 years ago)
Author:
bennylp
Message:

Fixed ticket #78: Noise in conference bridge because of upsampling and changes in audio level

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/conference.c

    r930 r931  
    6868 
    6969 
     70/* These are settings to control the adaptivity of changes in the 
     71 * signal level of the ports, so that sudden change in signal level 
     72 * in the port does not cause misaligned signal (which causes noise). 
     73 */ 
     74#if 1 
     75#   define ATTACK_A         3 
     76#   define ATTACK_B         2 
     77#   define DECAY_A          3 
     78#   define DECAY_B          2 
     79#else 
     80    /* To simulate old behavior */ 
     81#   define ATTACK_A         0 
     82#   define ATTACK_B         1 
     83#   define DECAY_A          0 
     84#   define DECAY_B          1 
     85#endif 
     86 
     87 
     88 
    7089/* 
    7190 * DON'T GET CONFUSED WITH TX/RX!! 
     
    95114    unsigned             clock_rate;    /**< Port's clock rate.             */ 
    96115    unsigned             samples_per_frame; /**< Port's samples per frame.  */ 
     116 
     117    /* Last level calculated from this port */ 
     118    pj_int32_t           last_level; 
    97119 
    98120    /* Calculated signal levels: */ 
     
    17171739        } 
    17181740 
     1741        /* Apply simple AGC to the level, to avoid dramatic change in the 
     1742         * level thus causing noise because the signal now is not aligned 
     1743         * with the signal from the previous frame. 
     1744         */ 
     1745        if (level >= conf_port->last_level) { 
     1746            level = (conf_port->last_level * ATTACK_A + level * ATTACK_B) /  
     1747                    (ATTACK_A + ATTACK_B); 
     1748        } else { 
     1749            level = (conf_port->last_level * DECAY_A + level * DECAY_B) /  
     1750                    (DECAY_A + DECAY_B); 
     1751        } 
     1752        conf_port->last_level = level; 
     1753 
     1754 
    17191755        /* Convert level to 8bit complement ulaw */ 
    17201756        level = pjmedia_linear2ulaw(level) ^ 0xff; 
Note: See TracChangeset for help on using the changeset viewer.