提交 b7eac54b authored 作者: Anthony Minessale's avatar Anthony Minessale

only send srflx when we need one

上级 d77241c4
...@@ -4323,10 +4323,16 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, ...@@ -4323,10 +4323,16 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
ice_out->cands[0].con_addr, ice_out->cands[0].con_port ice_out->cands[0].con_addr, ice_out->cands[0].con_port
); );
switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ srflx generation 0\n", if (!zstr(a_engine->codec_params.local_sdp_ip) && !zstr(ice_out->cands[0].con_addr) &&
strcmp(a_engine->codec_params.local_sdp_ip, ice_out->cands[0].con_addr)
&& a_engine->codec_params.local_sdp_port != ice_out->cands[0].con_port) {
switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ srflx raddr %s rport %d generation 0\n",
tmp2, ice_out->cands[0].transport, c3, tmp2, ice_out->cands[0].transport, c3,
ice_out->cands[0].con_addr, ice_out->cands[0].con_port ice_out->cands[0].con_addr, ice_out->cands[0].con_port,
a_engine->codec_params.local_sdp_ip, a_engine->codec_params.local_sdp_port
); );
}
switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ host generation 0\n", switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ host generation 0\n",
...@@ -4334,11 +4340,16 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, ...@@ -4334,11 +4340,16 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
ice_out->cands[0].con_addr, ice_out->cands[0].con_port + (a_engine->rtcp_mux > 0 ? 0 : 1) ice_out->cands[0].con_addr, ice_out->cands[0].con_port + (a_engine->rtcp_mux > 0 ? 0 : 1)
); );
switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ srflx generation 0\n", if (!zstr(a_engine->codec_params.local_sdp_ip) && !zstr(ice_out->cands[1].con_addr) &&
strcmp(a_engine->codec_params.local_sdp_ip, ice_out->cands[1].con_addr)
&& a_engine->codec_params.local_sdp_port != ice_out->cands[1].con_port) {
switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ srflx raddr %s rport %d generation 0\n",
tmp2, ice_out->cands[0].transport, c4, tmp2, ice_out->cands[0].transport, c4,
ice_out->cands[0].con_addr, ice_out->cands[0].con_port + (a_engine->rtcp_mux > 0 ? 0 : 1) ice_out->cands[0].con_addr, ice_out->cands[0].con_port + (a_engine->rtcp_mux > 0 ? 0 : 1),
a_engine->codec_params.local_sdp_ip, a_engine->codec_params.local_sdp_port + (a_engine->rtcp_mux > 0 ? 0 : 1)
); );
}
...@@ -4771,10 +4782,16 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess ...@@ -4771,10 +4782,16 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
ice_out->cands[0].con_addr, ice_out->cands[0].con_port ice_out->cands[0].con_addr, ice_out->cands[0].con_port
); );
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ srflx generation 0\n", if (!zstr(a_engine->codec_params.local_sdp_ip) && !zstr(ice_out->cands[0].con_addr) &&
strcmp(a_engine->codec_params.local_sdp_ip, ice_out->cands[0].con_addr)
&& a_engine->codec_params.local_sdp_port != ice_out->cands[0].con_port) {
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ srflx raddr %s rport %d generation 0\n",
tmp2, ice_out->cands[0].transport, c3, tmp2, ice_out->cands[0].transport, c3,
ice_out->cands[0].con_addr, ice_out->cands[0].con_port ice_out->cands[0].con_addr, ice_out->cands[0].con_port,
a_engine->codec_params.local_sdp_ip, a_engine->codec_params.local_sdp_port
); );
}
...@@ -4783,11 +4800,18 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess ...@@ -4783,11 +4800,18 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
ice_out->cands[0].con_addr, ice_out->cands[0].con_port + (a_engine->rtcp_mux > 0 ? 0 : 1) ice_out->cands[0].con_addr, ice_out->cands[0].con_port + (a_engine->rtcp_mux > 0 ? 0 : 1)
); );
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ srflx generation 0\n",
if (!zstr(a_engine->codec_params.local_sdp_ip) && !zstr(ice_out->cands[0].con_addr) &&
strcmp(a_engine->codec_params.local_sdp_ip, ice_out->cands[0].con_addr)
&& a_engine->codec_params.local_sdp_port != ice_out->cands[0].con_port) {
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ srflx raddr %s rport %d generation 0\n",
tmp2, ice_out->cands[0].transport, c4, tmp2, ice_out->cands[0].transport, c4,
ice_out->cands[0].con_addr, ice_out->cands[0].con_port + (a_engine->rtcp_mux > 0 ? 0 : 1) ice_out->cands[0].con_addr, ice_out->cands[0].con_port + (a_engine->rtcp_mux > 0 ? 0 : 1),
a_engine->codec_params.local_sdp_ip, a_engine->codec_params.local_sdp_port + (a_engine->rtcp_mux > 0 ? 0 : 1)
); );
}
#ifdef GOOGLE_ICE #ifdef GOOGLE_ICE
...@@ -5050,10 +5074,16 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess ...@@ -5050,10 +5074,16 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
ice_out->cands[0].con_addr, ice_out->cands[0].con_port ice_out->cands[0].con_addr, ice_out->cands[0].con_port
); );
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ srflx generation 0\n", if (!zstr(v_engine->codec_params.local_sdp_ip) && !zstr(ice_out->cands[0].con_addr) &&
strcmp(v_engine->codec_params.local_sdp_ip, ice_out->cands[0].con_addr)
&& v_engine->codec_params.local_sdp_port != ice_out->cands[0].con_port) {
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ srflx raddr %s rport %d generation 0\n",
tmp2, ice_out->cands[0].transport, c3, tmp2, ice_out->cands[0].transport, c3,
ice_out->cands[0].con_addr, ice_out->cands[0].con_port ice_out->cands[0].con_addr, ice_out->cands[0].con_port,
v_engine->codec_params.local_sdp_ip, v_engine->codec_params.local_sdp_port
); );
}
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ host generation 0\n", switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ host generation 0\n",
...@@ -5061,10 +5091,17 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess ...@@ -5061,10 +5091,17 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
ice_out->cands[0].con_addr, ice_out->cands[0].con_port + (v_engine->rtcp_mux > 0 ? 0 : 1) ice_out->cands[0].con_addr, ice_out->cands[0].con_port + (v_engine->rtcp_mux > 0 ? 0 : 1)
); );
if (!zstr(v_engine->codec_params.local_sdp_ip) && !zstr(ice_out->cands[1].con_addr) &&
strcmp(v_engine->codec_params.local_sdp_ip, ice_out->cands[1].con_addr)
&& v_engine->codec_params.local_sdp_port != ice_out->cands[1].con_port) {
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ srflx generation 0\n", switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ srflx generation 0\n",
tmp2, ice_out->cands[0].transport, c4, tmp2, ice_out->cands[0].transport, c4,
ice_out->cands[0].con_addr, ice_out->cands[0].con_port + (v_engine->rtcp_mux > 0 ? 0 : 1) ice_out->cands[0].con_addr, ice_out->cands[0].con_port + (v_engine->rtcp_mux > 0 ? 0 : 1),
v_engine->codec_params.local_sdp_ip, v_engine->codec_params.local_sdp_port + (v_engine->rtcp_mux > 0 ? 0 : 1)
); );
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论