Changeset 4378


Ignore:
Timestamp:
Feb 27, 2013 9:50:59 AM (11 years ago)
Author:
nanang
Message:

Re #1532: backported to 1.x

Location:
pjproject/branches/1.x
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/1.x

  • pjproject/branches/1.x/pjmedia/src/pjmedia/conference.c

    r3553 r4378  
    18011801        struct conf_port *conf_port = conf->ports[i]; 
    18021802 
    1803         /* Skip empty slot. */ 
     1803        /* Skip empty port. */ 
    18041804        if (!conf_port) 
    18051805            continue; 
    18061806 
     1807        /* Var "ci" is to count how many ports have been visited so far. */ 
    18071808        ++ci; 
    18081809 
    1809         /* Reset buffer & auto adjustment level for mixed signal */ 
     1810        /* Reset buffer (only necessary if more than one transmitter) and 
     1811         * reset auto adjustment level for mixed signal. 
     1812         */ 
    18101813        conf_port->mix_adj = NORMAL_LEVEL; 
    1811         if (conf_port->transmitter_cnt) { 
     1814        if (conf_port->transmitter_cnt > 1) { 
    18121815            pj_bzero(conf_port->mix_buf, 
    18131816                     conf->samples_per_frame*sizeof(conf_port->mix_buf[0])); 
     
    18181821     * to mix_buf of all listeners of the port. 
    18191822     */ 
    1820     for (i=0, ci=0; i<conf->max_ports && ci<conf->port_cnt; ++i) { 
     1823    for (i=0, ci=0; i < conf->max_ports && ci < conf->port_cnt; ++i) { 
    18211824        struct conf_port *conf_port = conf->ports[i]; 
    18221825        pj_int32_t level = 0; 
     
    19461949            mix_buf = listener->mix_buf; 
    19471950 
    1948             /* Mixing signals, 
    1949              * and calculate appropriate level adjustment if there is 
    1950              * any overflowed level in the mixed signal. 
    1951              */ 
    1952             for (k=0; k<conf->samples_per_frame; ++k) { 
    1953                 mix_buf[k] += p_in[k]; 
    1954                 /* Check if normalization adjustment needed. */ 
    1955                 if (IS_OVERFLOW(mix_buf[k])) { 
    1956                     /* NORMAL_LEVEL * MAX_LEVEL / mix_buf[k]; */ 
    1957                     int tmp_adj = (MAX_LEVEL<<7) / mix_buf[k]; 
    1958                     if (tmp_adj<0) tmp_adj = -tmp_adj; 
    1959  
    1960                     if (tmp_adj<listener->mix_adj) 
    1961                         listener->mix_adj = tmp_adj; 
    1962  
    1963                 } /* if any overflow in the mixed signals */ 
    1964             } /* loop mixing signals */ 
     1951            if (listener->transmitter_cnt > 1) { 
     1952                /* Mixing signals, 
     1953                 * and calculate appropriate level adjustment if there is 
     1954                 * any overflowed level in the mixed signal. 
     1955                 */ 
     1956                for (k=0; k < conf->samples_per_frame; ++k) { 
     1957                    mix_buf[k] += p_in[k]; 
     1958                    /* Check if normalization adjustment needed. */ 
     1959                    if (IS_OVERFLOW(mix_buf[k])) { 
     1960                        /* NORMAL_LEVEL * MAX_LEVEL / mix_buf[k]; */ 
     1961                        int tmp_adj = (MAX_LEVEL<<7) / mix_buf[k]; 
     1962                        if (tmp_adj<0) tmp_adj = -tmp_adj; 
     1963 
     1964                        if (tmp_adj<listener->mix_adj) 
     1965                            listener->mix_adj = tmp_adj; 
     1966 
     1967                    } /* if any overflow in the mixed signals */ 
     1968                } /* loop mixing signals */ 
     1969            } else { 
     1970                /* Only 1 transmitter: 
     1971                 * just copy the samples to the mix buffer 
     1972                 * no mixing and level adjustment needed 
     1973                 */ 
     1974                for (k=0; k<conf->samples_per_frame; ++k) { 
     1975                    mix_buf[k] = p_in[k]; 
     1976                } 
     1977            } 
    19651978        } /* loop the listeners of conf port */ 
    19661979    } /* loop of all conf ports */ 
Note: See TracChangeset for help on using the changeset viewer.