diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-02-04 16:00:13 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-02-04 16:00:13 +0000 |
commit | 97835cac4ce663beacec5c83aabbf07fb2b90d2f (patch) | |
tree | 001d3e65fc0074b079a0a1599c76b394b04a0cfa /pjmedia | |
parent | 6b83082d43aea3c1dcd562b95465e34f1b46c3af (diff) |
Fixed ticket #87: Conference bridge should transmit silence frame when level is zero and there is a transmitter
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@930 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r-- | pjmedia/src/pjmedia/conference.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/pjmedia/src/pjmedia/conference.c b/pjmedia/src/pjmedia/conference.c index 672fe067..cacd3a22 100644 --- a/pjmedia/src/pjmedia/conference.c +++ b/pjmedia/src/pjmedia/conference.c @@ -1323,11 +1323,7 @@ static pj_status_t write_port(pjmedia_conf *conf, struct conf_port *cport, /* If port is muted or nobody is transmitting to this port, * transmit NULL frame. */ - /* note: - * the "cport->src_level==0" checking will cause discontinuous - * transmission for RTP stream. - */ - if (cport->tx_setting == PJMEDIA_PORT_MUTE || cport->src_level==0) { + if (cport->tx_setting == PJMEDIA_PORT_MUTE || cport->transmitter_cnt==0) { pjmedia_frame frame; @@ -1346,6 +1342,34 @@ static pj_status_t write_port(pjmedia_conf *conf, struct conf_port *cport, *frm_type = PJMEDIA_FRAME_TYPE_NONE; return PJ_SUCCESS; + } else if (cport->src_level==0) { + + pjmedia_frame frame; + + /* If silence is transmitted to this port, transmit silence + * PCM frame (otherwise if we transmit NULL frame, nothing will + * be written to WAV port). This would work with stream too + * since stream has it's own silence detector. + */ + pjmedia_zero_samples((pj_int16_t*)cport->mix_buf, + cport->samples_per_frame); + + /* Adjust the timestamp */ + frame.timestamp.u64 = timestamp->u64 * cport->clock_rate / + conf->clock_rate; + frame.type = PJMEDIA_FRAME_TYPE_NONE; + frame.buf = (void*)cport->mix_buf; + frame.size = (cport->samples_per_frame << 1); + + if (cport->port && cport->port->put_frame) { + pjmedia_port_put_frame(cport->port, &frame); + } + + cport->tx_level = 0; + *frm_type = PJMEDIA_FRAME_TYPE_NONE; + return PJ_SUCCESS; + + } else if (cport->tx_setting != PJMEDIA_PORT_ENABLE) { cport->tx_level = 0; *frm_type = PJMEDIA_FRAME_TYPE_NONE; |