提交 4ec5e5af authored 作者: Travis Cross's avatar Travis Cross

Refactor if blocks

Since the first branch doesn't need to do anything, we invert it and
pull a sub-branch out a level into the main conditional.
上级 ae3cf0a1
......@@ -3038,21 +3038,16 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
switch_channel_set_variable(session->channel, "media_audio_mode", NULL);
}
if (switch_media_handle_test_media_flag(smh, SCMF_DISABLE_HOLD) ||
((val = switch_channel_get_variable(session->channel, "rtp_disable_hold")) && switch_true(val))) {
} else {
if (!smh->mparams->hold_laps) {
smh->mparams->hold_laps++;
if (switch_core_media_toggle_hold(session, sendonly)) {
reneg = switch_media_handle_test_media_flag(smh, SCMF_RENEG_ON_HOLD);
if ((val = switch_channel_get_variable(session->channel, "rtp_renegotiate_codec_on_hold"))) {
reneg = switch_true(val);
}
if (!(switch_media_handle_test_media_flag(smh, SCMF_DISABLE_HOLD)
|| ((val = switch_channel_get_variable(session->channel, "rtp_disable_hold"))
&& switch_true(val)))
&& !smh->mparams->hold_laps) {
smh->mparams->hold_laps++;
if (switch_core_media_toggle_hold(session, sendonly)) {
reneg = switch_media_handle_test_media_flag(smh, SCMF_RENEG_ON_HOLD);
if ((val = switch_channel_get_variable(session->channel, "rtp_renegotiate_codec_on_hold"))) {
reneg = switch_true(val);
}
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论