Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
7df07d30
提交
7df07d30
authored
7月 24, 2016
作者:
Seven Du
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-9357 handle packet loss, reset decoder on mem err
上级
18f1d568
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
26 行增加
和
6 行删除
+26
-6
switch_vpx.c
src/switch_vpx.c
+26
-6
没有找到文件。
src/switch_vpx.c
浏览文件 @
7df07d30
...
...
@@ -42,6 +42,12 @@
// #define DEBUG_VP9
#ifdef DEBUG_VP9
#define VPX_SWITCH_LOG_LEVEL SWITCH_LOG_ERROR
#else
#define VPX_SWITCH_LOG_LEVEL SWITCH_LOG_DEBUG1
#endif
#define SLICE_SIZE SWITCH_DEFAULT_VIDEO_SIZE
#define KEY_FRAME_MIN_FREQ 250000
...
...
@@ -291,6 +297,7 @@ struct vpx_context {
int
got_start_frame
;
uint32_t
last_received_timestamp
;
switch_bool_t
last_received_complete_picture
;
uint16_t
last_received_seq
;
int
need_key_frame
;
int
need_encoder_reset
;
int
need_decoder_reset
;
...
...
@@ -333,6 +340,7 @@ static switch_status_t init_decoder(switch_codec_t *codec)
context
->
last_ts
=
0
;
context
->
last_received_timestamp
=
0
;
context
->
last_received_complete_picture
=
0
;
context
->
last_received_seq
=
0
;
context
->
decoder_init
=
1
;
context
->
got_key_frame
=
0
;
context
->
no_key_frame
=
0
;
...
...
@@ -406,7 +414,7 @@ static switch_status_t init_encoder(switch_codec_t *codec)
config
->
g_lag_in_frames
=
0
;
config
->
kf_max_dist
=
360
;
//2000;
threads
=
cpus
/
4
;
if
(
threads
<
0
)
threads
=
1
;
if
(
threads
<
1
)
threads
=
1
;
config
->
g_threads
=
threads
;
if
(
context
->
is_vp9
)
{
...
...
@@ -967,7 +975,7 @@ static switch_status_t buffer_vp9_packets(vpx_context_t *context, switch_frame_t
#ifdef DEBUG_VP9
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
frame
->
m
?
SWITCH_LOG_ERROR
:
SWITCH_LOG_INFO
,
"[%02x %02x %02x %02x] m=%d len=%4d seq=%d ts=%
d
ssrc=%u "
"[%02x %02x %02x %02x] m=%d len=%4d seq=%d ts=%
u
ssrc=%u "
"have_pid=%d "
"have_p_layer=%d "
"have_layer_ind=%d "
...
...
@@ -1111,11 +1119,16 @@ static switch_status_t switch_vpx_decode(switch_codec_t *codec, switch_frame_t *
is_keyframe
=
IS_VP9_KEY_FRAME
(
*
(
unsigned
char
*
)
frame
->
data
);
is_start
=
IS_VP9_START_PKT
(
*
(
unsigned
char
*
)
frame
->
data
);
#ifdef DEBUG_VP9
if
(
is_keyframe
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"================Got a key frame!!!!========================
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
VPX_SWITCH_LOG_LEVEL
,
"================Got a key frame!!!!========================
\n
"
);
}
#endif
if
(
context
->
last_received_seq
&&
context
->
last_received_seq
+
1
!=
frame
->
seq
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
VPX_SWITCH_LOG_LEVEL
,
"Packet loss detected last=%d got=%d lost=%d
\n
"
,
context
->
last_received_seq
,
frame
->
seq
,
frame
->
seq
-
context
->
last_received_seq
);
if
(
is_keyframe
&&
context
->
vpx_packet_buffer
)
switch_buffer_zero
(
context
->
vpx_packet_buffer
);
}
context
->
last_received_seq
=
frame
->
seq
;
}
else
{
// vp8
is_start
=
(
*
(
unsigned
char
*
)
frame
->
data
&
0x10
);
is_keyframe
=
IS_VP8_KEY_FRAME
((
uint8_t
*
)
frame
->
data
);
...
...
@@ -1210,8 +1223,15 @@ static switch_status_t switch_vpx_decode(switch_codec_t *codec, switch_frame_t *
err
=
vpx_codec_decode
(
decoder
,
data
,
(
unsigned
int
)
len
,
NULL
,
0
);
if
(
err
!=
VPX_CODEC_OK
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG1
,
"Error decoding %"
SWITCH_SIZE_T_FMT
" bytes, [%d:%s:%s]
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
VPX_SWITCH_LOG_LEVEL
,
"Error decoding %"
SWITCH_SIZE_T_FMT
" bytes, [%d:%s:%s]
\n
"
,
len
,
err
,
vpx_codec_error
(
decoder
),
vpx_codec_error_detail
(
decoder
));
if
(
err
==
VPX_CODEC_MEM_ERROR
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"VPX MEM ERROR, resetting decoder!
\n
"
);
context
->
need_decoder_reset
=
1
;
}
switch_goto_status
(
SWITCH_STATUS_RESTART
,
end
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论