Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
33c852dd
提交
33c852dd
authored
1月 03, 2017
作者:
Anthony Minessale
提交者:
Mike Jerris
1月 03, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-9881: [core] FS crashing when playing png file #resolve
上级
9ef2492a
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
39 行增加
和
15 行删除
+39
-15
mod_png.c
src/mod/formats/mod_png/mod_png.c
+39
-15
没有找到文件。
src/mod/formats/mod_png/mod_png.c
浏览文件 @
33c852dd
...
@@ -50,6 +50,7 @@ struct png_file_context {
...
@@ -50,6 +50,7 @@ struct png_file_context {
int
max
;
int
max
;
int
samples
;
int
samples
;
switch_file_handle_t
*
audio_fh
;
switch_file_handle_t
*
audio_fh
;
switch_mutex_t
*
mutex
;
int
done
;
int
done
;
};
};
...
@@ -81,6 +82,7 @@ static switch_status_t png_file_open(switch_file_handle_t *handle, const char *p
...
@@ -81,6 +82,7 @@ static switch_status_t png_file_open(switch_file_handle_t *handle, const char *p
memset
(
context
,
0
,
sizeof
(
png_file_context_t
));
memset
(
context
,
0
,
sizeof
(
png_file_context_t
));
context
->
max
=
10000
;
context
->
max
=
10000
;
switch_mutex_init
(
&
context
->
mutex
,
SWITCH_MUTEX_NESTED
,
handle
->
memory_pool
);
if
(
handle
->
params
)
{
if
(
handle
->
params
)
{
const
char
*
audio_file
=
switch_event_get_header
(
handle
->
params
,
"audio_file"
);
const
char
*
audio_file
=
switch_event_get_header
(
handle
->
params
,
"audio_file"
);
...
@@ -141,11 +143,14 @@ static switch_status_t png_file_close(switch_file_handle_t *handle)
...
@@ -141,11 +143,14 @@ static switch_status_t png_file_close(switch_file_handle_t *handle)
{
{
png_file_context_t
*
context
=
(
png_file_context_t
*
)
handle
->
private_info
;
png_file_context_t
*
context
=
(
png_file_context_t
*
)
handle
->
private_info
;
switch_mutex_lock
(
context
->
mutex
);
context
->
done
=
1
;
switch_img_free
(
&
context
->
img
);
switch_img_free
(
&
context
->
img
);
if
(
context
->
audio_fh
)
switch_core_file_close
(
context
->
audio_fh
);
if
(
context
->
audio_fh
)
switch_core_file_close
(
context
->
audio_fh
);
context
->
done
=
1
;
switch_mutex_unlock
(
context
->
mutex
)
;
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
...
@@ -154,17 +159,22 @@ static switch_status_t png_file_read(switch_file_handle_t *handle, void *data, s
...
@@ -154,17 +159,22 @@ static switch_status_t png_file_read(switch_file_handle_t *handle, void *data, s
{
{
png_file_context_t
*
context
=
(
png_file_context_t
*
)
handle
->
private_info
;
png_file_context_t
*
context
=
(
png_file_context_t
*
)
handle
->
private_info
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
switch_mutex_lock
(
context
->
mutex
);
if
(
context
->
done
)
{
if
(
context
->
done
)
{
return
SWITCH_STATUS_FALSE
;
switch_goto_status
(
SWITCH_STATUS_FALSE
,
end
)
;
}
}
if
(
context
->
audio_fh
)
{
if
(
context
->
audio_fh
)
{
return
switch_core_file_read
(
context
->
audio_fh
,
data
,
len
);
status
=
switch_core_file_read
(
context
->
audio_fh
,
data
,
len
);
switch_goto_status
(
status
,
end
);
}
}
if
(
!
context
->
img
||
!
context
->
samples
)
{
if
(
!
context
->
img
||
!
context
->
samples
)
{
return
SWITCH_STATUS_FALSE
;
status
=
SWITCH_STATUS_FALSE
;
switch_goto_status
(
status
,
end
);
}
}
if
(
context
->
samples
>
0
)
{
if
(
context
->
samples
>
0
)
{
...
@@ -175,31 +185,39 @@ static switch_status_t png_file_read(switch_file_handle_t *handle, void *data, s
...
@@ -175,31 +185,39 @@ static switch_status_t png_file_read(switch_file_handle_t *handle, void *data, s
context
->
samples
-=
*
len
;
context
->
samples
-=
*
len
;
}
}
if
(
!
context
->
samples
)
{
if
(
context
->
samples
<=
0
)
{
return
SWITCH_STATUS_FALSE
;
context
->
done
=
1
;
status
=
SWITCH_STATUS_FALSE
;
switch_goto_status
(
status
,
end
);
}
}
memset
(
data
,
0
,
*
len
*
2
*
handle
->
channels
);
memset
(
data
,
0
,
*
len
*
2
*
handle
->
channels
);
return
SWITCH_STATUS_SUCCESS
;
end:
}
switch_mutex_unlock
(
context
->
mutex
);
return
status
;
}
static
switch_status_t
png_file_read_video
(
switch_file_handle_t
*
handle
,
switch_frame_t
*
frame
,
switch_video_read_flag_t
flags
)
static
switch_status_t
png_file_read_video
(
switch_file_handle_t
*
handle
,
switch_frame_t
*
frame
,
switch_video_read_flag_t
flags
)
{
{
png_file_context_t
*
context
=
(
png_file_context_t
*
)
handle
->
private_info
;
png_file_context_t
*
context
=
(
png_file_context_t
*
)
handle
->
private_info
;
switch_image_t
*
dup
=
NULL
;
switch_image_t
*
dup
=
NULL
;
int
have_frame
=
0
;
int
have_frame
=
0
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
switch_mutex_lock
(
context
->
mutex
);
if
(
context
->
done
)
{
if
(
context
->
done
)
{
return
SWITCH_STATUS_FALSE
;
switch_goto_status
(
SWITCH_STATUS_FALSE
,
end
)
;
}
}
if
((
flags
&
SVR_CHECK
))
{
if
((
flags
&
SVR_CHECK
))
{
return
SWITCH_STATUS_BREAK
;
switch_goto_status
(
SWITCH_STATUS_BREAK
,
end
)
;
}
}
if
(
!
context
->
img
||
!
context
->
samples
)
{
if
(
!
context
->
img
||
!
context
->
samples
)
{
return
SWITCH_STATUS_FALSE
;
switch_goto_status
(
SWITCH_STATUS_FALSE
,
end
)
;
}
}
if
((
flags
&&
SVR_BLOCK
))
{
if
((
flags
&&
SVR_BLOCK
))
{
...
@@ -213,10 +231,16 @@ static switch_status_t png_file_read_video(switch_file_handle_t *handle, switch_
...
@@ -213,10 +231,16 @@ static switch_status_t png_file_read_video(switch_file_handle_t *handle, switch_
switch_img_copy
(
context
->
img
,
&
dup
);
switch_img_copy
(
context
->
img
,
&
dup
);
frame
->
img
=
dup
;
frame
->
img
=
dup
;
context
->
sent
++
;
context
->
sent
++
;
return
SWITCH_STATUS_SUCCESS
;
status
=
SWITCH_STATUS_SUCCESS
;
}
else
{
}
else
{
return
SWITCH_STATUS_BREAK
;
status
=
SWITCH_STATUS_BREAK
;
}
}
end:
switch_mutex_unlock
(
context
->
mutex
);
return
status
;
}
}
typedef
struct
{
typedef
struct
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论