Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
94eb8ac0
提交
94eb8ac0
authored
7月 31, 2017
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-10560: [freeswitch-core] Add channel count to fsv #resolve
上级
144d3733
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
15 行增加
和
5 行删除
+15
-5
mod_fsv.c
src/mod/applications/mod_fsv/mod_fsv.c
+15
-5
没有找到文件。
src/mod/applications/mod_fsv/mod_fsv.c
浏览文件 @
94eb8ac0
...
...
@@ -38,7 +38,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_fsv_load);
SWITCH_MODULE_DEFINITION
(
mod_fsv
,
mod_fsv_load
,
NULL
,
NULL
);
#define VID_BIT (1 << 31)
#define VERSION 420
1
#define VERSION 420
2
struct
file_header
{
int32_t
version
;
...
...
@@ -47,6 +47,7 @@ struct file_header {
uint32_t
audio_rate
;
uint32_t
audio_ptime
;
switch_time_t
created
;
int
channels
;
};
struct
record_helper
{
...
...
@@ -61,8 +62,8 @@ static void record_video_thread(switch_core_session_t *session, void *obj)
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_status_t
status
;
switch_frame_t
*
read_frame
;
int
bytes
;
int
bytes
,
j
=
0
;
while
(
switch_channel_ready
(
channel
))
{
status
=
switch_core_session_read_video_frame
(
session
,
&
read_frame
,
SWITCH_IO_FLAG_NONE
,
0
);
...
...
@@ -74,6 +75,10 @@ static void record_video_thread(switch_core_session_t *session, void *obj)
continue
;
}
if
(
j
<
240
&&
(
++
j
%
60
)
==
0
)
{
switch_core_session_request_video_refresh
(
session
);
}
bytes
=
read_frame
->
packetlen
|
VID_BIT
;
switch_mutex_lock
(
eh
->
mutex
);
...
...
@@ -150,7 +155,7 @@ SWITCH_STANDARD_APP(record_fsv_function)
NULL
,
read_impl
.
samples_per_second
,
read_impl
.
microseconds_per_packet
/
1000
,
1
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
read_impl
.
number_of_channels
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
NULL
,
switch_core_session_get_pool
(
session
))
==
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Audio Codec Activation Success
\n
"
);
}
else
{
...
...
@@ -164,6 +169,7 @@ SWITCH_STANDARD_APP(record_fsv_function)
if
(
switch_channel_test_flag
(
channel
,
CF_VIDEO
))
{
struct
file_header
h
;
memset
(
&
h
,
0
,
sizeof
(
h
));
vid_codec
=
switch_core_session_get_video_read_codec
(
session
);
h
.
version
=
VERSION
;
...
...
@@ -174,6 +180,7 @@ SWITCH_STANDARD_APP(record_fsv_function)
}
h
.
audio_rate
=
read_impl
.
samples_per_second
;
h
.
audio_ptime
=
read_impl
.
microseconds_per_packet
/
1000
;
h
.
channels
=
read_impl
.
number_of_channels
;
if
(
write
(
fd
,
&
h
,
sizeof
(
h
))
!=
sizeof
(
h
))
{
switch_channel_set_variable
(
channel
,
SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE
,
"File write failed"
);
...
...
@@ -184,6 +191,7 @@ SWITCH_STANDARD_APP(record_fsv_function)
eh
.
mutex
=
mutex
;
eh
.
fd
=
fd
;
switch_core_media_start_engine_function
(
session
,
SWITCH_MEDIA_TYPE_VIDEO
,
record_video_thread
,
&
eh
);
switch_core_session_request_video_refresh
(
session
);
}
...
...
@@ -337,13 +345,15 @@ SWITCH_STANDARD_APP(play_fsv_function)
goto
end
;
}
if
(
!
h
.
channels
)
h
.
channels
=
1
;
if
(
switch_core_codec_init
(
&
codec
,
"L16"
,
NULL
,
NULL
,
h
.
audio_rate
,
h
.
audio_ptime
,
1
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
h
.
channels
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
NULL
,
switch_core_session_get_pool
(
session
))
==
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Audio Codec Activation Success
\n
"
);
}
else
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论