Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
10010d47
提交
10010d47
authored
12月 20, 2012
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip
上级
1ab88581
全部展开
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
572 行增加
和
36 行删除
+572
-36
switch_core_media.h
src/include/switch_core_media.h
+30
-0
mod_sofia.h
src/mod/endpoints/mod_sofia/mod_sofia.h
+1
-0
sofia.c
src/mod/endpoints/mod_sofia/sofia.c
+3
-1
sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_glue.c
+5
-0
sofia_media.c
src/mod/endpoints/mod_sofia/sofia_media.c
+11
-31
switch_core_media.c
src/switch_core_media.c
+522
-4
没有找到文件。
src/include/switch_core_media.h
浏览文件 @
10010d47
...
...
@@ -43,8 +43,31 @@ typedef enum {
SM_NDLB_DISABLE_SRTP_AUTH
=
(
1
<<
3
)
}
switch_core_media_NDLB_t
;
typedef
enum
{
SCMF_DISABLE_TRANSCODING
=
(
1
<<
0
)
}
switch_core_media_flag_t
;
struct
switch_media_handle_s
;
typedef
enum
{
STYPE_INTVAL
,
STYPE_UINTVAL
,
STYPE_CHARVAL
,
}
scm_type_t
;
typedef
enum
{
SCM_INBOUND_CODEC_STRING
,
SCM_OUTBOUND_CODEC_STRING
,
SCM_TEST
,
SCM_MAX
}
scm_param_t
;
#define switch_media_get_param_int(_h, _p) *(int *)switch_media_get_param(_h, _p)
#define switch_media_get_param_uint(_h, _p) *(uint32_t *)switch_media_get_param(_h, _p)
#define switch_media_get_param_char(_h, _p) (char *)switch_media_get_param(_h, _p)
SWITCH_DECLARE
(
switch_status_t
)
switch_media_handle_create
(
switch_media_handle_t
**
smhp
,
switch_core_session_t
*
session
);
SWITCH_DECLARE
(
switch_media_handle_t
*
)
switch_core_session_get_media_handle
(
switch_core_session_t
*
session
);
...
...
@@ -53,6 +76,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_media_handle_ready(switch_co
SWITCH_DECLARE
(
void
)
switch_media_handle_set_ndlb
(
switch_media_handle_t
*
smh
,
switch_core_media_NDLB_t
flag
);
SWITCH_DECLARE
(
void
)
switch_media_handle_clear_ndlb
(
switch_media_handle_t
*
smh
,
switch_core_media_NDLB_t
flag
);
SWITCH_DECLARE
(
int32_t
)
switch_media_handle_test_ndlb
(
switch_media_handle_t
*
smh
,
switch_core_media_NDLB_t
flag
);
SWITCH_DECLARE
(
void
)
switch_media_handle_set_media_flag
(
switch_media_handle_t
*
smh
,
switch_core_media_flag_t
flag
);
SWITCH_DECLARE
(
void
)
switch_media_handle_clear_media_flag
(
switch_media_handle_t
*
smh
,
switch_core_media_flag_t
flag
);
SWITCH_DECLARE
(
int32_t
)
switch_media_handle_test_media_flag
(
switch_media_handle_t
*
smh
,
switch_core_media_flag_t
flag
);
SWITCH_DECLARE
(
void
)
switch_core_session_check_outgoing_crypto
(
switch_core_session_t
*
session
,
const
char
*
sec_var
);
SWITCH_DECLARE
(
const
char
*
)
switch_core_session_local_crypto_key
(
switch_core_session_t
*
session
,
switch_media_type_t
type
);
SWITCH_DECLARE
(
int
)
switch_core_session_check_incoming_crypto
(
switch_core_session_t
*
session
,
...
...
@@ -64,6 +90,10 @@ SWITCH_DECLARE(void) switch_core_session_get_recovery_crypto_key(switch_core_ses
SWITCH_DECLARE
(
void
)
switch_core_media_set_rtp_session
(
switch_core_session_t
*
session
,
switch_media_type_t
type
,
switch_rtp_t
*
rtp_session
);
SWITCH_DECLARE
(
void
)
switch_media_set_param
(
switch_media_handle_t
*
smh
,
scm_param_t
param
,
...);
SWITCH_DECLARE
(
void
*
)
switch_media_get_param
(
switch_media_handle_t
*
smh
,
scm_param_t
param
);
SWITCH_DECLARE
(
const
char
*
)
switch_core_media_get_codec_string
(
switch_core_session_t
*
session
);
SWITCH_END_EXTERN_C
#endif
/* For Emacs:
...
...
src/mod/endpoints/mod_sofia/mod_sofia.h
浏览文件 @
10010d47
...
...
@@ -611,6 +611,7 @@ struct sofia_profile {
uint8_t
pflags
[
PFLAG_MAX
];
unsigned
int
mflags
;
unsigned
int
ndlb
;
unsigned
int
media_flags
;
uint32_t
max_calls
;
uint32_t
nonce_ttl
;
nua_t
*
nua
;
...
...
src/mod/endpoints/mod_sofia/sofia.c
浏览文件 @
10010d47
...
...
@@ -4251,7 +4251,9 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
}
}
else
if
(
!
strcasecmp
(
var
,
"disable-transcoding"
))
{
if
(
switch_true
(
val
))
{
sofia_set_pflag
(
profile
,
PFLAG_DISABLE_TRANSCODING
);
profile
->
media_flags
|=
SCMF_DISABLE_TRANSCODING
;
}
else
{
profile
->
media_flags
&=
~
SCMF_DISABLE_TRANSCODING
;
}
}
else
if
(
!
strcasecmp
(
var
,
"rtp-rewrite-timestamps"
))
{
if
(
switch_true
(
val
))
{
...
...
src/mod/endpoints/mod_sofia/sofia_glue.c
浏览文件 @
10010d47
...
...
@@ -281,6 +281,11 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
switch_media_handle_create
(
&
tech_pvt
->
media_handle
,
session
);
switch_media_handle_set_ndlb
(
tech_pvt
->
media_handle
,
tech_pvt
->
profile
->
ndlb
);
switch_media_handle_set_media_flag
(
tech_pvt
->
media_handle
,
tech_pvt
->
profile
->
media_flags
);
switch_media_set_param
(
tech_pvt
->
media_handle
,
SCM_INBOUND_CODEC_STRING
,
profile
->
inbound_codec_string
);
switch_media_set_param
(
tech_pvt
->
media_handle
,
SCM_OUTBOUND_CODEC_STRING
,
profile
->
inbound_codec_string
);
switch_core_session_set_private
(
session
,
tech_pvt
);
...
...
src/mod/endpoints/mod_sofia/sofia_media.c
浏览文件 @
10010d47
...
...
@@ -848,7 +848,7 @@ uint8_t sofia_media_negotiate_sdp(switch_core_session_t *session, const char *r_
if
(
mimp
)
{
char
tmp
[
50
];
const
char
*
mirror
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"
si
p_mirror_remote_audio_codec_payload"
);
const
char
*
mirror
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"
rt
p_mirror_remote_audio_codec_payload"
);
tech_pvt
->
rm_encoding
=
switch_core_session_strdup
(
session
,
(
char
*
)
map
->
rm_encoding
);
tech_pvt
->
iananame
=
switch_core_session_strdup
(
session
,
(
char
*
)
mimp
->
iananame
);
...
...
@@ -874,7 +874,7 @@ uint8_t sofia_media_negotiate_sdp(switch_core_session_t *session, const char *r_
}
switch_snprintf
(
tmp
,
sizeof
(
tmp
),
"%d"
,
tech_pvt
->
audio_recv_pt
);
switch_channel_set_variable
(
tech_pvt
->
channel
,
"
si
p_audio_recv_pt"
,
tmp
);
switch_channel_set_variable
(
tech_pvt
->
channel
,
"
rt
p_audio_recv_pt"
,
tmp
);
}
...
...
@@ -1768,7 +1768,7 @@ void sofia_media_set_sdp_codec_string(switch_core_session_t *session, const char
if
((
parser
=
sdp_parse
(
NULL
,
r_sdp
,
(
int
)
strlen
(
r_sdp
),
0
)))
{
if
((
sdp
=
sdp_session
(
parser
)))
{
sofia_media_set_r_sdp_codec_string
(
session
,
s
ofia_media_get_codec_string
(
tech_pvt
),
sdp
);
sofia_media_set_r_sdp_codec_string
(
session
,
s
witch_core_media_get_codec_string
(
tech_pvt
->
session
),
sdp
);
}
sdp_parser_free
(
parser
);
...
...
@@ -1903,6 +1903,7 @@ switch_status_t sofia_media_tech_set_codec(private_object_t *tech_pvt, int force
switch_yield
(
tech_pvt
->
read_impl
.
microseconds_per_packet
);
switch_core_codec_destroy
(
&
tech_pvt
->
read_codec
);
switch_core_codec_destroy
(
&
tech_pvt
->
write_codec
);
switch_channel_audio_sync
(
tech_pvt
->
channel
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_DEBUG
,
"Already using %s
\n
"
,
tech_pvt
->
read_impl
.
iananame
);
switch_goto_status
(
SWITCH_STATUS_SUCCESS
,
end
);
...
...
@@ -2996,27 +2997,6 @@ void sofia_media_set_local_sdp(private_object_t *tech_pvt, const char *ip, switc
switch_safe_free
(
buf
);
}
const
char
*
sofia_media_get_codec_string
(
private_object_t
*
tech_pvt
)
{
const
char
*
preferred
=
NULL
,
*
fallback
=
NULL
;
if
(
!
(
preferred
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"absolute_codec_string"
)))
{
preferred
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"codec_string"
);
}
if
(
!
preferred
)
{
if
(
switch_channel_direction
(
tech_pvt
->
channel
)
==
SWITCH_CALL_DIRECTION_OUTBOUND
)
{
preferred
=
tech_pvt
->
profile
->
outbound_codec_string
;
fallback
=
tech_pvt
->
profile
->
inbound_codec_string
;
}
else
{
preferred
=
tech_pvt
->
profile
->
inbound_codec_string
;
fallback
=
tech_pvt
->
profile
->
outbound_codec_string
;
}
}
return
!
zstr
(
preferred
)
?
preferred
:
fallback
;
}
void
sofia_media_tech_prepare_codecs
(
private_object_t
*
tech_pvt
)
{
const
char
*
abs
,
*
codec_string
=
NULL
;
...
...
@@ -3045,7 +3025,7 @@ void sofia_media_tech_prepare_codecs(private_object_t *tech_pvt)
}
if
(
!
(
codec_string
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"codec_string"
)))
{
codec_string
=
s
ofia_media_get_codec_string
(
tech_pvt
);
codec_string
=
s
witch_core_media_get_codec_string
(
tech_pvt
->
session
);
}
if
(
codec_string
&&
*
codec_string
==
'='
)
{
...
...
@@ -3067,12 +3047,11 @@ void sofia_media_tech_prepare_codecs(private_object_t *tech_pvt)
ready:
if
(
codec_string
)
{
char
*
tmp_codec_string
;
if
((
tmp_codec_string
=
switch_core_session_strdup
(
tech_pvt
->
session
,
codec_string
)))
{
char
*
tmp_codec_string
=
switch_core_session_strdup
(
tech_pvt
->
session
,
codec_string
);
tech_pvt
->
codec_order_last
=
switch_separate_string
(
tmp_codec_string
,
','
,
tech_pvt
->
codec_order
,
SWITCH_MAX_CODECS
);
tech_pvt
->
num_codecs
=
switch_loadable_module_get_codecs_sorted
(
tech_pvt
->
codecs
,
SWITCH_MAX_CODECS
,
tech_pvt
->
codec_order
,
tech_pvt
->
codec_order_last
);
}
}
else
{
tech_pvt
->
num_codecs
=
switch_loadable_module_get_codecs
(
tech_pvt
->
codecs
,
sizeof
(
tech_pvt
->
codecs
)
/
sizeof
(
tech_pvt
->
codecs
[
0
]));
}
...
...
@@ -3080,6 +3059,7 @@ void sofia_media_tech_prepare_codecs(private_object_t *tech_pvt)
}
void
sofia_media_check_video_codecs
(
private_object_t
*
tech_pvt
)
{
if
(
tech_pvt
->
num_codecs
&&
!
sofia_test_flag
(
tech_pvt
,
TFLAG_VIDEO
))
{
...
...
src/switch_core_media.c
浏览文件 @
10010d47
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论