[core] add SEND_RTCP_MESSAGE:

toggle send rtcp events off fire_rtcp_events.
eval most common path first when checking flags.
This commit is contained in:
Ryan Mitchell 2021-09-16 20:17:28 -07:00 committed by Dragos Oancea
parent d24280c700
commit 607f5db140
3 changed files with 9 additions and 5 deletions

View File

@ -843,6 +843,7 @@ typedef enum {
SWITCH_RTP_FLAG_PASSTHRU,
SWITCH_RTP_FLAG_SECURE_SEND_MKI,
SWITCH_RTP_FLAG_SECURE_RECV_MKI,
SWITCH_RTP_FLAG_AUDIO_FIRE_SEND_RTCP_EVENT,
SWITCH_RTP_FLAG_VIDEO_FIRE_SEND_RTCP_EVENT,
SWITCH_RTP_FLAG_INVALID
} switch_rtp_flag_t;

View File

@ -8775,6 +8775,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
switch_channel_set_variable(session->channel, "rtp_use_timer_name", timer_name);
if (switch_channel_var_true(session->channel, "fire_rtcp_events")) {
flags[SWITCH_RTP_FLAG_AUDIO_FIRE_SEND_RTCP_EVENT] = 1;
}
a_engine->rtp_session = switch_rtp_new(a_engine->local_sdp_ip,
a_engine->local_sdp_port,
@ -9511,8 +9514,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
flags[SWITCH_RTP_FLAG_TMMBR]++;
}
if (switch_channel_var_true(session->channel, "enable_send_rtcp_message_event_video")) {
flags[SWITCH_RTP_FLAG_VIDEO_FIRE_SEND_RTCP_EVENT] = 1;
if (switch_channel_var_true(session->channel, "fire_rtcp_events") &&
switch_channel_var_true(session->channel, "enable_send_rtcp_message_event_video")) {
flags[SWITCH_RTP_FLAG_VIDEO_FIRE_SEND_RTCP_EVENT] = 1;
}
v_engine->rtp_session = switch_rtp_new(a_engine->local_sdp_ip,

View File

@ -2286,9 +2286,8 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
rtcp_generate_report_block(rtp_session, rtcp_report_block, nack_dup);
rtp_session->rtcp_send_msg.header.count = 1; /* reception report block count */
stats->sent_pkt_count = 0;
/* send event for audio, or video if flag set */
if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO_FIRE_SEND_RTCP_EVENT] ||
!(rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] || rtp_session->flags[SWITCH_RTP_FLAG_TEXT])) {
if ((!rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && rtp_session->flags[SWITCH_RTP_FLAG_AUDIO_FIRE_SEND_RTCP_EVENT]) ||
(rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && rtp_session->flags[SWITCH_RTP_FLAG_VIDEO_FIRE_SEND_RTCP_EVENT])) {
switch_send_rtcp_event(rtp_session, sr, rtcp_report_block);
}
}