Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
7f436e29
提交
7f436e29
authored
5月 07, 2016
作者:
Seven Du
提交者:
Mike Jerris
2月 09, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-9137 update to openh264 release 1.5.0 and tweak some params
上级
ffc73419
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
20 行增加
和
13 行删除
+20
-13
mod_openh264.cpp
src/mod/codecs/mod_openh264/mod_openh264.cpp
+20
-13
没有找到文件。
src/mod/codecs/mod_openh264/mod_openh264.cpp
浏览文件 @
7f436e29
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-201
5
, Anthony Minessale II <anthm@freeswitch.org>
* Copyright (C) 2005-201
6
, Anthony Minessale II <anthm@freeswitch.org>
*
*
* Version: MPL 1.1
* Version: MPL 1.1
*
*
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
#define NAL_HEADER_ADD_0X30BYTES 50
#define NAL_HEADER_ADD_0X30BYTES 50
#endif
#endif
#define FPS
15
.0f // frame rate
#define FPS
30
.0f // frame rate
#define H264_NALU_BUFFER_SIZE 65536
#define H264_NALU_BUFFER_SIZE 65536
#define SLICE_SIZE SWITCH_DEFAULT_VIDEO_SIZE //NALU Slice Size
#define SLICE_SIZE SWITCH_DEFAULT_VIDEO_SIZE //NALU Slice Size
...
@@ -80,6 +80,7 @@ typedef struct h264_codec_context_s {
...
@@ -80,6 +80,7 @@ typedef struct h264_codec_context_s {
}
h264_codec_context_t
;
}
h264_codec_context_t
;
int
FillSpecificParameters
(
h264_codec_context_t
*
context
)
{
int
FillSpecificParameters
(
h264_codec_context_t
*
context
)
{
int
sane
=
0
;
SEncParamExt
*
param
;
SEncParamExt
*
param
;
param
=
&
context
->
encoder_params
;
param
=
&
context
->
encoder_params
;
...
@@ -98,11 +99,16 @@ int FillSpecificParameters(h264_codec_context_t *context) {
...
@@ -98,11 +99,16 @@ int FillSpecificParameters(h264_codec_context_t *context) {
context
->
bandwidth
=
switch_calc_bitrate
(
context
->
codec_settings
.
video
.
width
,
context
->
codec_settings
.
video
.
height
,
1
,
15
);
context
->
bandwidth
=
switch_calc_bitrate
(
context
->
codec_settings
.
video
.
width
,
context
->
codec_settings
.
video
.
height
,
1
,
15
);
}
}
if
(
context
->
bandwidth
>
5120
)
{
sane
=
switch_calc_bitrate
(
1920
,
1080
,
2
,
30
);
context
->
bandwidth
=
5120
;
if
(
context
->
bandwidth
>
sane
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"BITRATE TRUNCATED TO %d
\n
"
,
sane
);
context
->
bandwidth
=
sane
;
}
}
/* Test for temporal, spatial, SNR scalability */
context
->
bandwidth
*=
1024
;
param
->
fMaxFrameRate
=
FPS
*
2
;
param
->
iPicWidth
=
context
->
codec_settings
.
video
.
width
;
// width of picture in samples
param
->
iPicWidth
=
context
->
codec_settings
.
video
.
width
;
// width of picture in samples
param
->
iPicHeight
=
context
->
codec_settings
.
video
.
height
;
// height of picture in samples
param
->
iPicHeight
=
context
->
codec_settings
.
video
.
height
;
// height of picture in samples
param
->
iTargetBitrate
=
context
->
bandwidth
;
param
->
iTargetBitrate
=
context
->
bandwidth
;
...
@@ -132,18 +138,16 @@ int FillSpecificParameters(h264_codec_context_t *context) {
...
@@ -132,18 +138,16 @@ int FillSpecificParameters(h264_codec_context_t *context) {
int
iIndexLayer
=
0
;
int
iIndexLayer
=
0
;
param
->
sSpatialLayers
[
iIndexLayer
].
iVideoWidth
=
context
->
codec_settings
.
video
.
width
;
param
->
sSpatialLayers
[
iIndexLayer
].
iVideoWidth
=
context
->
codec_settings
.
video
.
width
;
param
->
sSpatialLayers
[
iIndexLayer
].
iVideoHeight
=
context
->
codec_settings
.
video
.
height
;
param
->
sSpatialLayers
[
iIndexLayer
].
iVideoHeight
=
context
->
codec_settings
.
video
.
height
;
param
->
sSpatialLayers
[
iIndexLayer
].
fFrameRate
=
(
double
)
(
FPS
*
1.0
f
)
;
param
->
sSpatialLayers
[
iIndexLayer
].
fFrameRate
=
FPS
;
// param->sSpatialLayers[iIndexLayer].iQualityLayerNum = 1;
// param->sSpatialLayers[iIndexLayer].iQualityLayerNum = 1;
param
->
sSpatialLayers
[
iIndexLayer
].
iSpatialBitrate
=
param
->
iTargetBitrate
;
param
->
sSpatialLayers
[
iIndexLayer
].
iSpatialBitrate
=
param
->
iTargetBitrate
;
//param->sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = param->iTargetBitrate
;
param
->
sSpatialLayers
[
iIndexLayer
].
iMaxSpatialBitrate
=
UNSPECIFIED_BIT_RATE
;
//param->sSpatialLayers[iIndexLayer].uiLevelIdc = LEVEL_3
_1;
param
->
sSpatialLayers
[
iIndexLayer
].
uiLevelIdc
=
LEVEL_4
_1
;
param
->
sSpatialLayers
[
iIndexLayer
].
uiProfileIdc
=
PRO_BASELINE
;
param
->
sSpatialLayers
[
iIndexLayer
].
uiProfileIdc
=
PRO_BASELINE
;
param
->
iUsageType
=
CAMERA_VIDEO_REAL_TIME
;
param
->
iUsageType
=
CAMERA_VIDEO_REAL_TIME
;
param
->
bEnableFrameCroppingFlag
=
1
;
param
->
bEnableFrameCroppingFlag
=
1
;
//param->iMaxBitrate = 1250000;
param
->
iMaxBitrate
=
UNSPECIFIED_BIT_RATE
;
//param->iTargetBitrate = 1250000;
#ifdef MT_ENABLED
#ifdef MT_ENABLED
param
->
sSpatialLayers
[
iIndexLayer
].
sSliceCfg
.
uiSliceMode
=
SM_DYN_SLICE
;
param
->
sSpatialLayers
[
iIndexLayer
].
sSliceCfg
.
uiSliceMode
=
SM_DYN_SLICE
;
...
@@ -513,7 +517,7 @@ static switch_status_t init_encoder(h264_codec_context_t *context, uint32_t widt
...
@@ -513,7 +517,7 @@ static switch_status_t init_encoder(h264_codec_context_t *context, uint32_t widt
}
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Codec ready; picture size %dx%d Bandwidth: %d
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Codec ready; picture size %dx%d Bandwidth: %d
\n
"
,
context
->
encoder_params
.
iPicWidth
,
context
->
encoder_params
.
iPicHeight
,
context
->
codec_settings
.
video
.
bandwidth
);
context
->
encoder_params
.
iPicWidth
,
context
->
encoder_params
.
iPicHeight
,
context
->
bandwidth
);
context
->
encoder_initialized
=
SWITCH_TRUE
;
context
->
encoder_initialized
=
SWITCH_TRUE
;
...
@@ -796,6 +800,10 @@ static switch_status_t switch_h264_destroy(switch_codec_t *codec)
...
@@ -796,6 +800,10 @@ static switch_status_t switch_h264_destroy(switch_codec_t *codec)
SWITCH_MODULE_LOAD_FUNCTION
(
mod_openh264_load
)
SWITCH_MODULE_LOAD_FUNCTION
(
mod_openh264_load
)
{
{
switch_codec_interface_t
*
codec_interface
;
switch_codec_interface_t
*
codec_interface
;
OpenH264Version
ver
;
ver
=
WelsGetCodecVersion
();
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"OpenH264 version %u.%u.%u.%u
\n
"
,
ver
.
uMajor
,
ver
.
uMinor
,
ver
.
uRevision
,
ver
.
uReserved
);
/* connect my internal structure to the blank pointer passed to me */
/* connect my internal structure to the blank pointer passed to me */
*
module_interface
=
switch_loadable_module_create_module_interface
(
pool
,
modname
);
*
module_interface
=
switch_loadable_module_create_module_interface
(
pool
,
modname
);
...
@@ -804,7 +812,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_openh264_load)
...
@@ -804,7 +812,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_openh264_load)
switch_core_codec_add_video_implementation
(
pool
,
codec_interface
,
99
,
"H264"
,
NULL
,
switch_core_codec_add_video_implementation
(
pool
,
codec_interface
,
99
,
"H264"
,
NULL
,
switch_h264_init
,
switch_h264_encode
,
switch_h264_decode
,
switch_h264_control
,
switch_h264_destroy
);
switch_h264_init
,
switch_h264_encode
,
switch_h264_decode
,
switch_h264_control
,
switch_h264_destroy
);
/* indicate that the module should continue to be loaded */
/* indicate that the module should continue to be loaded */
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论