Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
bc3ee71f
提交
bc3ee71f
authored
12月 05, 2014
作者:
Anthony Minessale
提交者:
Michael Jerris
5月 28, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7517: this seems to actually work for some reason
上级
1619a749
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
23 行增加
和
25 行删除
+23
-25
mod_openh264.cpp
src/mod/codecs/mod_openh264/mod_openh264.cpp
+23
-25
没有找到文件。
src/mod/codecs/mod_openh264/mod_openh264.cpp
浏览文件 @
bc3ee71f
...
@@ -60,6 +60,7 @@ typedef struct h264_codec_context_s {
...
@@ -60,6 +60,7 @@ typedef struct h264_codec_context_s {
int
last_nalu_data_pos
;
int
last_nalu_data_pos
;
int
nalu_eat
;
int
nalu_eat
;
int
nalu_28_start
;
int
nalu_28_start
;
SSourcePicture
pic
;
ISVCDecoder
*
decoder
;
ISVCDecoder
*
decoder
;
SDecodingParam
decoder_params
;
SDecodingParam
decoder_params
;
...
@@ -78,18 +79,28 @@ int FillSpecificParameters(SEncParamExt& param) {
...
@@ -78,18 +79,28 @@ int FillSpecificParameters(SEncParamExt& param) {
param
.
iPicHeight
=
720
;
// height of picture in samples
param
.
iPicHeight
=
720
;
// height of picture in samples
param
.
iTargetBitrate
=
1280
*
720
*
8
;
// target bitrate desired
param
.
iTargetBitrate
=
1280
*
720
*
8
;
// target bitrate desired
param
.
iRCMode
=
RC_QUALITY_MODE
;
// rc mode control
param
.
iRCMode
=
RC_QUALITY_MODE
;
// rc mode control
#ifdef MT_ENABLED
param
.
uiMaxNalSize
=
SLICE_SIZE
;
param
.
uiMaxNalSize
=
SLICE_SIZE
;
#endif
param
.
iTemporalLayerNum
=
1
;
// layer number at temporal level
param
.
iTemporalLayerNum
=
1
;
// layer number at temporal level
param
.
iSpatialLayerNum
=
1
;
// layer number at spatial level
param
.
iSpatialLayerNum
=
1
;
// layer number at spatial level
param
.
bEnableDenoise
=
0
;
// denoise control
param
.
bEnableDenoise
=
0
;
// denoise control
param
.
bEnableBackgroundDetection
=
1
;
// background detection control
param
.
bEnableBackgroundDetection
=
1
;
// background detection control
param
.
bEnableSceneChangeDetect
=
1
;
//param.bEnableFrameSkip = 1;
param
.
iMultipleThreadIdc
=
1
;
param
.
bEnableAdaptiveQuant
=
1
;
// adaptive quantization control
param
.
bEnableAdaptiveQuant
=
1
;
// adaptive quantization control
param
.
bEnableLongTermReference
=
0
;
// long term reference control
param
.
bEnableLongTermReference
=
0
;
// long term reference control
param
.
iLtrMarkPeriod
=
30
;
param
.
iLtrMarkPeriod
=
30
;
param
.
iLoopFilterAlphaC0Offset
=
0
;
param
.
iLoopFilterBetaOffset
=
0
;
param
.
iComplexityMode
=
MEDIUM_COMPLEXITY
;
param
.
iComplexityMode
=
MEDIUM_COMPLEXITY
;
param
.
uiIntraPeriod
=
FPS
*
3
;
// period of Intra frame
param
.
uiIntraPeriod
=
FPS
*
3
;
// period of Intra frame
#ifdef MT_ENABLED
param
.
bEnableSpsPpsIdAddition
=
1
;
param
.
bEnableSpsPpsIdAddition
=
1
;
#else
param
.
bEnableSpsPpsIdAddition
=
0
;
#endif
param
.
bPrefixNalAddingCtrl
=
0
;
param
.
bPrefixNalAddingCtrl
=
0
;
int
iIndexLayer
=
0
;
int
iIndexLayer
=
0
;
...
@@ -246,7 +257,7 @@ static switch_status_t nalu_slice(h264_codec_context_t *context, switch_frame_t
...
@@ -246,7 +257,7 @@ static switch_status_t nalu_slice(h264_codec_context_t *context, switch_frame_t
}
}
//DFF The else branch here is not working. Whatever it's doing is creating corrupt picture.
//DFF The else branch here is not working. Whatever it's doing is creating corrupt picture.
if
(
1
||
nalu_len
<=
SLICE_SIZE
)
{
if
(
nalu_len
<=
SLICE_SIZE
)
{
uint8_t
nalu_type
;
uint8_t
nalu_type
;
context
->
last_nalu_data_pos
+=
4
;
context
->
last_nalu_data_pos
+=
4
;
...
@@ -412,7 +423,6 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t
...
@@ -412,7 +423,6 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t
int
width
=
0
;
int
width
=
0
;
int
height
=
0
;
int
height
=
0
;
long
enc_ret
;
long
enc_ret
;
SSourcePicture
*
pic
=
NULL
;
long
result
;
long
result
;
frame
->
m
=
SWITCH_FALSE
;
frame
->
m
=
SWITCH_FALSE
;
...
@@ -450,21 +460,19 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t
...
@@ -450,21 +460,19 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t
init_encoder
(
context
,
width
,
height
);
init_encoder
(
context
,
width
,
height
);
}
}
pic
=
new
SSourcePicture
;
context
->
pic
.
iColorFormat
=
videoFormatI420
;
if
(
pic
==
NULL
)
goto
error
;
context
->
pic
.
iPicHeight
=
height
;
context
->
pic
.
iPicWidth
=
width
;
context
->
pic
.
iStride
[
0
]
=
frame
->
img
->
stride
[
0
];
context
->
pic
.
iStride
[
1
]
=
frame
->
img
->
stride
[
1
];
context
->
pic
.
iStride
[
2
]
=
frame
->
img
->
stride
[
2
];
pic
->
iColorFormat
=
videoFormatI420
;
context
->
pic
.
pData
[
0
]
=
frame
->
img
->
planes
[
0
];
pic
->
iPicHeight
=
height
;
context
->
pic
.
pData
[
1
]
=
frame
->
img
->
planes
[
1
];
pic
->
iPicWidth
=
width
;
context
->
pic
.
pData
[
2
]
=
frame
->
img
->
planes
[
2
];
pic
->
iStride
[
0
]
=
frame
->
img
->
stride
[
0
];
pic
->
iStride
[
1
]
=
frame
->
img
->
stride
[
1
];
pic
->
iStride
[
2
]
=
frame
->
img
->
stride
[
2
];
pic
->
pData
[
0
]
=
frame
->
img
->
planes
[
0
];
result
=
(
EVideoFrameType
)
context
->
encoder
->
EncodeFrame
(
&
context
->
pic
,
&
context
->
bit_stream_info
);
pic
->
pData
[
1
]
=
frame
->
img
->
planes
[
1
];
pic
->
pData
[
2
]
=
frame
->
img
->
planes
[
2
];
result
=
(
EVideoFrameType
)
context
->
encoder
->
EncodeFrame
(
pic
,
&
context
->
bit_stream_info
);
if
(
result
!=
cmResultSuccess
)
{
if
(
result
!=
cmResultSuccess
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"EncodeFrame() failed, result = %ld
\n
"
,
result
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"EncodeFrame() failed, result = %ld
\n
"
,
result
);
goto
error
;
goto
error
;
...
@@ -474,20 +482,10 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t
...
@@ -474,20 +482,10 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t
context
->
cur_nalu_index
=
0
;
context
->
cur_nalu_index
=
0
;
context
->
last_nalu_data_pos
=
0
;
context
->
last_nalu_data_pos
=
0
;
if
(
pic
){
delete
pic
;
pic
=
NULL
;
}
return
nalu_slice
(
context
,
frame
);
return
nalu_slice
(
context
,
frame
);
error:
error:
if
(
pic
){
delete
pic
;
pic
=
NULL
;
}
frame
->
datalen
=
0
;
frame
->
datalen
=
0
;
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论