Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
06acde23
提交
06acde23
authored
4月 16, 2015
作者:
Seven Du
提交者:
Michael Jerris
5月 28, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7517: fix openh264 packet loss logic and tweak some logs
上级
30463bfc
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
20 行增加
和
11 行删除
+20
-11
mod_openh264.cpp
src/mod/codecs/mod_openh264/mod_openh264.cpp
+20
-11
没有找到文件。
src/mod/codecs/mod_openh264/mod_openh264.cpp
浏览文件 @
06acde23
...
...
@@ -185,7 +185,7 @@ static switch_size_t buffer_h264_nalu(h264_codec_context_t *context, switch_fram
uint8_t
nalu_hdr
=
*
data
;
uint8_t
sync_bytes
[]
=
{
0
,
0
,
0
,
1
};
switch_buffer_t
*
buffer
=
context
->
nalu_buffer
;
switch_size_t
size
=
0
;
switch_size_t
size
=
switch_buffer_inuse
(
buffer
)
;
switch_assert
(
frame
);
...
...
@@ -193,15 +193,14 @@ static switch_size_t buffer_h264_nalu(h264_codec_context_t *context, switch_fram
nalu_type
=
nalu_hdr
&
0x1f
;
if
(
!
context
->
got_sps
&&
nalu_type
!=
7
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
WARNIN
G
,
"Waiting SPS/PPS, Got %d
\n
"
,
nalu_type
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBU
G
,
"Waiting SPS/PPS, Got %d
\n
"
,
nalu_type
);
return
0
;
}
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "XXX GOT %d
\n", nalu_type
);
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "XXX GOT %d
len:%d\n", nalu_type, frame->datalen
);
if
(
!
context
->
got_sps
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Found SPS/PPS
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"=========================================================================================
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"===============Found SPS/PPS===============
\n
"
);
context
->
got_sps
=
1
;
}
...
...
@@ -249,8 +248,8 @@ static switch_size_t buffer_h264_nalu(h264_codec_context_t *context, switch_fram
if
(
frame
->
m
)
context
->
nalu_28_start
=
0
;
#ifdef DEBUG_H264
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"ts: %u len: %4d %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x mark=%d size=%"
SWITCH_SIZE_T_FMT
"
\n
"
,
(
frame
)
->
timestamp
,
(
frame
)
->
datalen
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"
seq: %u
ts: %u len: %4d %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x mark=%d size=%"
SWITCH_SIZE_T_FMT
"
\n
"
,
(
frame
)
->
seq
,
(
frame
)
->
timestamp
,
(
frame
)
->
datalen
,
*
((
uint8_t
*
)(
frame
)
->
data
),
*
((
uint8_t
*
)(
frame
)
->
data
+
1
),
*
((
uint8_t
*
)(
frame
)
->
data
+
2
),
*
((
uint8_t
*
)(
frame
)
->
data
+
3
),
*
((
uint8_t
*
)(
frame
)
->
data
+
4
),
*
((
uint8_t
*
)(
frame
)
->
data
+
5
),
...
...
@@ -573,12 +572,17 @@ static switch_status_t switch_h264_decode(switch_codec_t *codec, switch_frame_t
uint32_t
error_code
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "len: %d ts: %u mark:%d nalu:0x%x\n", frame->datalen, frame->timestamp, frame->m, *(uint8_t *)frame->data);
#ifdef DEBUG_H264
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"len: %d seq: %u ts: %u mark:%d nalu:0x%x
\n
"
,
frame
->
datalen
,
frame
->
seq
,
frame
->
timestamp
,
frame
->
m
,
*
(
uint8_t
*
)
frame
->
data
);
#endif
if
(
context
->
last_received_timestamp
&&
context
->
last_received_timestamp
!=
frame
->
timestamp
&&
(
!
frame
->
m
)
&&
(
!
context
->
last_received_complete_picture
))
{
(
!
context
->
last_received_complete_picture
))
{
// possible packet loss
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Packet Loss, skip privousely received packets
\n
"
);
if
(
frame
->
m
)
{
context
->
last_received_complete_picture
=
SWITCH_TRUE
;
}
switch_goto_status
(
SWITCH_STATUS_RESTART
,
end
);
}
...
...
@@ -586,7 +590,10 @@ static switch_status_t switch_h264_decode(switch_codec_t *codec, switch_frame_t
context
->
last_received_complete_picture
=
frame
->
m
?
SWITCH_TRUE
:
SWITCH_FALSE
;
size
=
buffer_h264_nalu
(
context
,
frame
);
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "READ buf:%ld got_key:%d st:%d m:%d size:%" SWITCH_SIZE_T_FMT "\n", size, context->got_sps, status, frame->m, size);
#ifdef DEBUG_H264
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"READ buf:%ld got_key:%d st:%d m:%d size:%"
SWITCH_SIZE_T_FMT
"
\n
"
,
size
,
context
->
got_sps
,
status
,
frame
->
m
,
size
);
#endif
if
(
size
==
1
)
{
switch_goto_status
(
SWITCH_STATUS_RESTART
,
end
);
...
...
@@ -639,7 +646,7 @@ static switch_status_t switch_h264_decode(switch_codec_t *codec, switch_frame_t
// pDecoder->DecodeFrame (NULL, 0, pData, &sDstBufInfo);
}
else
{
if
(
error_code
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
ERROR
,
"Decode error: 0x%x
\n
"
,
error_code
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
WARNING
,
"Decode error: 0x%x
\n
"
,
error_code
);
switch_goto_status
(
SWITCH_STATUS_RESTART
,
end
);
}
}
...
...
@@ -651,9 +658,11 @@ static switch_status_t switch_h264_decode(switch_codec_t *codec, switch_frame_t
end:
#if 0
if (size == 0) {
status = SWITCH_STATUS_MORE_DATA;
}
#endif
if
(
status
==
SWITCH_STATUS_RESTART
)
{
context
->
got_sps
=
0
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论