Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
434d39d4
提交
434d39d4
authored
6月 18, 2015
作者:
Michael Jerris
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7660: [mod_opus] cleanup issues from inital commit of opus_debug command
上级
9a0bbc45
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
20 行增加
和
10 行删除
+20
-10
mod_opus.c
src/mod/codecs/mod_opus/mod_opus.c
+20
-10
没有找到文件。
src/mod/codecs/mod_opus/mod_opus.c
浏览文件 @
434d39d4
...
...
@@ -262,32 +262,38 @@ static switch_status_t switch_opus_info(void * encoded_data, uint32_t len, uint3
const
unsigned
char
*
frame_data
[
48
];
char
has_fec
=
0
;
if
((
encoded_data
==
NULL
)
||
(
len
<
0
))
return
SWITCH_STATUS_FALSE
;
if
(
!
encoded_data
)
{
return
SWITCH_STATUS_FALSE
;
}
nb_frames
=
opus_packet_get_nb_frames
(
encoded_data
,
len
);
nb_samples
=
opus_packet_get_samples_per_frame
(
encoded_data
,
samples_per_second
)
*
nb_frames
;
audiobandwidth
=
opus_packet_get_bandwidth
(
encoded_data
);
if
(
audiobandwidth
==
OPUS_BANDWIDTH_NARROWBAND
){
if
(
audiobandwidth
==
OPUS_BANDWIDTH_NARROWBAND
)
{
audiobandwidth_str
=
"NARROWBAND"
;
}
else
if
(
audiobandwidth
==
OPUS_BANDWIDTH_MEDIUMBAND
)
{
audiobandwidth_str
=
"MEDIUMBAND"
;
}
else
if
(
audiobandwidth
==
OPUS_BANDWIDTH_WIDEBAND
){
}
else
if
(
audiobandwidth
==
OPUS_BANDWIDTH_WIDEBAND
)
{
audiobandwidth_str
=
"WIDEBAND"
;
}
else
if
(
audiobandwidth
==
OPUS_BANDWIDTH_SUPERWIDEBAND
)
{
audiobandwidth_str
=
"SUPERWIDEBAND"
;
}
else
if
(
audiobandwidth
==
OPUS_BANDWIDTH_FULLBAND
){
}
else
if
(
audiobandwidth
==
OPUS_BANDWIDTH_FULLBAND
)
{
audiobandwidth_str
=
"FULLBAND"
;
}
else
if
(
audiobandwidth
==
OPUS_INVALID_PACKET
){
}
else
if
(
audiobandwidth
==
OPUS_INVALID_PACKET
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"%s: OPUS_INVALID_PACKET !
\n
"
,
print_text
);
}
if
(
opus_packet_parse
(
encoded_data
,
len
,
NULL
,
frame_data
,
frame_sizes
,
NULL
)){
if
(
frame_data
[
0
]
!=
NULL
)
{
if
(
frame_data
[
0
])
{
/*check only 1st frame*/
has_fec
=
frame_data
[
0
][
0
]
&
(
0x80
>>
1
);
}
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s: frames [%d] samples [%d] audio bandwidth [%s] bytes [%d] FEC[%s]
\n
"
,
print_text
,
nb_frames
,
nb_samples
,
audiobandwidth_str
,
len
,
has_fec
?
"yes"
:
"no"
);
return
SWITCH_STATUS_SUCCESS
;
}
...
...
@@ -498,7 +504,7 @@ static switch_status_t switch_opus_encode(switch_codec_t *codec,
bytes
=
opus_encode
(
context
->
encoder_object
,
(
void
*
)
decoded_data
,
context
->
enc_frame_size
,
(
unsigned
char
*
)
encoded_data
,
len
);
if
(
globals
.
debug
){
if
(
globals
.
debug
)
{
int
samplerate
=
context
->
enc_frame_size
*
1000
/
(
codec
->
implementation
->
microseconds_per_packet
/
1000
);
switch_opus_info
(
encoded_data
,
bytes
,
samplerate
,
"encode"
);
}
...
...
@@ -545,9 +551,10 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec,
*
flag
&=
~
SFF_PLC
;
}
if
(
globals
.
debug
){
if
(
globals
.
debug
)
{
int
samplerate
=
context
->
dec_frame_size
*
1000
/
(
codec
->
implementation
->
microseconds_per_packet
/
1000
);
switch_opus_info
((
*
flag
&
SFF_PLC
)
?
NULL
:
encoded_data
,
encoded_data_len
,
samplerate
?
samplerate
:
codec
->
implementation
->
actual_samples_per_second
,
"decode"
);
switch_opus_info
((
*
flag
&
SFF_PLC
)
?
NULL
:
encoded_data
,
encoded_data_len
,
samplerate
?
samplerate
:
codec
->
implementation
->
actual_samples_per_second
,
"decode"
);
}
samples
=
opus_decode
(
context
->
decoder_object
,
encoded_data
,
encoded_data_len
,
decoded_data
,
frame_size
,
fec
);
...
...
@@ -693,6 +700,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load)
SWITCH_ADD_CODEC
(
codec_interface
,
"OPUS (STANDARD)"
);
SWITCH_ADD_API
(
commands_api_interface
,
"opus_debug"
,
"Set OPUS Debug"
,
mod_opus_debug
,
OPUS_DEBUG_SYNTAX
);
switch_console_set_complete
(
"add opus_debug on"
);
switch_console_set_complete
(
"add opus_debug off"
);
codec_interface
->
parse_fmtp
=
switch_opus_fmtp_parse
;
settings
=
default_codec_settings
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论