Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
13c99e93
提交
13c99e93
authored
2月 04, 2016
作者:
Seven Du
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-8406 #comment add options to scale down cavas size, fps and bandwidth
上级
8e7cfce5
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
76 行增加
和
1 行删除
+76
-1
conference_video.c
src/mod/applications/mod_conference/conference_video.c
+34
-0
mod_conference.c
src/mod/applications/mod_conference/mod_conference.c
+33
-1
mod_conference.h
src/mod/applications/mod_conference/mod_conference.h
+9
-0
没有找到文件。
src/mod/applications/mod_conference/conference_video.c
浏览文件 @
13c99e93
...
...
@@ -1233,6 +1233,7 @@ void conference_video_write_canvas_image_to_codec_group(conference_obj_t *confer
conference_member_t
*
imember
;
switch_frame_t
write_frame
=
{
0
},
*
frame
=
NULL
;
switch_status_t
encode_status
=
SWITCH_STATUS_FALSE
;
switch_image_t
*
scaled_img
=
codec_set
->
scaled_img
;
write_frame
=
codec_set
->
frame
;
frame
=
&
write_frame
;
...
...
@@ -1254,6 +1255,16 @@ void conference_video_write_canvas_image_to_codec_group(conference_obj_t *confer
switch_core_codec_control
(
&
codec_set
->
codec
,
SCC_VIDEO_GEN_KEYFRAME
,
SCCT_NONE
,
NULL
,
SCCT_NONE
,
NULL
,
NULL
,
NULL
);
}
if
(
scaled_img
)
{
if
(
!
send_keyframe
&&
codec_set
->
fps_divisor
>
1
&&
(
codec_set
->
frame_count
++
)
%
codec_set
->
fps_divisor
)
{
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Skip one frame, total: %d\n", codec_set->frame_count);
return
;
}
switch_img_scale
(
frame
->
img
,
&
scaled_img
,
scaled_img
->
d_w
,
scaled_img
->
d_h
);
frame
->
img
=
scaled_img
;
}
do
{
frame
->
data
=
((
unsigned
char
*
)
frame
->
packet
)
+
12
;
...
...
@@ -2320,6 +2331,28 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
write_codecs
[
i
]
->
frame
.
data
=
((
uint8_t
*
)
write_codecs
[
i
]
->
frame
.
packet
)
+
12
;
write_codecs
[
i
]
->
frame
.
packetlen
=
buflen
;
write_codecs
[
i
]
->
frame
.
buflen
=
buflen
-
12
;
if
(
conference
->
scale_h264_canvas_width
>
0
&&
conference
->
scale_h264_canvas_height
>
0
&&
!
strcmp
(
check_codec
->
implementation
->
iananame
,
"H264"
))
{
int32_t
bw
=
-
1
;
write_codecs
[
i
]
->
fps_divisor
=
conference
->
scale_h264_canvas_fps_divisor
;
write_codecs
[
i
]
->
scaled_img
=
switch_img_alloc
(
NULL
,
SWITCH_IMG_FMT_I420
,
conference
->
scale_h264_canvas_width
,
conference
->
scale_h264_canvas_height
,
16
);
if
(
conference
->
scale_h264_canvas_bandwidth
)
{
if
(
strcasecmp
(
conference
->
scale_h264_canvas_bandwidth
,
"auto"
))
{
bw
=
switch_parse_bandwidth_string
(
conference
->
scale_h264_canvas_bandwidth
);
}
}
if
(
bw
==
-
1
)
{
float
fps
=
conference
->
video_fps
.
fps
;
if
(
write_codecs
[
i
]
->
fps_divisor
)
fps
/=
write_codecs
[
i
]
->
fps_divisor
;
bw
=
switch_calc_bitrate
(
conference
->
scale_h264_canvas_width
,
conference
->
scale_h264_canvas_height
,
conference
->
video_quality
,
fps
);
}
switch_core_codec_control
(
&
write_codecs
[
i
]
->
codec
,
SCC_VIDEO_BANDWIDTH
,
SCCT_INT
,
&
bw
,
SCCT_NONE
,
NULL
,
NULL
,
NULL
);
}
switch_set_flag
((
&
write_codecs
[
i
]
->
frame
),
SFF_RAW_RTP
);
}
...
...
@@ -2984,6 +3017,7 @@ pp conference_video_set_incoming_bitrate(imember, kps, SWITCH_TRUE);
for
(
i
=
0
;
i
<
MAX_MUX_CODECS
;
i
++
)
{
if
(
write_codecs
[
i
]
&&
switch_core_codec_ready
(
&
write_codecs
[
i
]
->
codec
))
{
switch_core_codec_destroy
(
&
write_codecs
[
i
]
->
codec
);
switch_img_free
(
&
(
write_codecs
[
i
]
->
scaled_img
));
}
}
...
...
src/mod/applications/mod_conference/mod_conference.c
浏览文件 @
13c99e93
...
...
@@ -2411,7 +2411,12 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
const
char
*
force_rate
=
NULL
,
*
force_interval
=
NULL
,
*
force_channels
=
NULL
,
*
presence_id
=
NULL
;
uint32_t
force_rate_i
=
0
,
force_interval_i
=
0
,
force_channels_i
=
0
,
video_auto_floor_msec
=
0
;
switch_event_t
*
event
;
int
scale_h264_canvas_width
=
0
;
int
scale_h264_canvas_height
=
0
;
int
scale_h264_canvas_fps_divisor
=
0
;
char
*
scale_h264_canvas_bandwidth
=
NULL
;
/* Validate the conference name */
if
(
zstr
(
name
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Invalid Record! no name.
\n
"
);
...
...
@@ -2720,6 +2725,28 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"video-mode invalid, valid settings are 'passthrough', 'transcode' and 'mux'
\n
"
);
}
}
else
if
(
!
strcasecmp
(
var
,
"scale-h264-canvas-size"
)
&&
!
zstr
(
val
))
{
char
*
p
;
if
((
scale_h264_canvas_width
=
atoi
(
val
)))
{
if
((
p
=
strchr
(
val
,
'x'
)))
{
p
++
;
if
(
*
p
)
{
scale_h264_canvas_height
=
atoi
(
p
);
}
}
}
if
(
scale_h264_canvas_width
<
320
||
scale_h264_canvas_width
<
180
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Invalid scale-h264-canvas-size, falling back to 320x180
\n
"
);
scale_h264_canvas_width
=
320
;
scale_h264_canvas_width
=
180
;
}
}
else
if
(
!
strcasecmp
(
var
,
"scale-h264-canvas-fps-divisor"
)
&&
!
zstr
(
val
))
{
scale_h264_canvas_fps_divisor
=
atoi
(
val
);
if
(
scale_h264_canvas_fps_divisor
<
0
)
scale_h264_canvas_fps_divisor
=
0
;
}
else
if
(
!
strcasecmp
(
var
,
"scale-h264-canvas-bandwidth"
)
&&
!
zstr
(
val
))
{
scale_h264_canvas_bandwidth
=
val
;
}
}
...
...
@@ -2783,6 +2810,11 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
conference
->
conference_video_mode
=
conference_video_mode
;
conference
->
scale_h264_canvas_width
=
scale_h264_canvas_width
;
conference
->
scale_h264_canvas_height
=
scale_h264_canvas_height
;
conference
->
scale_h264_canvas_fps_divisor
=
scale_h264_canvas_fps_divisor
;
conference
->
scale_h264_canvas_bandwidth
=
switch_core_strdup
(
conference
->
pool
,
scale_h264_canvas_bandwidth
);
if
(
!
switch_core_has_video
()
&&
(
conference
->
conference_video_mode
==
CONF_VIDEO_MODE_MUX
||
conference
->
conference_video_mode
==
CONF_VIDEO_MODE_TRANSCODE
))
{
conference
->
conference_video_mode
=
CONF_VIDEO_MODE_PASSTHROUGH
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"video-mode invalid, only valid setting is 'passthrough' due to no video capabilities
\n
"
);
...
...
src/mod/applications/mod_conference/mod_conference.h
浏览文件 @
13c99e93
...
...
@@ -663,6 +663,12 @@ typedef struct conference_obj {
video_layout_t
*
new_personal_vlayout
;
int
max_bw_in
;
int
force_bw_in
;
/* special use case, scalling shared h264 canvas*/
int
scale_h264_canvas_width
;
int
scale_h264_canvas_height
;
int
scale_h264_canvas_fps_divisor
;
char
*
scale_h264_canvas_bandwidth
;
}
conference_obj_t
;
/* Relationship with another member */
...
...
@@ -794,6 +800,9 @@ typedef struct codec_set_s {
switch_codec_t
codec
;
switch_frame_t
frame
;
uint8_t
*
packet
;
switch_image_t
*
scaled_img
;
uint8_t
fps_divisor
;
uint32_t
frame_count
;
}
codec_set_t
;
typedef
void
(
*
conference_key_callback_t
)
(
conference_member_t
*
,
struct
caller_control_actions
*
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论