Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
157a0b8a
提交
157a0b8a
authored
2月 26, 2013
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix seg in multiple m line
上级
68055eab
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
19 行增加
和
14 行删除
+19
-14
switch_core_media.c
src/switch_core_media.c
+19
-14
没有找到文件。
src/switch_core_media.c
浏览文件 @
157a0b8a
...
@@ -1614,7 +1614,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_
...
@@ -1614,7 +1614,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_
a_engine
=
&
smh
->
engines
[
SWITCH_MEDIA_TYPE_AUDIO
];
a_engine
=
&
smh
->
engines
[
SWITCH_MEDIA_TYPE_AUDIO
];
if
(
!
a_engine
->
codec_params
.
iananame
)
{
if
(
!
a_engine
->
codec_params
.
iananame
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_
ERROR
,
"No audio codec available
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_
DEBUG
,
"No audio codec available
\n
"
);
switch_goto_status
(
SWITCH_STATUS_FALSE
,
end
);
switch_goto_status
(
SWITCH_STATUS_FALSE
,
end
);
}
}
...
@@ -2094,6 +2094,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
...
@@ -2094,6 +2094,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
switch_media_handle_t
*
smh
;
switch_media_handle_t
*
smh
;
uint32_t
near_rate
=
0
;
uint32_t
near_rate
=
0
;
const
switch_codec_implementation_t
*
mimp
=
NULL
,
*
near_match
=
NULL
;
const
switch_codec_implementation_t
*
mimp
=
NULL
,
*
near_match
=
NULL
;
sdp_rtpmap_t
*
mmap
=
NULL
;
int
codec_ms
=
0
;
int
codec_ms
=
0
;
const
char
*
tmp
;
const
char
*
tmp
;
...
@@ -2614,11 +2615,13 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
...
@@ -2614,11 +2615,13 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
if
((
ptime
&&
codec_ms
&&
codec_ms
*
1000
!=
imp
->
microseconds_per_packet
)
||
map
->
rm_rate
!=
codec_rate
)
{
if
((
ptime
&&
codec_ms
&&
codec_ms
*
1000
!=
imp
->
microseconds_per_packet
)
||
map
->
rm_rate
!=
codec_rate
)
{
near_rate
=
map
->
rm_rate
;
near_rate
=
map
->
rm_rate
;
near_match
=
imp
;
near_match
=
imp
;
mmap
=
map
;
match
=
0
;
match
=
0
;
continue
;
continue
;
}
}
}
}
mimp
=
imp
;
mimp
=
imp
;
mmap
=
map
;
break
;
break
;
}
}
}
}
...
@@ -2648,36 +2651,39 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
...
@@ -2648,36 +2651,39 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
if
(
num
)
{
if
(
num
)
{
mimp
=
search
[
0
];
mimp
=
search
[
0
];
mmap
=
map
;
}
else
{
}
else
{
mimp
=
near_match
;
mimp
=
near_match
;
mmap
=
map
;
}
}
if
(
!
maxptime
||
mimp
->
microseconds_per_packet
/
1000
<=
maxptime
)
{
if
(
!
maxptime
||
mimp
->
microseconds_per_packet
/
1000
<=
maxptime
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Substituting codec %s@%ui@%uh
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Substituting codec %s@%ui@%uh
\n
"
,
mimp
->
iananame
,
mimp
->
microseconds_per_packet
/
1000
,
mimp
->
samples_per_second
);
mimp
->
iananame
,
mimp
->
microseconds_per_packet
/
1000
,
mimp
->
samples_per_second
);
mmap
=
map
;
match
=
1
;
match
=
1
;
}
else
{
}
else
{
mimp
=
NULL
;
mimp
=
NULL
;
mmap
=
NULL
;
match
=
0
;
match
=
0
;
}
}
}
}
if
(
mimp
)
{
if
(
mimp
&&
mmap
)
{
char
tmp
[
50
];
char
tmp
[
50
];
const
char
*
mirror
=
switch_channel_get_variable
(
session
->
channel
,
"rtp_mirror_remote_audio_codec_payload"
);
const
char
*
mirror
=
switch_channel_get_variable
(
session
->
channel
,
"rtp_mirror_remote_audio_codec_payload"
);
a_engine
->
codec_params
.
rm_encoding
=
switch_core_session_strdup
(
session
,
(
char
*
)
map
->
rm_encoding
);
a_engine
->
codec_params
.
rm_encoding
=
switch_core_session_strdup
(
session
,
(
char
*
)
m
m
ap
->
rm_encoding
);
a_engine
->
codec_params
.
iananame
=
switch_core_session_strdup
(
session
,
(
char
*
)
mimp
->
iananame
);
a_engine
->
codec_params
.
iananame
=
switch_core_session_strdup
(
session
,
(
char
*
)
mimp
->
iananame
);
a_engine
->
codec_params
.
pt
=
(
switch_payload_t
)
map
->
rm_pt
;
a_engine
->
codec_params
.
pt
=
(
switch_payload_t
)
m
m
ap
->
rm_pt
;
a_engine
->
codec_params
.
rm_rate
=
mimp
->
samples_per_second
;
a_engine
->
codec_params
.
rm_rate
=
mimp
->
samples_per_second
;
a_engine
->
codec_params
.
codec_ms
=
mimp
->
microseconds_per_packet
/
1000
;
a_engine
->
codec_params
.
codec_ms
=
mimp
->
microseconds_per_packet
/
1000
;
a_engine
->
codec_params
.
bitrate
=
mimp
->
bits_per_second
;
a_engine
->
codec_params
.
bitrate
=
mimp
->
bits_per_second
;
a_engine
->
codec_params
.
channels
=
m
ap
->
rm_params
?
atoi
(
map
->
rm_params
)
:
1
;
a_engine
->
codec_params
.
channels
=
m
map
->
rm_params
?
atoi
(
m
map
->
rm_params
)
:
1
;
if
(
!
strcasecmp
((
char
*
)
map
->
rm_encoding
,
"opus"
))
{
if
(
!
strcasecmp
((
char
*
)
m
m
ap
->
rm_encoding
,
"opus"
))
{
a_engine
->
codec_params
.
adv_channels
=
2
;
/* IKR ???*/
a_engine
->
codec_params
.
adv_channels
=
2
;
/* IKR ???*/
if
(
!
zstr
((
char
*
)
m
ap
->
rm_fmtp
)
&&
switch_stristr
(
"stereo=1"
,
(
char
*
)
map
->
rm_fmtp
))
{
if
(
!
zstr
((
char
*
)
m
map
->
rm_fmtp
)
&&
switch_stristr
(
"stereo=1"
,
(
char
*
)
m
map
->
rm_fmtp
))
{
a_engine
->
codec_params
.
channels
=
2
;
a_engine
->
codec_params
.
channels
=
2
;
}
else
{
}
else
{
a_engine
->
codec_params
.
channels
=
1
;
a_engine
->
codec_params
.
channels
=
1
;
...
@@ -2688,15 +2694,15 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
...
@@ -2688,15 +2694,15 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
a_engine
->
codec_params
.
remote_sdp_ip
=
switch_core_session_strdup
(
session
,
(
char
*
)
connection
->
c_address
);
a_engine
->
codec_params
.
remote_sdp_ip
=
switch_core_session_strdup
(
session
,
(
char
*
)
connection
->
c_address
);
a_engine
->
codec_params
.
remote_sdp_port
=
(
switch_port_t
)
m
->
m_port
;
a_engine
->
codec_params
.
remote_sdp_port
=
(
switch_port_t
)
m
->
m_port
;
a_engine
->
codec_params
.
rm_fmtp
=
switch_core_session_strdup
(
session
,
(
char
*
)
map
->
rm_fmtp
);
a_engine
->
codec_params
.
rm_fmtp
=
switch_core_session_strdup
(
session
,
(
char
*
)
m
m
ap
->
rm_fmtp
);
a_engine
->
codec_params
.
agreed_pt
=
(
switch_payload_t
)
map
->
rm_pt
;
a_engine
->
codec_params
.
agreed_pt
=
(
switch_payload_t
)
m
m
ap
->
rm_pt
;
smh
->
num_negotiated_codecs
=
0
;
smh
->
num_negotiated_codecs
=
0
;
smh
->
negotiated_codecs
[
smh
->
num_negotiated_codecs
++
]
=
mimp
;
smh
->
negotiated_codecs
[
smh
->
num_negotiated_codecs
++
]
=
mimp
;
switch_snprintf
(
tmp
,
sizeof
(
tmp
),
"%d"
,
a_engine
->
codec_params
.
remote_sdp_port
);
switch_snprintf
(
tmp
,
sizeof
(
tmp
),
"%d"
,
a_engine
->
codec_params
.
remote_sdp_port
);
switch_channel_set_variable
(
session
->
channel
,
SWITCH_REMOTE_MEDIA_IP_VARIABLE
,
a_engine
->
codec_params
.
remote_sdp_ip
);
switch_channel_set_variable
(
session
->
channel
,
SWITCH_REMOTE_MEDIA_IP_VARIABLE
,
a_engine
->
codec_params
.
remote_sdp_ip
);
switch_channel_set_variable
(
session
->
channel
,
SWITCH_REMOTE_MEDIA_PORT_VARIABLE
,
tmp
);
switch_channel_set_variable
(
session
->
channel
,
SWITCH_REMOTE_MEDIA_PORT_VARIABLE
,
tmp
);
a_engine
->
codec_params
.
recv_pt
=
(
switch_payload_t
)
map
->
rm_pt
;
a_engine
->
codec_params
.
recv_pt
=
(
switch_payload_t
)
m
m
ap
->
rm_pt
;
if
(
!
switch_true
(
mirror
)
&&
if
(
!
switch_true
(
mirror
)
&&
switch_channel_direction
(
channel
)
==
SWITCH_CALL_DIRECTION_OUTBOUND
&&
switch_channel_direction
(
channel
)
==
SWITCH_CALL_DIRECTION_OUTBOUND
&&
...
@@ -2718,9 +2724,8 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
...
@@ -2718,9 +2724,8 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
}
}
}
}
if
(
!
best_te
&&
(
switch_media_handle_test_media_flag
(
smh
,
SCMF_LIBERAL_DTMF
)
||
switch_channel_test_flag
(
session
->
channel
,
CF_LIBERAL_DTMF
)))
{
if
(
!
best_te
&&
(
switch_media_handle_test_media_flag
(
smh
,
SCMF_LIBERAL_DTMF
)
||
switch_channel_test_flag
(
session
->
channel
,
CF_LIBERAL_DTMF
)))
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"No 2833 in SDP. Liberal DTMF mode adding %d as telephone-event.
\n
"
,
smh
->
mparams
->
te
);
"No 2833 in SDP. Liberal DTMF mode adding %d as telephone-event.
\n
"
,
smh
->
mparams
->
te
);
best_te
=
smh
->
mparams
->
te
;
best_te
=
smh
->
mparams
->
te
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论