summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2012-06-11 04:17:54 +0000
committerNanang Izzuddin <nanang@teluu.com>2012-06-11 04:17:54 +0000
commit85dfbb7a8b1d674fc5c5205212995b7d0dfbcaab (patch)
tree47864749373556e65b5ff0e00dce3b90c5326ef7
parent1dd8591c0c05821ee0c9acd9b8d2ef8e03811308 (diff)
Re #1532: put back the 'redundant' loop at the beginning.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4162 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjmedia/src/pjmedia/conference.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/pjmedia/src/pjmedia/conference.c b/pjmedia/src/pjmedia/conference.c
index c32fd4e9..d155d0ee 100644
--- a/pjmedia/src/pjmedia/conference.c
+++ b/pjmedia/src/pjmedia/conference.c
@@ -1797,12 +1797,11 @@ static pj_status_t get_frame(pjmedia_port *this_port,
/* Must lock mutex */
pj_mutex_lock(conf->mutex);
- /* Get frames from all ports, and "mix" the signal
- * to mix_buf of all listeners of the port.
+ /* Reset port source count. We will only reset port's mix
+ * buffer when we have someone transmitting to it.
*/
- for (i=0, ci=0; i < conf->max_ports && ci < conf->port_cnt; ++i) {
+ for (i=0, ci=0; i<conf->max_ports && ci < conf->port_cnt; ++i) {
struct conf_port *conf_port = conf->ports[i];
- pj_int32_t level = 0;
/* Skip empty port. */
if (!conf_port)
@@ -1811,13 +1810,29 @@ static pj_status_t get_frame(pjmedia_port *this_port,
/* Var "ci" is to count how many ports have been visited so far. */
++ci;
- /* Reset buffer (only necessary if more than one transmitter) &
- * reset auto adjustment level for mixed signal */
+ /* Reset buffer (only necessary if more than one transmitter) and
+ * reset auto adjustment level for mixed signal.
+ */
conf_port->mix_adj = NORMAL_LEVEL;
if (conf_port->transmitter_cnt > 1) {
pj_bzero(conf_port->mix_buf,
conf->samples_per_frame*sizeof(conf_port->mix_buf[0]));
}
+ }
+
+ /* Get frames from all ports, and "mix" the signal
+ * to mix_buf of all listeners of the port.
+ */
+ for (i=0, ci=0; i < conf->max_ports && ci < conf->port_cnt; ++i) {
+ struct conf_port *conf_port = conf->ports[i];
+ pj_int32_t level = 0;
+
+ /* Skip empty port. */
+ if (!conf_port)
+ continue;
+
+ /* Var "ci" is to count how many ports have been visited so far. */
+ ++ci;
/* Skip if we're not allowed to receive from this port. */
if (conf_port->rx_setting == PJMEDIA_PORT_DISABLE) {