Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
f5e2a2e0
提交
f5e2a2e0
authored
1月 08, 2013
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix cng
上级
241300fb
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
24 行增加
和
23 行删除
+24
-23
switch_core_media.h
src/include/switch_core_media.h
+1
-0
sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_glue.c
+1
-1
switch_core_media.c
src/switch_core_media.c
+19
-19
switch_rtp.c
src/switch_rtp.c
+3
-3
没有找到文件。
src/include/switch_core_media.h
浏览文件 @
f5e2a2e0
...
...
@@ -142,6 +142,7 @@ typedef struct switch_core_media_params_s {
int
num_codecs
;
int
hold_laps
;
switch_core_media_dtmf_t
dtmf_type
;
switch_payload_t
cng_pt
;
}
switch_core_media_params_t
;
...
...
src/mod/endpoints/mod_sofia/sofia_glue.c
浏览文件 @
f5e2a2e0
...
...
@@ -161,7 +161,7 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
tech_pvt
->
mparams
.
rtcp_audio_interval_msec
=
profile
->
rtcp_audio_interval_msec
;
tech_pvt
->
mparams
.
rtcp_video_interval_msec
=
profile
->
rtcp_video_interval_msec
;
tech_pvt
->
mparams
.
sdp_username
=
profile
->
sdp_username
;
tech_pvt
->
mparams
.
cng_pt
=
tech_pvt
->
cng_pt
;
switch_media_handle_create
(
&
tech_pvt
->
media_handle
,
session
,
&
tech_pvt
->
mparams
);
switch_media_handle_set_media_flags
(
tech_pvt
->
media_handle
,
tech_pvt
->
profile
->
media_flags
);
...
...
src/switch_core_media.c
浏览文件 @
f5e2a2e0
...
...
@@ -140,7 +140,7 @@ struct switch_media_handle_s {
int
payload_space
;
char
*
origin
;
switch_payload_t
cng_pt
;
const
switch_codec_implementation_t
*
negotiated_codecs
[
SWITCH_MAX_CODECS
];
int
num_negotiated_codecs
;
...
...
@@ -2119,7 +2119,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
cng_pt
=
(
switch_payload_t
)
map
->
rm_pt
;
if
(
a_engine
->
rtp_session
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Set comfort noise payload to %u
\n
"
,
cng_pt
);
switch_rtp_set_cng_pt
(
a_engine
->
rtp_session
,
smh
->
cng_pt
);
switch_rtp_set_cng_pt
(
a_engine
->
rtp_session
,
smh
->
mparams
->
cng_pt
);
}
}
...
...
@@ -2461,7 +2461,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
sdp_parser_free
(
parser
);
}
smh
->
cng_pt
=
cng_pt
;
smh
->
mparams
->
cng_pt
=
cng_pt
;
return
match
;
}
...
...
@@ -3082,8 +3082,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
}
if
(
switch_media_handle_test_media_flag
(
smh
,
SCMF_SUPPRESS_CNG
))
{
smh
->
cng_pt
=
0
;
}
else
if
(
smh
->
cng_pt
)
{
smh
->
mparams
->
cng_pt
=
0
;
}
else
if
(
smh
->
mparams
->
cng_pt
)
{
flags
[
SWITCH_RTP_FLAG_AUTO_CNG
]
++
;
}
...
...
@@ -3423,7 +3423,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
if
(
switch_media_handle_test_media_flag
(
smh
,
SCMF_SUPPRESS_CNG
)
||
((
val
=
switch_channel_get_variable
(
session
->
channel
,
"supress_cng"
))
&&
switch_true
(
val
))
||
((
val
=
switch_channel_get_variable
(
session
->
channel
,
"suppress_cng"
))
&&
switch_true
(
val
)))
{
smh
->
cng_pt
=
0
;
smh
->
mparams
->
cng_pt
=
0
;
}
if
(((
val
=
switch_channel_get_variable
(
session
->
channel
,
"rtp_digit_delay"
))))
{
...
...
@@ -3440,9 +3440,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
}
if
(
smh
->
cng_pt
&&
!
switch_media_handle_test_media_flag
(
smh
,
SCMF_SUPPRESS_CNG
))
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Set comfort noise payload to %u
\n
"
,
smh
->
cng_pt
);
switch_rtp_set_cng_pt
(
a_engine
->
rtp_session
,
smh
->
cng_pt
);
if
(
smh
->
mparams
->
cng_pt
&&
!
switch_media_handle_test_media_flag
(
smh
,
SCMF_SUPPRESS_CNG
))
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Set comfort noise payload to %u
\n
"
,
smh
->
mparams
->
cng_pt
);
switch_rtp_set_cng_pt
(
a_engine
->
rtp_session
,
smh
->
mparams
->
cng_pt
);
}
switch_core_session_apply_crypto
(
session
,
SWITCH_MEDIA_TYPE_AUDIO
,
"rtp_secure_media_confirmed"
);
...
...
@@ -4018,7 +4018,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
((
val
=
switch_channel_get_variable
(
session
->
channel
,
"supress_cng"
))
&&
switch_true
(
val
))
||
((
val
=
switch_channel_get_variable
(
session
->
channel
,
"suppress_cng"
))
&&
switch_true
(
val
)))
{
use_cng
=
0
;
smh
->
cng_pt
=
0
;
smh
->
mparams
->
cng_pt
=
0
;
}
if
(
!
smh
->
payload_space
)
{
...
...
@@ -4036,7 +4036,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
smh
->
payload_space
++
;
}
if
(
!
switch_media_handle_test_media_flag
(
smh
,
SCMF_SUPPRESS_CNG
)
&&
smh
->
cng_pt
&&
use_cng
&&
smh
->
cng_pt
==
smh
->
payload_space
)
{
smh
->
mparams
->
cng_pt
&&
use_cng
&&
smh
->
mparams
->
cng_pt
==
smh
->
payload_space
)
{
smh
->
payload_space
++
;
}
smh
->
ianacodes
[
i
]
=
smh
->
payload_space
++
;
...
...
@@ -4136,8 +4136,8 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
" %d"
,
smh
->
mparams
->
te
);
}
if
(
!
switch_media_handle_test_media_flag
(
smh
,
SCMF_SUPPRESS_CNG
)
&&
smh
->
cng_pt
&&
use_cng
)
{
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
" %d"
,
smh
->
cng_pt
);
if
(
!
switch_media_handle_test_media_flag
(
smh
,
SCMF_SUPPRESS_CNG
)
&&
smh
->
mparams
->
cng_pt
&&
use_cng
)
{
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
" %d"
,
smh
->
mparams
->
cng_pt
);
}
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"
\n
"
);
...
...
@@ -4158,10 +4158,10 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
&&
smh
->
mparams
->
te
>
95
)
{
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=rtpmap:%d telephone-event/8000
\n
a=fmtp:%d 0-16
\n
"
,
smh
->
mparams
->
te
,
smh
->
mparams
->
te
);
}
if
(
!
switch_media_handle_test_media_flag
(
smh
,
SCMF_SUPPRESS_CNG
)
&&
smh
->
cng_pt
&&
use_cng
)
{
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=rtpmap:%d CN/8000
\n
"
,
smh
->
cng_pt
);
if
(
!
switch_media_handle_test_media_flag
(
smh
,
SCMF_SUPPRESS_CNG
)
&&
smh
->
mparams
->
cng_pt
&&
use_cng
)
{
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=rtpmap:%d CN/8000
\n
"
,
smh
->
mparams
->
cng_pt
);
if
(
!
a_engine
->
codec_params
.
rm_encoding
)
{
smh
->
cng_pt
=
0
;
smh
->
mparams
->
cng_pt
=
0
;
}
}
else
{
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=silenceSupp:off - - - -
\n
"
);
...
...
@@ -4197,11 +4197,11 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
int
cur_ptime
=
0
,
this_ptime
=
0
,
cng_type
=
0
;
const
char
*
mult
;
if
(
!
switch_media_handle_test_media_flag
(
smh
,
SCMF_SUPPRESS_CNG
)
&&
smh
->
cng_pt
&&
use_cng
)
{
cng_type
=
smh
->
cng_pt
;
if
(
!
switch_media_handle_test_media_flag
(
smh
,
SCMF_SUPPRESS_CNG
)
&&
smh
->
mparams
->
cng_pt
&&
use_cng
)
{
cng_type
=
smh
->
mparams
->
cng_pt
;
if
(
!
a_engine
->
codec_params
.
rm_encoding
)
{
smh
->
cng_pt
=
0
;
smh
->
mparams
->
cng_pt
=
0
;
}
}
...
...
src/switch_rtp.c
浏览文件 @
f5e2a2e0
...
...
@@ -992,7 +992,7 @@ static uint8_t get_next_write_ts(switch_rtp_t *rtp_session, uint32_t timestamp)
if
(
rtp_session
->
ts
<=
rtp_session
->
last_write_ts
&&
!
(
rtp_session
->
rtp_bugs
&
RTP_BUG_NEVER_SEND_MARKER
))
{
m
++
;
}
}
else
if
(
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_USE_TIMER
))
{
}
else
if
(
switch_
rtp_
test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_USE_TIMER
))
{
rtp_session
->
ts
=
rtp_session
->
timer
.
samplecount
;
if
(
rtp_session
->
ts
<=
rtp_session
->
last_write_ts
&&
rtp_session
->
ts
>
0
)
{
...
...
@@ -1025,7 +1025,7 @@ static int check_srtp_and_ice(switch_rtp_t *rtp_session)
switch_rtp_write_manual
(
rtp_session
,
(
void
*
)
data
,
2
,
0
,
rtp_session
->
cng_pt
,
ntohl
(
rtp_session
->
send_msg
.
header
.
ts
),
&
frame_flags
);
if
(
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_USE_TIMER
))
{
if
(
switch_
rtp_
test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_USE_TIMER
))
{
rtp_session
->
last_write_samplecount
=
rtp_session
->
timer
.
samplecount
;
}
}
...
...
@@ -4276,7 +4276,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
}
/* If the marker was set, and the timestamp seems to have started over - set a new SSRC, to indicate this is a new stream */
if
(
m
&&
!
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_SECURE_SEND
)
&&
(
rtp_session
->
rtp_bugs
&
RTP_BUG_CHANGE_SSRC_ON_MARKER
)
&&
if
(
m
&&
!
switch_
rtp_
test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_SECURE_SEND
)
&&
(
rtp_session
->
rtp_bugs
&
RTP_BUG_CHANGE_SSRC_ON_MARKER
)
&&
(
rtp_session
->
last_write_ts
==
RTP_TS_RESET
||
(
rtp_session
->
ts
<=
rtp_session
->
last_write_ts
&&
rtp_session
->
last_write_ts
>
0
)))
{
switch_rtp_set_ssrc
(
rtp_session
,
(
uint32_t
)
((
intptr_t
)
rtp_session
+
(
uint32_t
)
switch_epoch_time_now
(
NULL
)));
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论