Changeset 731 for pjproject/trunk
- Timestamp:
- Sep 20, 2006 8:02:18 PM (18 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/sound_port.h
r658 r731 221 221 222 222 223 /** 224 * Enable or disable echo canceller. By default the EC is enabled after it 225 * was created, so there is no need to enable the EC after creating it. 226 * This function is only useful to disable the echo canceller temporarily, 227 * for example during idle period, to prevent EC from using 228 */ 223 229 224 230 /** -
pjproject/trunk/pjmedia/src/pjmedia/conference.c
r655 r731 1267 1267 */ 1268 1268 static pj_status_t write_port(pjmedia_conf *conf, struct conf_port *cport, 1269 pj_uint32_t timestamp) 1269 pj_uint32_t timestamp, 1270 pjmedia_frame_type *frm_type) 1270 1271 { 1271 1272 pj_int16_t *buf; … … 1273 1274 pj_status_t status; 1274 1275 1276 *frm_type = PJMEDIA_FRAME_TYPE_AUDIO; 1277 1275 1278 /* If port is muted or nobody is transmitting to this port, 1276 1279 * transmit NULL frame. … … 1293 1296 1294 1297 cport->tx_level = 0; 1298 *frm_type = PJMEDIA_FRAME_TYPE_NONE; 1295 1299 return PJ_SUCCESS; 1296 1300 1297 1301 } else if (cport->tx_setting != PJMEDIA_PORT_ENABLE) { 1298 1302 cport->tx_level = 0; 1303 *frm_type = PJMEDIA_FRAME_TYPE_NONE; 1299 1304 return PJ_SUCCESS; 1300 1305 } … … 1487 1492 { 1488 1493 pjmedia_conf *conf = this_port->port_data.pdata; 1494 pjmedia_frame_type speaker_frame_type = PJMEDIA_FRAME_TYPE_NONE; 1489 1495 unsigned ci, cj, i, j; 1490 1496 … … 1684 1690 for (i=0, ci=0; i<conf->max_ports && ci<conf->port_cnt; ++i) { 1685 1691 struct conf_port *conf_port = conf->ports[i]; 1692 pjmedia_frame_type frm_type; 1686 1693 pj_status_t status; 1687 1694 … … 1692 1699 ++ci; 1693 1700 1694 status = write_port( conf, conf_port, frame->timestamp.u32.lo); 1701 status = write_port( conf, conf_port, frame->timestamp.u32.lo, 1702 &frm_type); 1695 1703 if (status != PJ_SUCCESS) { 1696 1704 /* bennylp: why do we need this???? … … 1709 1717 continue; 1710 1718 } 1719 1720 /* Set the type of frame to be returned to sound playback 1721 * device. 1722 */ 1723 if (i == 0) 1724 speaker_frame_type = frm_type; 1711 1725 } 1712 1726 … … 1723 1737 1724 1738 /* MUST set frame type */ 1725 frame->type = PJMEDIA_FRAME_TYPE_AUDIO;1739 frame->type = speaker_frame_type; 1726 1740 1727 1741 pj_mutex_unlock(conf->mutex); … … 1745 1759 { 1746 1760 pj_assert(0); 1761 PJ_UNUSED_ARG(this_port); 1762 PJ_UNUSED_ARG(frame); 1747 1763 return -1; 1748 1764 } -
pjproject/trunk/pjmedia/src/pjmedia/port.c
r631 r731 63 63 { 64 64 PJ_ASSERT_RETURN(port && frame, PJ_EINVAL); 65 PJ_ASSERT_RETURN(port->get_frame, PJ_EINVALIDOP);66 65 67 return port->get_frame(port, frame); 66 if (port->get_frame) 67 return port->get_frame(port, frame); 68 else { 69 frame->type = PJMEDIA_FRAME_TYPE_NONE; 70 return PJ_EINVALIDOP; 71 } 68 72 } 69 73 … … 76 80 { 77 81 PJ_ASSERT_RETURN(port && frame, PJ_EINVAL); 78 PJ_ASSERT_RETURN(port->put_frame, PJ_EINVALIDOP);79 82 80 return port->put_frame(port, frame); 81 83 if (port->put_frame) 84 return port->put_frame(port, frame); 85 else 86 return PJ_EINVALIDOP; 82 87 } 83 88 -
pjproject/trunk/pjmedia/src/pjmedia/sound_port.c
r723 r731 35 35 36 36 //#define SIMULATE_LOST_PCT 20 37 #define AEC_TAIL 128 /* default AEC length in ms */ 37 #define AEC_TAIL 128 /* default AEC length in ms */ 38 #define AEC_SUSPEND_LIMIT 5 /* seconds of no activity */ 38 39 39 40 #define THIS_FILE "sound_port.c" … … 59 60 pjmedia_echo_state *ec_state; 60 61 unsigned aec_tail_len; 62 63 pj_bool_t ec_suspended; 64 unsigned ec_suspend_count; 65 unsigned ec_suspend_limit; 66 61 67 pjmedia_plc *plc; 62 68 … … 117 123 118 124 if (snd_port->ec_state) { 125 if (snd_port->ec_suspended) { 126 snd_port->ec_suspended = PJ_FALSE; 127 PJ_LOG(4,(THIS_FILE, "EC activated")); 128 } 129 snd_port->ec_suspend_count = 0; 119 130 pjmedia_echo_playback(snd_port->ec_state, output); 120 131 } … … 124 135 125 136 no_frame: 137 138 if (!snd_port->ec_suspended) { 139 ++snd_port->ec_suspend_count; 140 if (snd_port->ec_suspend_count > snd_port->ec_suspend_limit) { 141 snd_port->ec_suspended = PJ_TRUE; 142 PJ_LOG(4,(THIS_FILE, "EC suspended because of inactivity")); 143 } 144 } 126 145 127 146 /* Apply PLC */ … … 165 184 166 185 /* Cancel echo */ 167 if (snd_port->ec_state ) {186 if (snd_port->ec_state && !snd_port->ec_suspended) { 168 187 pjmedia_echo_capture(snd_port->ec_state, input, 0); 169 188 } … … 254 273 } 255 274 275 /* Inactivity limit before EC is suspended. */ 276 snd_port->ec_suspend_limit = AEC_SUSPEND_LIMIT * 277 (snd_port->clock_rate / 278 snd_port->samples_per_frame); 256 279 257 280 /* Start sound stream. */ … … 455 478 if (status != PJ_SUCCESS) 456 479 snd_port->ec_state = NULL; 480 else 481 snd_port->ec_suspended = PJ_FALSE; 457 482 } else { 458 483 PJ_LOG(4,(THIS_FILE, "Echo canceller is now disabled in the " -
pjproject/trunk/pjmedia/src/pjmedia/wav_player.c
r727 r731 71 71 72 72 73 static pj_status_t file_put_frame(pjmedia_port *this_port,74 const pjmedia_frame *frame);75 73 static pj_status_t file_get_frame(pjmedia_port *this_port, 76 74 pjmedia_frame *frame); … … 92 90 8000, 1, 16, 80); 93 91 94 port->base.put_frame = &file_put_frame;95 92 port->base.get_frame = &file_get_frame; 96 93 port->base.on_destroy = &file_on_destroy; … … 470 467 471 468 /* 472 * Put frame to file.473 */474 static pj_status_t file_put_frame(pjmedia_port *this_port,475 const pjmedia_frame *frame)476 {477 PJ_UNUSED_ARG(this_port);478 PJ_UNUSED_ARG(frame);479 return PJ_EINVALIDOP;480 }481 482 /*483 469 * Get frame from file. 484 470 */ -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r719 r731 2188 2188 * Echo canceller tail length, in miliseconds. 2189 2189 * 2190 * Default: 128 (PJSUA_DEFAULT_EC_TAIL_LEN)2190 * Default: PJSUA_DEFAULT_EC_TAIL_LEN 2191 2191 */ 2192 2192 unsigned ec_tail_len;
Note: See TracChangeset
for help on using the changeset viewer.