Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
7d5b0acc
提交
7d5b0acc
authored
4月 22, 2015
作者:
Anthony Minessale
提交者:
Michael Jerris
5月 28, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7502: add patch level for media bugs to call them as needed
上级
8234dadc
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
85 行增加
和
15 行删除
+85
-15
switch_core.h
src/include/switch_core.h
+1
-0
switch_types.h
src/include/switch_types.h
+4
-2
mod_conference.c
src/mod/applications/mod_conference/mod_conference.c
+20
-4
mod_cv.cpp
src/mod/applications/mod_cv/mod_cv.cpp
+23
-8
switch_core_media_bug.c
src/switch_core_media_bug.c
+36
-0
switch_core_video.c
src/switch_core_video.c
+1
-1
没有找到文件。
src/include/switch_core.h
浏览文件 @
7d5b0acc
...
...
@@ -251,6 +251,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_pop(switch_core_session_t
SWITCH_DECLARE
(
switch_status_t
)
switch_core_media_bug_exec_all
(
switch_core_session_t
*
orig_session
,
const
char
*
function
,
switch_media_bug_exec_cb_t
cb
,
void
*
user_data
);
SWITCH_DECLARE
(
uint32_t
)
switch_core_media_bug_patch_video
(
switch_core_session_t
*
orig_session
,
switch_frame_t
*
frame
);
SWITCH_DECLARE
(
uint32_t
)
switch_core_media_bug_count
(
switch_core_session_t
*
orig_session
,
const
char
*
function
);
/*!
\brief Add a media bug to the session
...
...
src/include/switch_types.h
浏览文件 @
7d5b0acc
...
...
@@ -489,7 +489,8 @@ typedef enum {
SWITCH_ABC_TYPE_TAP_NATIVE_WRITE
,
SWITCH_ABC_TYPE_CLOSE
,
SWITCH_ABC_TYPE_READ_VIDEO_PING
,
SWITCH_ABC_TYPE_STREAM_VIDEO_PING
SWITCH_ABC_TYPE_STREAM_VIDEO_PING
,
SWITCH_ABC_TYPE_VIDEO_PATCH
}
switch_abc_type_t
;
typedef
struct
{
...
...
@@ -1731,7 +1732,8 @@ typedef enum {
SMBF_MASK
=
(
1
<<
16
),
SMBF_READ_VIDEO_PING
=
(
1
<<
17
),
SMBF_READ_VIDEO_STREAM
=
(
1
<<
18
),
SMBF_WRITE_VIDEO_STREAM
=
(
1
<<
19
)
SMBF_WRITE_VIDEO_STREAM
=
(
1
<<
19
),
SMBF_VIDEO_PATCH
=
(
1
<<
20
)
}
switch_media_bug_flag_enum_t
;
typedef
uint32_t
switch_media_bug_flag_t
;
...
...
src/mod/applications/mod_conference/mod_conference.c
浏览文件 @
7d5b0acc
...
...
@@ -391,6 +391,7 @@ typedef struct mcu_layer_s {
int
member_id
;
int
idx
;
int
tagged
;
int
bugged
;
int
screen_w
;
int
screen_h
;
int
x_pos
;
...
...
@@ -1100,6 +1101,15 @@ static void scale_and_patch(conference_obj_t *conference, mcu_layer_t *layer, sw
switch_assert
(
layer
->
img
);
if
(
switch_img_scale
(
img
,
&
layer
->
img
,
img_w
,
img_h
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
layer
->
bugged
&&
layer
->
member_id
>
-
1
)
{
conference_member_t
*
member
;
if
((
member
=
conference_member_get
(
conference
,
layer
->
member_id
)))
{
switch_frame_t
write_frame
=
{
0
};
write_frame
.
img
=
layer
->
img
;
switch_core_media_bug_patch_video
(
member
->
session
,
&
write_frame
);
switch_thread_rwlock_unlock
(
member
->
rwlock
);
}
}
switch_img_patch
(
IMG
,
layer
->
img
,
x_pos
,
y_pos
);
}
...
...
@@ -1921,11 +1931,12 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
}
else
{
img
=
imember
->
avatar_png_img
;
}
layer
=
NULL
;
if
(
img
)
{
int
i
;
layer
=
NULL
;
used
++
;
switch_mutex_lock
(
conference
->
canvas
->
mutex
);
...
...
@@ -2030,6 +2041,10 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
img
=
NULL
;
layer
->
tagged
=
1
;
if
(
switch_core_media_bug_count
(
imember
->
session
,
"patch:video"
))
{
layer
->
bugged
=
1
;
}
}
}
...
...
@@ -2073,6 +2088,7 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
}
layer
->
tagged
=
0
;
}
layer
->
bugged
=
0
;
}
}
...
...
@@ -2162,14 +2178,14 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
write_frame
.
packetlen
=
0
;
//switch_core_session_write_video_frame(imember->session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
if
(
switch_frame_buffer_dup
(
imember
->
fb
,
&
write_frame
,
&
dupframe
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_queue_push
(
imember
->
mux_out_queue
,
dupframe
);
dupframe
=
NULL
;
}
if
(
imember
->
session
)
{
switch_core_session_rwunlock
(
imember
->
session
);
switch_core_session_rwunlock
(
imember
->
session
);
}
}
...
...
src/mod/applications/mod_cv/mod_cv.cpp
浏览文件 @
7d5b0acc
...
...
@@ -195,11 +195,10 @@ static void context_render_text(cv_context_t *context, struct overlay *overlay,
if
(
!
text
)
text
=
overlay
->
text
;
int
len
=
strlen
(
text
);
if
(
len
<
5
)
len
=
5
;
width
=
(
int
)
(
float
)(
font_size
*
0.75
f
*
len
)
;
if
(
len
<
5
)
len
=
5
;
width
=
(
int
)
(
float
)(
font_size
*
.95
f
*
len
);
switch_color_set_rgb
(
&
bgcolor
,
overlay
->
bg
);
...
...
@@ -817,7 +816,7 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi
}
}
if
(
context
->
debug
||
!
context
->
overlay_count
)
{
if
(
context
->
rawImage
&&
(
context
->
debug
||
!
context
->
overlay_count
)
)
{
libyuv
::
RGB24ToI420
((
uint8_t
*
)
context
->
rawImage
->
imageData
,
context
->
w
*
3
,
frame
->
img
->
planes
[
0
],
frame
->
img
->
stride
[
0
],
frame
->
img
->
planes
[
1
],
frame
->
img
->
stride
[
1
],
...
...
@@ -1151,6 +1150,7 @@ static switch_bool_t cv_bug_callback(switch_media_bug_t *bug, void *user_data, s
}
break
;
case
SWITCH_ABC_TYPE_READ_VIDEO_PING
:
case
SWITCH_ABC_TYPE_VIDEO_PATCH
:
{
switch_frame_t
*
frame
=
switch_core_media_bug_get_video_ping_frame
(
bug
);
video_thread_callback
(
context
->
session
,
frame
,
context
);
...
...
@@ -1173,6 +1173,8 @@ SWITCH_STANDARD_APP(cv_bug_start_function)
int
x
,
n
;
char
*
argv
[
25
]
=
{
0
};
int
argc
;
switch_media_bug_flag_t
flags
=
SMBF_READ_VIDEO_PING
;
const
char
*
function
=
"mod_cv"
;
if
((
bug
=
(
switch_media_bug_t
*
)
switch_channel_get_private
(
channel
,
"_cv_bug_"
)))
{
if
(
!
zstr
(
data
)
&&
!
strcasecmp
(
data
,
"stop"
))
{
...
...
@@ -1197,9 +1199,14 @@ SWITCH_STANDARD_APP(cv_bug_start_function)
parse_params
(
context
,
1
,
argc
,
argv
);
}
if
(
!
strcasecmp
(
argv
[
0
],
"patch"
)
||
!
strcasecmp
(
argv
[
1
],
"patch"
))
{
function
=
"patch:video"
;
flags
=
SMBF_VIDEO_PATCH
;
}
switch_thread_rwlock_rdlock
(
MODULE_INTERFACE
->
rwlock
);
if
((
status
=
switch_core_media_bug_add
(
session
,
"cv_bug"
,
NULL
,
cv_bug_callback
,
context
,
0
,
SMBF_READ_VIDEO_PING
,
&
bug
))
!=
SWITCH_STATUS_SUCCESS
)
{
if
((
status
=
switch_core_media_bug_add
(
session
,
function
,
NULL
,
cv_bug_callback
,
context
,
0
,
flags
,
&
bug
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Failure!
\n
"
);
switch_thread_rwlock_unlock
(
MODULE_INTERFACE
->
rwlock
);
return
;
...
...
@@ -1227,6 +1234,8 @@ SWITCH_STANDARD_API(cv_bug_api_function)
char
*
nested_cascade_path
=
NULL
;
char
*
lbuf
=
NULL
;
int
x
,
n
,
i
;
switch_media_bug_flag_t
flags
=
SMBF_READ_VIDEO_PING
;
const
char
*
function
=
"mod_cv"
;
if
(
zstr
(
cmd
))
{
goto
usage
;
...
...
@@ -1256,7 +1265,7 @@ SWITCH_STANDARD_API(cv_bug_api_function)
switch_channel_set_private
(
channel
,
"_cv_bug_"
,
NULL
);
switch_core_media_bug_remove
(
rsession
,
&
bug
);
stream
->
write_function
(
stream
,
"+OK Success
\n
"
);
}
else
if
(
!
strcasecmp
(
action
,
"start"
)
||
!
strcasecmp
(
action
,
"mod"
))
{
}
else
if
(
!
strcasecmp
(
action
,
"start"
)
||
!
strcasecmp
(
action
,
"mod"
)
||
!
strcasecmp
(
action
,
"patch"
)
)
{
context
=
(
cv_context_t
*
)
switch_core_media_bug_get_user_data
(
bug
);
switch_assert
(
context
);
parse_params
(
context
,
2
,
argc
,
argv
);
...
...
@@ -1268,7 +1277,7 @@ SWITCH_STANDARD_API(cv_bug_api_function)
goto
done
;
}
if
(
!
zstr
(
action
)
&&
strcasecmp
(
action
,
"start"
))
{
if
(
!
zstr
(
action
)
&&
strcasecmp
(
action
,
"start"
)
&&
strcasecmp
(
action
,
"patch"
)
)
{
goto
usage
;
}
...
...
@@ -1281,7 +1290,13 @@ SWITCH_STANDARD_API(cv_bug_api_function)
switch_thread_rwlock_rdlock
(
MODULE_INTERFACE
->
rwlock
);
if
((
status
=
switch_core_media_bug_add
(
rsession
,
"cv_bug"
,
NULL
,
cv_bug_callback
,
context
,
0
,
SMBF_READ_VIDEO_PING
,
&
bug
))
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
!
strcasecmp
(
action
,
"patch"
))
{
function
=
"patch:video"
;
flags
=
SMBF_VIDEO_PATCH
;
}
if
((
status
=
switch_core_media_bug_add
(
rsession
,
function
,
NULL
,
cv_bug_callback
,
context
,
0
,
flags
,
&
bug
))
!=
SWITCH_STATUS_SUCCESS
)
{
stream
->
write_function
(
stream
,
"-ERR Failure!
\n
"
);
switch_thread_rwlock_unlock
(
MODULE_INTERFACE
->
rwlock
);
goto
done
;
...
...
src/switch_core_media_bug.c
浏览文件 @
7d5b0acc
...
...
@@ -832,6 +832,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_pop(switch_core_session_t
return
SWITCH_STATUS_FALSE
;
}
SWITCH_DECLARE
(
uint32_t
)
switch_core_media_bug_count
(
switch_core_session_t
*
orig_session
,
const
char
*
function
)
{
switch_media_bug_t
*
bp
;
...
...
@@ -850,6 +851,41 @@ SWITCH_DECLARE(uint32_t) switch_core_media_bug_count(switch_core_session_t *orig
return
x
;
}
SWITCH_DECLARE
(
uint32_t
)
switch_core_media_bug_patch_video
(
switch_core_session_t
*
orig_session
,
switch_frame_t
*
frame
)
{
switch_media_bug_t
*
bp
;
uint32_t
x
=
0
,
ok
=
SWITCH_TRUE
,
prune
=
0
;
if
(
orig_session
->
bugs
)
{
switch_thread_rwlock_rdlock
(
orig_session
->
bug_rwlock
);
for
(
bp
=
orig_session
->
bugs
;
bp
;
bp
=
bp
->
next
)
{
if
(
!
switch_test_flag
(
bp
,
SMBF_PRUNE
)
&&
!
switch_test_flag
(
bp
,
SMBF_LOCK
)
&&
!
strcmp
(
bp
->
function
,
"patch:video"
))
{
if
(
bp
->
ready
&&
frame
->
img
&&
switch_test_flag
(
bp
,
SMBF_VIDEO_PATCH
))
{
bp
->
ping_frame
=
frame
;
if
(
bp
->
callback
)
{
if
(
bp
->
callback
(
bp
,
bp
->
user_data
,
SWITCH_ABC_TYPE_VIDEO_PATCH
)
==
SWITCH_FALSE
||
(
bp
->
stop_time
&&
bp
->
stop_time
<=
switch_epoch_time_now
(
NULL
)))
{
ok
=
SWITCH_FALSE
;
}
}
bp
->
ping_frame
=
NULL
;
}
if
(
ok
==
SWITCH_FALSE
)
{
switch_set_flag
(
bp
,
SMBF_PRUNE
);
prune
++
;
}
else
x
++
;
}
}
switch_thread_rwlock_unlock
(
orig_session
->
bug_rwlock
);
if
(
prune
)
{
switch_core_media_bug_prune
(
orig_session
);
}
}
return
x
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_core_media_bug_exec_all
(
switch_core_session_t
*
orig_session
,
const
char
*
function
,
switch_media_bug_exec_cb_t
cb
,
void
*
user_data
)
{
...
...
src/switch_core_video.c
浏览文件 @
7d5b0acc
...
...
@@ -836,7 +836,7 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, const c
if
(
len
<
5
)
len
=
5
;
width
=
(
int
)
(
float
)(
font_size
*
0
.
7
5
f
*
len
);
width
=
(
int
)
(
float
)(
font_size
*
0
.
9
5
f
*
len
);
txtimg
=
switch_img_alloc
(
NULL
,
SWITCH_IMG_FMT_I420
,
width
,
font_size
*
2
,
1
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论