Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
f5346bfe
提交
f5346bfe
authored
12月 09, 2014
作者:
Anthony Minessale
提交者:
Michael Jerris
5月 28, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7517: Reset context->nalu_28_start on mark bit - This makes FU-A parsing work
上级
303a4ecf
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
20 行增加
和
9 行删除
+20
-9
mod_av.c
src/mod/applications/mod_av/mod_av.c
+2
-0
mod_openh264.cpp
src/mod/codecs/mod_openh264/mod_openh264.cpp
+18
-9
没有找到文件。
src/mod/applications/mod_av/mod_av.c
浏览文件 @
f5346bfe
...
...
@@ -255,6 +255,7 @@ static void buffer_h264_nalu(h264_codec_context_t *context, switch_frame_t *fram
if
(
frame
->
m
)
{
switch_buffer_write
(
buffer
,
ff_input_buffer_padding
,
sizeof
(
ff_input_buffer_padding
));
context
->
nalu_28_start
=
0
;
}
}
...
...
@@ -717,6 +718,7 @@ static switch_status_t switch_h264_decode(switch_codec_t *codec, switch_frame_t
}
switch_buffer_zero
(
context
->
nalu_buffer
);
context
->
nalu_28_start
=
0
;
//switch_set_flag(frame, SFF_USE_VIDEO_TIMESTAMP);
return
SWITCH_STATUS_SUCCESS
;
}
...
...
src/mod/codecs/mod_openh264/mod_openh264.cpp
浏览文件 @
f5346bfe
...
...
@@ -34,7 +34,7 @@
#define EPSN (0.000001f) // (1e-6) // desired float precision
#define PESN (0.000001f) // (1e-6) // desired float precision
#define MT_ENABLED
//
#define MT_ENABLED
#include "codec_api.h"
//#include "inc/logging.h" // for debug
...
...
@@ -76,7 +76,7 @@ int FillSpecificParameters(SEncParamExt& param) {
/* Test for temporal, spatial, SNR scalability */
param
.
iPicWidth
=
1280
;
// width of picture in samples
param
.
iPicHeight
=
720
;
// height of picture in samples
param
.
iTargetBitrate
=
1280
*
720
*
8
;
// target bitrate desired
param
.
iTargetBitrate
=
12
50000
;
//12
80 * 720 * 8; // target bitrate desired
param
.
iRCMode
=
RC_QUALITY_MODE
;
// rc mode control
param
.
iTemporalLayerNum
=
1
;
// layer number at temporal level
param
.
iSpatialLayerNum
=
1
;
// layer number at spatial level
...
...
@@ -104,8 +104,8 @@ int FillSpecificParameters(SEncParamExt& param) {
param
.
sSpatialLayers
[
iIndexLayer
].
iVideoHeight
=
720
;
param
.
sSpatialLayers
[
iIndexLayer
].
fFrameRate
=
(
double
)
(
FPS
*
1.0
f
);
// param.sSpatialLayers[iIndexLayer].iQualityLayerNum = 1;
param
.
sSpatialLayers
[
iIndexLayer
].
iSpatialBitrate
=
1250000
;
//1280 * 720 * 8
;
//param.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate =
1250000
;
param
.
sSpatialLayers
[
iIndexLayer
].
iSpatialBitrate
=
param
.
iTargetBitrate
;
//param.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate =
param.iTargetBitrate
;
//param.sSpatialLayers[iIndexLayer].uiLevelIdc = LEVEL_1_3;
param
.
sSpatialLayers
[
iIndexLayer
].
uiProfileIdc
=
PRO_BASELINE
;
...
...
@@ -163,15 +163,19 @@ 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_WARNING
,
"Waiting SPS/PPS
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Waiting SPS/PPS
, Got %d
\n
"
,
nalu_type
);
return
0
;
}
if
(
!
context
->
got_sps
)
context
->
got_sps
=
1
;
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
"
);
context
->
got_sps
=
1
;
}
/* hack for phones sending sps/pps with frame->m = 1 such as grandstream */
if
((
nalu_type
==
7
||
nalu_type
==
8
)
&&
frame
->
m
)
frame
->
m
=
SWITCH_FALSE
;
if
(
nalu_type
==
28
)
{
// 0x1c FU-A
nalu_type
=
*
(
data
+
1
)
&
0x1f
;
...
...
@@ -191,6 +195,8 @@ static switch_size_t buffer_h264_nalu(h264_codec_context_t *context, switch_fram
context
->
nalu_28_start
=
0
;
}
if
(
frame
->
m
)
context
->
nalu_28_start
=
0
;
#ifdef DEBUG_H264
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"ts: %ld 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
,
...
...
@@ -396,7 +402,7 @@ static switch_status_t init_encoder(h264_codec_context_t *context, uint32_t widt
context
->
encoder_params
.
iPicWidth
=
width
;
context
->
encoder_params
.
iPicHeight
=
height
;
//context->encoder_params.iTargetBitrate = width * height * 8;
for
(
int
i
=
0
;
i
<
context
->
encoder_params
.
iSpatialLayerNum
;
i
++
)
{
context
->
encoder_params
.
sSpatialLayers
[
i
].
iVideoWidth
=
width
;
context
->
encoder_params
.
sSpatialLayers
[
i
].
iVideoHeight
=
height
;
...
...
@@ -495,7 +501,7 @@ static switch_status_t switch_h264_decode(switch_codec_t *codec, switch_frame_t
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "len: %d ts: %u mark:%d\n", frame->datalen, ntohl(frame->timestamp), frame->m);
if
(
0
&&
context
->
last_received_timestamp
&&
context
->
last_received_timestamp
!=
frame
->
timestamp
&&
if
(
context
->
last_received_timestamp
&&
context
->
last_received_timestamp
!=
frame
->
timestamp
&&
(
!
frame
->
m
)
&&
(
!
context
->
last_received_complete_picture
))
{
// possible packet loss
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Packet Loss, skip privousely received packets
\n
"
);
...
...
@@ -561,6 +567,7 @@ static switch_status_t switch_h264_decode(switch_codec_t *codec, switch_frame_t
}
//switch_set_flag(frame, SFF_USE_VIDEO_TIMESTAMP);
switch_buffer_zero
(
context
->
nalu_buffer
);
context
->
nalu_28_start
=
0
;
status
=
SWITCH_STATUS_SUCCESS
;
}
...
...
@@ -573,6 +580,8 @@ end:
if
(
status
==
SWITCH_STATUS_RESTART
)
{
context
->
got_sps
=
0
;
switch_buffer_zero
(
context
->
nalu_buffer
);
context
->
nalu_28_start
=
0
;
#if 0
/* re-initialize decoder, trying to recover from really bad H264 bit streams */
if (context->decoder->Initialize(&context->decoder_params)) {
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论