aboutsummaryrefslogtreecommitdiffstats
path: root/bridges/bridge_softmix.c
diff options
context:
space:
mode:
authordvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2011-05-05 18:08:42 +0000
committerdvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2011-05-05 18:08:42 +0000
commit2ae706d2e72829db3ed5a81fee647b7f3ff41254 (patch)
treed5f763cd12bc001075a5fcf45262e6eab0a39a53 /bridges/bridge_softmix.c
parentf0e5afee46b523c2abb5e9a00da53b6e49272af2 (diff)
Fixes reliability issues with func_jitterbuffer's usage in the new ConfBridge application.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@317197 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'bridges/bridge_softmix.c')
-rw-r--r--bridges/bridge_softmix.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/bridges/bridge_softmix.c b/bridges/bridge_softmix.c
index eb476932f..4350905fd 100644
--- a/bridges/bridge_softmix.c
+++ b/bridges/bridge_softmix.c
@@ -429,15 +429,20 @@ static enum ast_bridge_write_result softmix_bridge_write(struct ast_bridge *brid
bridge_channel->tech_args.silence_threshold :
DEFAULT_SOFTMIX_SILENCE_THRESHOLD;
char update_talking = -1; /* if this is set to 0 or 1, tell the bridge that the channel has started or stopped talking. */
+ int res = AST_BRIDGE_WRITE_SUCCESS;
/* Only accept audio frames, all others are unsupported */
if (frame->frametype == AST_FRAME_DTMF_END || frame->frametype == AST_FRAME_DTMF_BEGIN) {
softmix_pass_dtmf(bridge, bridge_channel, frame);
- return AST_BRIDGE_WRITE_SUCCESS;
+ goto no_audio;
} else if (frame->frametype != AST_FRAME_VOICE) {
- return AST_BRIDGE_WRITE_UNSUPPORTED;
+ res = AST_BRIDGE_WRITE_UNSUPPORTED;
+ goto no_audio;
+ } else if (frame->datalen == 0) {
+ goto no_audio;
}
+ /* If we made it here, we are going to write the frame into the conference */
ast_mutex_lock(&sc->lock);
ast_dsp_silence(sc->dsp, frame, &totalsilence);
@@ -480,7 +485,20 @@ static enum ast_bridge_write_result softmix_bridge_write(struct ast_bridge *brid
ast_bridge_notify_talking(bridge, bridge_channel, update_talking);
}
- return AST_BRIDGE_WRITE_SUCCESS;
+ return res;
+
+no_audio:
+ /* Even though the frame is not being written into the conference because it is not audio,
+ * we should use this opportunity to check to see if a frame is ready to be written out from
+ * the conference to the channel. */
+ ast_mutex_lock(&sc->lock);
+ if (sc->have_frame) {
+ ast_write(bridge_channel->chan, &sc->write_frame);
+ sc->have_frame = 0;
+ }
+ ast_mutex_unlock(&sc->lock);
+
+ return res;
}
/*! \brief Function called when the channel's thread is poked */