Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
826d4287
提交
826d4287
authored
11月 13, 2014
作者:
Julien Chavanton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-6992 [mod_opus] global configuration or maxplaybackrate and maxaveragebitrate
from opus.conf.xml
上级
dd612321
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
35 行增加
和
2 行删除
+35
-2
opus.conf.xml
conf/vanilla/autoload_configs/opus.conf.xml
+13
-0
mod_opus.c
src/mod/codecs/mod_opus/mod_opus.c
+22
-2
没有找到文件。
conf/vanilla/autoload_configs/opus.conf.xml
浏览文件 @
826d4287
...
...
@@ -2,5 +2,18 @@
<settings>
<param
name=
"use-vbr"
value=
"1"
/>
<param
name=
"complexity"
value=
"10"
/>
<!--
maxaveragebitrate: the maximum average codec bitrate (values: 6000 to 510000 in bps) 0 is not considered
maxplaybackrate: the maximum codec internal frequency (values: 8000, 12000, 16000, 24000, 48000 in Hz) 0 is not considered
This will set the local encoder and instruct the remote encoder trough specific "fmtp" attibute in the SDP.
Example: if you receive "maxaveragebitrate=20000" from SDP and you have set "maxaveragebitrate=24000" in this configuration
the lowest will prevail in this case "20000" is set on the encoder and the corresponding fmtp attribute will be set
to instruct the remote encoder to do the same.
-->
<param
name=
"maxaveragebitrate"
value=
"0"
/>
<param
name=
"maxplaybackrate"
value=
"0"
/>
</settings>
</configuration>
src/mod/codecs/mod_opus/mod_opus.c
浏览文件 @
826d4287
...
...
@@ -78,6 +78,8 @@ struct opus_context {
struct
{
int
use_vbr
;
int
complexity
;
int
maxaveragebitrate
;
int
maxplaybackrate
;
switch_mutex_t
*
mutex
;
}
opus_prefs
;
...
...
@@ -240,6 +242,15 @@ static switch_status_t switch_opus_init(switch_codec_t *codec, switch_codec_flag
memset
(
&
codec_fmtp
,
'\0'
,
sizeof
(
struct
switch_codec_fmtp
));
codec_fmtp
.
private_info
=
&
opus_codec_settings
;
switch_opus_fmtp_parse
(
codec
->
fmtp_in
,
&
codec_fmtp
);
/* Verify if the local or remote configuration are lowering maxaveragebitrate and/or maxplaybackrate */
if
(
opus_prefs
.
maxaveragebitrate
&&
(
opus_prefs
.
maxaveragebitrate
<
opus_codec_settings
.
maxaveragebitrate
||
!
opus_codec_settings
.
maxaveragebitrate
)
)
{
opus_codec_settings
.
maxaveragebitrate
=
opus_prefs
.
maxaveragebitrate
;
}
if
(
opus_prefs
.
maxplaybackrate
&&
(
opus_prefs
.
maxplaybackrate
<
opus_codec_settings
.
maxplaybackrate
||
!
opus_codec_settings
.
maxplaybackrate
)
)
{
opus_codec_settings
.
maxplaybackrate
=
opus_prefs
.
maxplaybackrate
;
}
codec
->
fmtp_out
=
gen_fmtp
(
&
opus_codec_settings
,
codec
->
memory_pool
);
if
(
encoding
)
{
...
...
@@ -260,8 +271,6 @@ static switch_status_t switch_opus_init(switch_codec_t *codec, switch_codec_flag
}
/* Setting documented in "RTP Payload Format for Opus Speech and Audio Codec" draft-spittka-payload-rtp-opus-03 */
if
(
opus_codec_settings
.
maxaveragebitrate
)
{
/* Remote codec settings found in SDP "fmtp", we accept to tune the Encoder */
opus_encoder_ctl
(
context
->
encoder_object
,
OPUS_SET_BITRATE
(
opus_codec_settings
.
maxaveragebitrate
));
...
...
@@ -430,6 +439,17 @@ static switch_status_t opus_load_config(switch_bool_t reload)
opus_prefs
.
use_vbr
=
atoi
(
val
);
}
else
if
(
!
strcasecmp
(
key
,
"complexity"
))
{
opus_prefs
.
complexity
=
atoi
(
val
);
}
else
if
(
!
strcasecmp
(
key
,
"maxaveragebitrate"
))
{
opus_prefs
.
maxaveragebitrate
=
atoi
(
val
);
if
(
opus_prefs
.
maxaveragebitrate
<
6000
||
opus_prefs
.
maxaveragebitrate
>
510000
)
{
opus_prefs
.
maxaveragebitrate
=
0
;
/* values outside the range between 6000 and 510000 SHOULD be ignored */
}
}
else
if
(
!
strcasecmp
(
key
,
"maxplaybackrate"
))
{
opus_prefs
.
maxplaybackrate
=
atoi
(
val
);
if
(
opus_prefs
.
maxplaybackrate
!=
8000
&&
opus_prefs
.
maxplaybackrate
!=
12000
&&
opus_prefs
.
maxplaybackrate
!=
16000
&&
opus_prefs
.
maxplaybackrate
!=
24000
&&
opus_prefs
.
maxplaybackrate
!=
48000
)
{
opus_prefs
.
maxplaybackrate
=
0
;
/* value not supported */
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论