Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
a74b6f62
提交
a74b6f62
authored
11月 20, 2014
作者:
Anthony Minessale
提交者:
Michael Jerris
5月 28, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7500: fix some of the debugging tools
上级
55c5f1da
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
75 行增加
和
27 行删除
+75
-27
mod_fsv.c
src/mod/applications/mod_fsv/mod_fsv.c
+69
-27
switch_core_media.c
src/switch_core_media.c
+6
-0
没有找到文件。
src/mod/applications/mod_fsv/mod_fsv.c
浏览文件 @
a74b6f62
...
...
@@ -568,7 +568,7 @@ SWITCH_STANDARD_APP(play_yuv_function)
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_frame_t
vid_frame
=
{
0
};
int
fd
=
-
1
;
switch_codec_t
*
codec
=
NULL
;
switch_codec_t
read_codec
,
*
codec
=
NULL
;
unsigned
char
*
vid_buffer
;
// switch_timer_t timer = { 0 };
switch_dtmf_t
dtmf
=
{
0
};
...
...
@@ -578,13 +578,38 @@ SWITCH_STANDARD_APP(play_yuv_function)
switch_byte_t
*
yuv
=
NULL
;
int
argc
;
char
*
argv
[
3
]
=
{
0
};
switch_codec_implementation_t
read_impl
=
{
0
};
char
*
mydata
=
switch_core_session_strdup
(
session
,
data
);
uint32_t
loops
=
0
;
switch_channel_answer
(
channel
);
while
(
switch_channel_ready
(
channel
)
&&
!
switch_channel_test_flag
(
channel
,
CF_VIDEO
))
{
if
((
++
loops
%
100
)
==
0
)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Waiting for video......
\n
"
);
switch_ivr_sleep
(
session
,
20
,
SWITCH_TRUE
,
NULL
);
continue
;
}
switch_channel_audio_sync
(
channel
);
if
(
!
switch_channel_test_flag
(
channel
,
CF_VIDEO
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Channel %s has no video
\n
"
,
switch_channel_get_name
(
channel
));
switch_core_session_get_read_impl
(
session
,
&
read_impl
);
if
(
switch_core_codec_init
(
&
read_codec
,
"L16"
,
NULL
,
read_impl
.
samples_per_second
,
read_impl
.
microseconds_per_packet
/
1000
,
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
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Audio Codec Activation Fail
\n
"
);
switch_channel_set_variable
(
channel
,
SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE
,
"Audio codec activation failed"
);
goto
done
;
}
switch_core_session_set_read_codec
(
session
,
&
read_codec
);
argc
=
switch_separate_string
(
mydata
,
' '
,
argv
,
(
sizeof
(
argv
)
/
sizeof
(
argv
[
0
])));
if
(
argc
==
0
)
{
...
...
@@ -630,7 +655,7 @@ SWITCH_STANDARD_APP(play_yuv_function)
close
(
fd
);
fd
=
-
1
;
switch_channel_answer
(
channel
);
codec
=
switch_core_session_get_video_write_codec
(
session
);
...
...
@@ -669,9 +694,8 @@ SWITCH_STANDARD_APP(play_yuv_function)
break
;
}
}
/* echo of opus tends to seg chrome */
//if (read_frame) switch_core_session_write_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0);
if
(
read_frame
)
switch_core_session_write_frame
(
session
,
read_frame
,
SWITCH_IO_FLAG_NONE
,
0
);
sprintf
(
ts_str
,
"%"
SWITCH_TIME_T_FMT
,
switch_micro_time_now
()
/
1000
);
text
(
img
->
planes
[
SWITCH_PLANE_PACKED
],
width
,
20
,
20
,
ts_str
);
...
...
@@ -691,43 +715,37 @@ SWITCH_STANDARD_APP(play_yuv_function)
switch_img_free
(
img
);
done
:
switch_core_codec_destroy
(
&
read_codec
);
switch_core_session_reset
(
session
,
SWITCH_TRUE
,
SWITCH_TRUE
);
// switch_channel_clear_flag(channel, CF_VIDEO_PASSIVE);
switch_channel_set_flag
(
channel
,
CF_VIDEO_ECHO
);
}
SWITCH_STANDARD_APP
(
decode_video_function
)
static
void
decode_video_thread
(
switch_core_session_t
*
session
,
void
*
obj
)
{
uint32_t
max_pictures
=
*
((
uint32_t
*
)
obj
);
switch_codec_t
*
codec
;
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_codec_t
*
codec
=
NULL
;
switch_frame_t
*
frame
;
uint32_t
width
=
0
,
height
=
0
;
uint32_t
max_pictures
=
0
;
uint32_t
decoded_pictures
=
0
;
if
(
!
zstr
(
data
))
max_pictures
=
atoi
(
data
);
if
(
!
switch_channel_test_flag
(
channel
,
CF_VIDEO
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Channel %s has no video
\n
"
,
switch_channel_get_name
(
channel
));
if
(
!
switch_channel_ready
(
channel
))
{
goto
done
;
}
switch_channel_set_flag
(
channel
,
CF_VIDEO_PASSIVE
);
switch_channel_clear_flag
(
channel
,
CF_VIDEO_ECHO
);
switch_channel_answer
(
channel
);
switch_core_session_refresh_video
(
session
);
switch_channel_set_variable
(
channel
,
SWITCH_PLAYBACK_TERMINATOR_USED
,
""
);
codec
=
switch_core_session_get_video_read_codec
(
session
);
if
(
!
codec
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Channel has no video read codec
\n
"
);
goto
done
;
}
switch_channel_set_flag
(
channel
,
CF_VIDEO_DECODED_READ
);
while
(
switch_channel_ready
(
channel
))
{
switch_status_t
status
=
switch_core_session_read_video_frame
(
session
,
&
frame
,
SWITCH_IO_FLAG_NONE
,
0
);
...
...
@@ -779,12 +797,36 @@ SWITCH_STANDARD_APP(decode_video_function)
}
}
switch_core_thread_session_end
(
session
);
done
:
return
;
}
SWITCH_STANDARD_APP
(
decode_video_function
)
{
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
uint32_t
max_pictures
=
0
;
const
char
*
moh
=
switch_channel_get_hold_music
(
channel
);
if
(
zstr
(
moh
))
{
moh
=
"silence_stream://-1"
;
}
switch_channel_answer
(
channel
);
switch_core_session_refresh_video
(
session
);
switch_core_media_start_video_function
(
session
,
decode_video_thread
,
&
max_pictures
);
switch_ivr_play_file
(
session
,
NULL
,
moh
,
NULL
);
switch_channel_set_variable
(
channel
,
SWITCH_PLAYBACK_TERMINATOR_USED
,
""
);
if
(
!
zstr
(
data
))
max_pictures
=
atoi
(
data
);
switch_channel_set_variable
(
channel
,
SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE
,
"OK"
);
done
:
switch_c
hannel_clear_flag
(
channel
,
CF_VIDEO_PASSIVE
);
switch_c
hannel_set_flag
(
channel
,
CF_VIDEO_ECHO
);
switch_c
ore_media_end_video_function
(
session
);
switch_c
ore_session_video_reset
(
session
);
}
...
...
src/switch_core_media.c
浏览文件 @
a74b6f62
...
...
@@ -4423,6 +4423,7 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
switch_status_t
status
;
switch_frame_t
*
read_frame
;
switch_media_handle_t
*
smh
;
uint32_t
loops
=
0
;
if
(
!
(
smh
=
session
->
media_handle
))
{
return
NULL
;
...
...
@@ -4438,6 +4439,11 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
switch_core_session_refresh_video
(
session
);
while
(
switch_channel_up_nosig
(
channel
))
{
if
(
!
switch_channel_test_flag
(
channel
,
CF_VIDEO
))
{
if
((
++
loops
%
100
)
==
0
)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Waiting for video......
\n
"
);
switch_yield
(
20000
);
continue
;
}
if
(
switch_channel_test_flag
(
channel
,
CF_VIDEO_PASSIVE
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s Video thread paused. Echo is %s
\n
"
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论