Changeset 5687
- Timestamp:
- Nov 9, 2017 10:48:17 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/conference.c
r4537 r5687 1942 1942 struct conf_port *listener; 1943 1943 pj_int32_t *mix_buf; 1944 unsigned k;1945 1944 1946 1945 listener = conf->ports[conf_port->listener_slots[cj]]; … … 1957 1956 * any overflowed level in the mixed signal. 1958 1957 */ 1959 for (k=0; k < conf->samples_per_frame; ++k) { 1958 unsigned k, samples_per_frame = conf->samples_per_frame; 1959 pj_int32_t mix_buf_min = 0; 1960 pj_int32_t mix_buf_max = 0; 1961 1962 for (k = 0; k < samples_per_frame; ++k) { 1960 1963 mix_buf[k] += p_in[k]; 1961 /* Check if normalization adjustment needed. */ 1962 if (IS_OVERFLOW(mix_buf[k])) { 1963 /* NORMAL_LEVEL * MAX_LEVEL / mix_buf[k]; */ 1964 int tmp_adj = (MAX_LEVEL<<7) / mix_buf[k]; 1965 if (tmp_adj<0) tmp_adj = -tmp_adj; 1966 1967 if (tmp_adj<listener->mix_adj) 1968 listener->mix_adj = tmp_adj; 1969 1970 } /* if any overflow in the mixed signals */ 1971 } /* loop mixing signals */ 1964 if (mix_buf[k] < mix_buf_min) 1965 mix_buf_min = mix_buf[k]; 1966 if (mix_buf[k] > mix_buf_max) 1967 mix_buf_max = mix_buf[k]; 1968 } 1969 1970 /* Check if normalization adjustment needed. */ 1971 if (mix_buf_min < MIN_LEVEL || mix_buf_max > MAX_LEVEL) { 1972 if (-mix_buf_min > mix_buf_max) 1973 mix_buf_max = -mix_buf_min; 1974 1975 /* NORMAL_LEVEL * MAX_LEVEL / mix_buf_max; */ 1976 int tmp_adj = (MAX_LEVEL<<7) / mix_buf_max; 1977 if (tmp_adj < listener->mix_adj) 1978 listener->mix_adj = tmp_adj; 1979 } 1972 1980 } else { 1973 1981 /* Only 1 transmitter: … … 1975 1983 * no mixing and level adjustment needed 1976 1984 */ 1977 for (k=0; k<conf->samples_per_frame; ++k) { 1985 unsigned k, samples_per_frame = conf->samples_per_frame; 1986 1987 for (k = 0; k < samples_per_frame; ++k) { 1978 1988 mix_buf[k] = p_in[k]; 1979 1989 }
Note: See TracChangeset
for help on using the changeset viewer.