Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
12e70149
提交
12e70149
authored
1月 17, 2013
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rtcp-mux
上级
36d1388a
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
239 行增加
和
116 行删除
+239
-116
switch_rtp.h
src/include/switch_rtp.h
+1
-1
switch_types.h
src/include/switch_types.h
+5
-4
switch_core_media.c
src/switch_core_media.c
+63
-29
switch_rtp.c
src/switch_rtp.c
+170
-82
没有找到文件。
src/include/switch_rtp.h
浏览文件 @
12e70149
...
...
@@ -230,7 +230,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp_ice(switch_rtp_t *rtp_s
\param send_rate interval in milliseconds to send at
\return SWITCH_STATUS_SUCCESS
*/
SWITCH_DECLARE
(
switch_status_t
)
switch_rtp_activate_rtcp
(
switch_rtp_t
*
rtp_session
,
int
send_rate
,
switch_port_t
remote_port
);
SWITCH_DECLARE
(
switch_status_t
)
switch_rtp_activate_rtcp
(
switch_rtp_t
*
rtp_session
,
int
send_rate
,
switch_port_t
remote_port
,
switch_bool_t
mux
);
/*!
\brief Acvite a jitter buffer on an RTP session
...
...
src/include/switch_types.h
浏览文件 @
12e70149
...
...
@@ -641,10 +641,10 @@ typedef enum {
SWITCH_RTP_FLAG_DEBUG_RTP_WRITE
,
SWITCH_RTP_FLAG_VIDEO
,
SWITCH_RTP_FLAG_ENABLE_RTCP
,
/* don't add any below this one */
SWITCH_RTP_FLAG_RTCP_MUX
,
SWITCH_RTP_FLAG_INVALID
}
switch_rtp_flag_
enum_
t
;
typedef
uint32_t
switch_rtp_flag_t
;
}
switch_rtp_flag_t
;
typedef
enum
{
RTP_BUG_NONE
=
0
,
/* won't be using this one much ;) */
...
...
@@ -1336,7 +1336,8 @@ typedef enum {
SFF_DYNAMIC
=
(
1
<<
6
),
SFF_ZRTP
=
(
1
<<
7
),
SFF_UDPTL_PACKET
=
(
1
<<
8
),
SFF_NOT_AUDIO
=
(
1
<<
9
)
SFF_NOT_AUDIO
=
(
1
<<
9
),
SFF_RTCP
=
(
1
<<
10
)
}
switch_frame_flag_enum_t
;
typedef
uint32_t
switch_frame_flag_t
;
...
...
src/switch_core_media.c
浏览文件 @
12e70149
...
...
@@ -29,7 +29,7 @@
*
*/
#define RTCP_MUX
#include <switch.h>
#include <switch_ssl.h>
#include <switch_stun.h>
...
...
@@ -118,8 +118,6 @@ typedef struct ice_s {
char
*
pwd
;
char
*
options
;
}
ice_t
;
typedef
struct
switch_rtp_engine_s
{
...
...
@@ -160,6 +158,8 @@ typedef struct switch_rtp_engine_s {
ice_t
ice_in
;
ice_t
ice_out
;
int8_t
rtcp_mux
;
}
switch_rtp_engine_t
;
...
...
@@ -1799,7 +1799,7 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_
{
switch_rtp_engine_t
*
engine
=
&
smh
->
engines
[
type
];
sdp_attribute_t
*
attr
;
int
i
=
0
;
int
i
=
0
,
got_rtcp_mux
=
0
;
char
tmp
[
80
]
=
""
;
for
(
attr
=
m
->
m_attributes
;
attr
;
attr
=
attr
->
a_next
)
{
...
...
@@ -1818,11 +1818,17 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_
engine
->
ice_in
.
pwd
=
switch_core_session_strdup
(
smh
->
session
,
attr
->
a_value
);
}
else
if
(
!
strcasecmp
(
attr
->
a_name
,
"ice-options"
))
{
engine
->
ice_in
.
options
=
switch_core_session_strdup
(
smh
->
session
,
attr
->
a_value
);
#ifdef RTCP_MUX
}
else
if
(
!
strcasecmp
(
attr
->
a_name
,
"rtcp-mux"
))
{
engine
->
rtcp_mux
=
SWITCH_TRUE
;
got_rtcp_mux
++
;
#endif
}
else
if
(
!
strcasecmp
(
attr
->
a_name
,
"candidate"
))
{
if
(
!
engine
->
cand_acl_count
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
smh
->
session
),
SWITCH_LOG_WARNING
,
"NO candidate ACL defined, skipping candidate check.
\n
"
);
return
;
goto
end
;
}
...
...
@@ -1921,6 +1927,13 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_
engine
->
remote_rtcp_port
=
engine
->
ice_in
.
cands
[
1
].
con_port
;
}
end
:
if
(
!
got_rtcp_mux
)
{
engine
->
rtcp_mux
=
-
1
;
}
}
//?
...
...
@@ -2117,8 +2130,8 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
got_webrtc
++
;
switch_channel_set_flag
(
session
->
channel
,
CF_WEBRTC
);
switch_channel_set_flag
(
session
->
channel
,
CF_ICE
);
smh
->
mparams
->
rtcp_audio_interval_msec
=
"
25
00"
;
smh
->
mparams
->
rtcp_video_interval_msec
=
"
25
00"
;
smh
->
mparams
->
rtcp_audio_interval_msec
=
"
50
00"
;
smh
->
mparams
->
rtcp_video_interval_msec
=
"
50
00"
;
}
if
(
m
->
m_proto
==
sdp_proto_srtp
||
m
->
m_proto
==
sdp_proto_extended_srtp
)
{
...
...
@@ -3256,6 +3269,12 @@ static void gen_ice(switch_core_session_t *session, switch_media_type_t type, co
engine
=
&
smh
->
engines
[
type
];
#ifdef RTCP_MUX
if
(
!
engine
->
rtcp_mux
&&
type
==
SWITCH_MEDIA_TYPE_AUDIO
)
{
engine
->
rtcp_mux
=
SWITCH_TRUE
;
}
#endif
if
(
!
smh
->
msid
)
{
switch_stun_random_string
(
tmp
,
32
,
NULL
);
tmp
[
32
]
=
'\0'
;
...
...
@@ -3655,7 +3674,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
if
(
!
strcasecmp
(
val
,
"passthru"
))
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_INFO
,
"Activating RTCP PASSTHRU PORT %d
\n
"
,
remote_rtcp_port
);
switch_rtp_activate_rtcp
(
a_engine
->
rtp_session
,
-
1
,
remote_rtcp_port
);
switch_rtp_activate_rtcp
(
a_engine
->
rtp_session
,
-
1
,
remote_rtcp_port
,
a_engine
->
rtcp_mux
>
0
);
}
else
{
int
interval
=
atoi
(
val
);
if
(
interval
<
100
||
interval
>
5000
)
{
...
...
@@ -3663,7 +3682,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
"Invalid rtcp interval spec [%d] must be between 100 and 5000
\n
"
,
interval
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_INFO
,
"Activating RTCP PORT %d
\n
"
,
remote_rtcp_port
);
switch_rtp_activate_rtcp
(
a_engine
->
rtp_session
,
interval
,
remote_rtcp_port
);
switch_rtp_activate_rtcp
(
a_engine
->
rtp_session
,
interval
,
remote_rtcp_port
,
a_engine
->
rtcp_mux
>
0
);
}
}
...
...
@@ -4029,7 +4048,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
}
if
(
!
strcasecmp
(
val
,
"passthru"
))
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_INFO
,
"Activating VIDEO RTCP PASSTHRU PORT %d
\n
"
,
remote_port
);
switch_rtp_activate_rtcp
(
v_engine
->
rtp_session
,
-
1
,
remote_port
);
switch_rtp_activate_rtcp
(
v_engine
->
rtp_session
,
-
1
,
remote_port
,
v_engine
->
rtcp_mux
>
0
);
}
else
{
int
interval
=
atoi
(
val
);
if
(
interval
<
100
||
interval
>
5000
)
{
...
...
@@ -4037,7 +4056,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
"Invalid rtcp interval spec [%d] must be between 100 and 5000
\n
"
,
interval
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_INFO
,
"Activating VIDEO RTCP PORT %d
\n
"
,
remote_port
);
switch_rtp_activate_rtcp
(
v_engine
->
rtp_session
,
interval
,
remote_port
);
switch_rtp_activate_rtcp
(
v_engine
->
rtp_session
,
interval
,
remote_port
,
v_engine
->
rtcp_mux
>
0
);
}
}
...
...
@@ -4258,7 +4277,11 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
}
if
(
smh
->
mparams
->
rtcp_audio_interval_msec
)
{
switch_snprintf
(
buf
+
strlen
(
buf
),
buflen
-
strlen
(
buf
),
"a=rtcp:%d IN %s %s
\n
"
,
port
+
1
,
family
,
ip
);
if
(
a_engine
->
rtcp_mux
>
0
)
{
switch_snprintf
(
buf
+
strlen
(
buf
),
buflen
-
strlen
(
buf
),
"a=rtcp-mux
\n
"
);
}
else
{
switch_snprintf
(
buf
+
strlen
(
buf
),
buflen
-
strlen
(
buf
),
"a=rtcp:%d IN %s %s
\n
"
,
port
+
1
,
family
,
ip
);
}
}
//switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u\n", a_engine->ssrc);
...
...
@@ -4302,13 +4325,14 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
switch_snprintf
(
buf
+
strlen
(
buf
),
buflen
-
strlen
(
buf
),
"a=candidate:%s 2 %s %u %s %d typ host generation 0
\n
"
,
tmp1
,
ice_out
->
cands
[
0
].
transport
,
c2
,
ice_out
->
cands
[
0
].
con_addr
,
ice_out
->
cands
[
0
].
con_port
+
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
"
,
tmp2
,
ice_out
->
cands
[
0
].
transport
,
c4
,
ice_out
->
cands
[
0
].
con_addr
,
ice_out
->
cands
[
0
].
con_port
+
1
ice_out
->
cands
[
0
].
con_addr
,
ice_out
->
cands
[
0
].
con_port
+
(
a_engine
->
rtcp_mux
>
0
?
0
:
1
)
);
...
...
@@ -4703,7 +4727,11 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
if
(
smh
->
mparams
->
rtcp_audio_interval_msec
)
{
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=rtcp:%d IN %s %s
\n
"
,
port
+
1
,
family
,
ip
);
if
(
a_engine
->
rtcp_mux
>
0
)
{
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=rtcp-mux
\n
"
);
}
else
{
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=rtcp:%d IN %s %s
\n
"
,
port
+
1
,
family
,
ip
);
}
}
//switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u\n", a_engine->ssrc);
...
...
@@ -4743,16 +4771,17 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
);
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=candidate:%s 2 %s %u %s %d typ host generation 0
\n
"
,
tmp1
,
ice_out
->
cands
[
0
].
transport
,
c2
,
ice_out
->
cands
[
0
].
con_addr
,
ice_out
->
cands
[
0
].
con_port
+
1
);
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
,
ice_out
->
cands
[
0
].
con_addr
,
ice_out
->
cands
[
0
].
con_port
+
1
);
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=candidate:%s 2 %s %u %s %d typ host generation 0
\n
"
,
tmp1
,
ice_out
->
cands
[
0
].
transport
,
c2
,
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
"
,
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
)
);
#ifdef GOOGLE_ICE
...
...
@@ -4978,7 +5007,11 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
if
(
smh
->
mparams
->
rtcp_audio_interval_msec
)
{
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=rtcp:%d IN %s %s
\n
"
,
v_port
+
1
,
family
,
ip
);
if
(
v_engine
->
rtcp_mux
>
0
)
{
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=rtcp-mux
\n
"
);
}
else
{
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=rtcp:%d IN %s %s
\n
"
,
v_port
+
1
,
family
,
ip
);
}
}
//switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u\n", v_engine->ssrc);
...
...
@@ -5019,13 +5052,14 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=candidate:%s 2 %s %u %s %d typ host generation 0
\n
"
,
tmp1
,
ice_out
->
cands
[
0
].
transport
,
c2
,
ice_out
->
cands
[
0
].
con_addr
,
ice_out
->
cands
[
0
].
con_port
+
1
ice_out
->
cands
[
0
].
con_addr
,
ice_out
->
cands
[
0
].
con_port
+
(
v_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
"
,
tmp2
,
ice_out
->
cands
[
0
].
transport
,
c4
,
ice_out
->
cands
[
0
].
con_addr
,
ice_out
->
cands
[
0
].
con_port
+
1
ice_out
->
cands
[
0
].
con_addr
,
ice_out
->
cands
[
0
].
con_port
+
(
v_engine
->
rtcp_mux
>
0
?
0
:
1
)
);
...
...
src/switch_rtp.c
浏览文件 @
12e70149
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论