Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
b61ebc75
提交
b61ebc75
authored
10月 02, 2015
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-8179
上级
168a1c04
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
21 行增加
和
23 行删除
+21
-23
mod_opus.c
src/mod/codecs/mod_opus/mod_opus.c
+19
-20
switch_jitterbuffer.c
src/switch_jitterbuffer.c
+2
-3
没有找到文件。
src/mod/codecs/mod_opus/mod_opus.c
浏览文件 @
b61ebc75
...
@@ -635,7 +635,7 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec,
...
@@ -635,7 +635,7 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec,
struct
opus_context
*
context
=
codec
->
private_info
;
struct
opus_context
*
context
=
codec
->
private_info
;
int
samples
=
0
;
int
samples
=
0
;
int
fec
=
0
,
plc
=
0
;
int
fec
=
0
,
plc
=
0
;
int32_t
frame_size
;
int32_t
frame_size
=
0
,
last_frame_size
=
0
;
uint32_t
frame_samples
;
uint32_t
frame_samples
;
if
(
!
context
)
{
if
(
!
context
)
{
...
@@ -649,7 +649,6 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec,
...
@@ -649,7 +649,6 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec,
switch_core_session_t
*
session
=
codec
->
session
;
switch_core_session_t
*
session
=
codec
->
session
;
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_jb_t
*
jb
=
NULL
;
switch_jb_t
*
jb
=
NULL
;
int
got_frame
=
0
;
plc
=
1
;
plc
=
1
;
...
@@ -675,40 +674,39 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec,
...
@@ -675,40 +674,39 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec,
frame
.
data
=
buf
;
frame
.
data
=
buf
;
frame
.
buflen
=
sizeof
(
buf
);
frame
.
buflen
=
sizeof
(
buf
);
if
(
globals
.
debug
||
context
->
debug
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Missing %s %u Checking JB
\n
"
,
seq
?
"SEQ"
:
"TS"
,
seq
?
seq
:
ts
);
}
if
(
switch_jb_peek_frame
(
jb
,
ts
,
seq
,
1
,
&
frame
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_jb_peek_frame
(
jb
,
ts
,
seq
,
1
,
&
frame
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
globals
.
debug
||
context
->
debug
)
{
if
(
globals
.
debug
||
context
->
debug
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Lookahead frame found: %u
->
%u
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Lookahead frame found: %u
:
%u
\n
"
,
codec
->
cur_frame
->
timestamp
,
frame
.
timestamp
);
frame
.
timestamp
,
frame
.
seq
);
}
}
encoded_data
=
frame
.
data
;
encoded_data_len
=
frame
.
datalen
;
if
((
fec
=
switch_opus_has_fec
(
frame
.
data
,
frame
.
datalen
)))
{
if
((
fec
=
switch_opus_has_fec
(
frame
.
data
,
frame
.
datalen
)))
{
got_frame
=
1
;
encoded_data
=
frame
.
data
;
encoded_data_len
=
frame
.
datalen
;
}
}
if
(
globals
.
debug
||
context
->
debug
)
{
if
(
globals
.
debug
||
context
->
debug
)
{
if
(
fec
)
{
if
(
fec
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"FEC info available in packet with SEQ
[%d] encoded_data_len
: %d
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"FEC info available in packet with SEQ
: %d LEN
: %d
\n
"
,
codec
->
cur_frame
->
seq
,
encoded_data_
len
);
frame
.
seq
,
frame
.
data
len
);
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"NO FEC info in this packet with SEQ
[%d] encoded_data_len
: %d
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"NO FEC info in this packet with SEQ
: %d LEN
: %d
\n
"
,
codec
->
cur_frame
->
seq
,
encoded_data_len
);
frame
.
seq
,
frame
.
datalen
);
}
}
}
}
}
}
}
}
}
}
if
(
!
got_frame
)
{
opus_decoder_ctl
(
context
->
decoder_object
,
OPUS_GET_LAST_PACKET_DURATION
(
&
frame_size
));
if
(
!
frame_size
)
{
frame_size
=
frame_samples
-
(
frame_samples
%
(
codec
->
implementation
->
actual_samples_per_second
/
400
));
}
}
opus_decoder_ctl
(
context
->
decoder_object
,
OPUS_GET_LAST_PACKET_DURATION
(
&
last_frame_size
));
if
(
last_frame_size
)
frame_size
=
last_frame_size
;
if
(
globals
.
debug
||
context
->
debug
)
{
if
(
globals
.
debug
||
context
->
debug
)
{
if
(
opus_prefs
.
use_jb_lookahead
||
context
->
use_jb_lookahead
)
{
if
(
opus_prefs
.
use_jb_lookahead
||
context
->
use_jb_lookahead
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"MISSING FRAME: %s
\n
"
,
fec
?
"Look-ahead FEC"
:
"PLC"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"MISSING FRAME: %s
\n
"
,
fec
?
"Look-ahead FEC"
:
"PLC"
);
...
@@ -723,7 +721,8 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec,
...
@@ -723,7 +721,8 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec,
if
(
globals
.
debug
||
context
->
debug
>
1
)
{
if
(
globals
.
debug
||
context
->
debug
>
1
)
{
int
samplerate
=
context
->
dec_frame_size
*
1000
/
(
codec
->
implementation
->
microseconds_per_packet
/
1000
);
int
samplerate
=
context
->
dec_frame_size
*
1000
/
(
codec
->
implementation
->
microseconds_per_packet
/
1000
);
switch_opus_info
(
encoded_data
,
encoded_data_len
,
switch_opus_info
(
encoded_data
,
encoded_data_len
,
samplerate
?
samplerate
:
codec
->
implementation
->
actual_samples_per_second
,
"decode"
);
samplerate
?
samplerate
:
codec
->
implementation
->
actual_samples_per_second
,
!
encoded_data
?
"PLC correction"
:
fec
?
"FEC correction"
:
"decode"
);
}
}
samples
=
opus_decode
(
context
->
decoder_object
,
encoded_data
,
encoded_data_len
,
decoded_data
,
frame_size
,
fec
);
samples
=
opus_decode
(
context
->
decoder_object
,
encoded_data
,
encoded_data_len
,
decoded_data
,
frame_size
,
fec
);
...
...
src/switch_jitterbuffer.c
浏览文件 @
b61ebc75
...
@@ -1262,15 +1262,14 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
...
@@ -1262,15 +1262,14 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
if
(
plc
)
{
if
(
plc
)
{
uint16_t
seq
;
uint16_t
seq
;
uint32_t
ts
;
uint32_t
ts
=
0
;
if
(
jb
->
samples_per_frame
)
{
if
(
jb
->
samples_per_frame
)
{
seq
=
htons
(
jb
->
last_psuedo_seq
);
seq
=
htons
(
jb
->
last_psuedo_seq
);
ts
=
jb
->
last_target_ts
;
}
else
{
}
else
{
seq
=
jb
->
last_target_seq
;
seq
=
jb
->
last_target_seq
;
}
}
ts
=
jb
->
last_target_ts
;
packet
->
header
.
seq
=
seq
;
packet
->
header
.
seq
=
seq
;
packet
->
header
.
ts
=
ts
;
packet
->
header
.
ts
=
ts
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论