Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
34238d2b
提交
34238d2b
authored
10月 24, 2016
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-9665 #resolve [Add video_pre_call_banner feature]
上级
8e6d8973
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
65 行增加
和
14 行删除
+65
-14
switch_types.h
src/include/switch_types.h
+2
-1
mod_png.c
src/mod/formats/mod_png/mod_png.c
+10
-6
switch_core_io.c
src/switch_core_io.c
+2
-2
switch_core_media.c
src/switch_core_media.c
+4
-2
switch_ivr_bridge.c
src/switch_ivr_bridge.c
+47
-3
没有找到文件。
src/include/switch_types.h
浏览文件 @
34238d2b
...
@@ -1506,7 +1506,8 @@ typedef enum {
...
@@ -1506,7 +1506,8 @@ typedef enum {
CF_VIDEO_WRITING
,
CF_VIDEO_WRITING
,
CF_SLA_INTERCEPT
,
CF_SLA_INTERCEPT
,
CF_VIDEO_BREAK
,
CF_VIDEO_BREAK
,
CF_AUDIO_PAUSE
,
CF_AUDIO_PAUSE_READ
,
CF_AUDIO_PAUSE_WRITE
,
CF_VIDEO_PAUSE_READ
,
CF_VIDEO_PAUSE_READ
,
CF_VIDEO_PAUSE_WRITE
,
CF_VIDEO_PAUSE_WRITE
,
CF_BYPASS_MEDIA_AFTER_HOLD
,
CF_BYPASS_MEDIA_AFTER_HOLD
,
...
...
src/mod/formats/mod_png/mod_png.c
浏览文件 @
34238d2b
...
@@ -181,6 +181,7 @@ static switch_status_t png_file_read_video(switch_file_handle_t *handle, switch_
...
@@ -181,6 +181,7 @@ static switch_status_t png_file_read_video(switch_file_handle_t *handle, switch_
{
{
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
;
if
((
flags
&
SVR_CHECK
))
{
if
((
flags
&
SVR_CHECK
))
{
return
SWITCH_STATUS_BREAK
;
return
SWITCH_STATUS_BREAK
;
...
@@ -190,18 +191,21 @@ static switch_status_t png_file_read_video(switch_file_handle_t *handle, switch_
...
@@ -190,18 +191,21 @@ static switch_status_t png_file_read_video(switch_file_handle_t *handle, switch_
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
}
if
((
context
->
reads
++
%
20
)
==
0
)
{
if
((
flags
&&
SVR_BLOCK
))
{
switch_yield
(
33000
);
have_frame
=
1
;
}
else
if
((
context
->
reads
++
%
20
)
==
0
)
{
have_frame
=
1
;
}
if
(
have_frame
)
{
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
;
}
else
{
}
else
{
if
((
flags
&&
SVR_BLOCK
))
{
switch_yield
(
5000
);
}
return
SWITCH_STATUS_BREAK
;
return
SWITCH_STATUS_BREAK
;
}
}
return
SWITCH_STATUS_SUCCESS
;
}
}
typedef
struct
{
typedef
struct
{
...
...
src/switch_core_io.c
浏览文件 @
34238d2b
...
@@ -97,7 +97,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
...
@@ -97,7 +97,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
if
(
switch_channel_test_flag
(
session
->
channel
,
CF_AUDIO_PAUSE
))
{
if
(
switch_channel_test_flag
(
session
->
channel
,
CF_AUDIO_PAUSE
_READ
))
{
switch_yield
(
20000
);
switch_yield
(
20000
);
*
frame
=
&
runtime
.
dummy_cng_frame
;
*
frame
=
&
runtime
.
dummy_cng_frame
;
// switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Media Paused!!!!\n");
// switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Media Paused!!!!\n");
...
@@ -1039,7 +1039,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
...
@@ -1039,7 +1039,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
}
}
}
}
if
(
switch_channel_test_flag
(
session
->
channel
,
CF_AUDIO_PAUSE
))
{
if
(
switch_channel_test_flag
(
session
->
channel
,
CF_AUDIO_PAUSE
_WRITE
))
{
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
...
...
src/switch_core_media.c
浏览文件 @
34238d2b
...
@@ -4159,7 +4159,8 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
...
@@ -4159,7 +4159,8 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
return
0
;
return
0
;
}
}
switch_channel_clear_flag(channel, CF_AUDIO_PAUSE);
switch_channel_clear_flag
(
channel
,
CF_AUDIO_PAUSE_READ
);
switch_channel_clear_flag
(
channel
,
CF_AUDIO_PAUSE_WRITE
);
if
(
dtls_ok
(
session
)
&&
(
tmp
=
switch_channel_get_variable
(
smh
->
session
->
channel
,
"webrtc_enable_dtls"
))
&&
switch_false
(
tmp
))
{
if
(
dtls_ok
(
session
)
&&
(
tmp
=
switch_channel_get_variable
(
smh
->
session
->
channel
,
"webrtc_enable_dtls"
))
&&
switch_false
(
tmp
))
{
switch_channel_clear_flag
(
smh
->
session
->
channel
,
CF_DTLS_OK
);
switch_channel_clear_flag
(
smh
->
session
->
channel
,
CF_DTLS_OK
);
...
@@ -5563,7 +5564,8 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
...
@@ -5563,7 +5564,8 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
pmap
->
recv_pt
=
97
;
pmap
->
recv_pt
=
97
;
pmap
->
codec_ms
=
20
;
pmap
->
codec_ms
=
20
;
a_engine
->
cur_payload_map
=
pmap
;
a_engine
->
cur_payload_map
=
pmap
;
switch_channel_set_flag(channel, CF_AUDIO_PAUSE);
switch_channel_set_flag
(
channel
,
CF_AUDIO_PAUSE_READ
);
switch_channel_set_flag
(
channel
,
CF_AUDIO_PAUSE_WRITE
);
}
}
...
...
src/switch_ivr_bridge.c
浏览文件 @
34238d2b
...
@@ -81,7 +81,7 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj)
...
@@ -81,7 +81,7 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj)
switch_frame_t
*
read_frame
=
0
;
switch_frame_t
*
read_frame
=
0
;
int
set_decoded_read
=
0
,
refresh_timer
=
0
;
int
set_decoded_read
=
0
,
refresh_timer
=
0
;
int
refresh_cnt
=
300
;
int
refresh_cnt
=
300
;
vh
->
up
=
1
;
vh
->
up
=
1
;
switch_core_session_read_lock
(
vh
->
session_a
);
switch_core_session_read_lock
(
vh
->
session_a
);
...
@@ -133,13 +133,14 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj)
...
@@ -133,13 +133,14 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj)
}
}
status
=
switch_core_session_read_video_frame
(
vh
->
session_a
,
&
read_frame
,
SWITCH_IO_FLAG_NONE
,
0
);
status
=
switch_core_session_read_video_frame
(
vh
->
session_a
,
&
read_frame
,
SWITCH_IO_FLAG_NONE
,
0
);
if
(
!
SWITCH_READ_ACCEPTABLE
(
status
))
{
if
(
!
SWITCH_READ_ACCEPTABLE
(
status
))
{
switch_cond_next
();
switch_cond_next
();
continue
;
continue
;
}
}
}
}
if
(
switch_test_flag
(
read_frame
,
SFF_CNG
)
||
if
(
switch_test_flag
(
read_frame
,
SFF_CNG
)
||
switch_channel_test_flag
(
channel
,
CF_LEG_HOLDING
)
||
switch_channel_test_flag
(
b_channel
,
CF_VIDEO_READ_FILE_ATTACHED
))
{
switch_channel_test_flag
(
channel
,
CF_LEG_HOLDING
)
||
switch_channel_test_flag
(
b_channel
,
CF_VIDEO_READ_FILE_ATTACHED
))
{
continue
;
continue
;
...
@@ -285,6 +286,8 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
...
@@ -285,6 +286,8 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
switch_codec_implementation_t
read_impl
=
{
0
};
switch_codec_implementation_t
read_impl
=
{
0
};
uint32_t
txt_launch
=
0
;
uint32_t
txt_launch
=
0
;
struct
vid_helper
th
=
{
0
};
struct
vid_helper
th
=
{
0
};
const
char
*
banner_file
=
NULL
;
int
played_banner
=
0
,
banner_counter
=
0
;
#ifdef SWITCH_VIDEO_IN_THREADS
#ifdef SWITCH_VIDEO_IN_THREADS
struct
vid_helper
vh
=
{
0
};
struct
vid_helper
vh
=
{
0
};
...
@@ -299,7 +302,6 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
...
@@ -299,7 +302,6 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
switch_core_session_get_read_impl
(
session_a
,
&
read_impl
);
switch_core_session_get_read_impl
(
session_a
,
&
read_impl
);
input_callback
=
data
->
input_callback
;
input_callback
=
data
->
input_callback
;
user_data
=
data
->
session_data
;
user_data
=
data
->
session_data
;
stream_id
=
data
->
stream_id
;
stream_id
=
data
->
stream_id
;
...
@@ -346,6 +348,17 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
...
@@ -346,6 +348,17 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
goto
end_of_bridge_loop
;
goto
end_of_bridge_loop
;
}
}
if
(
switch_channel_test_flag
(
chan_a
,
CF_BRIDGE_ORIGINATOR
)
&&
(
banner_file
=
switch_channel_get_variable
(
chan_a
,
"video_pre_call_banner"
)))
{
switch_channel_set_flag
(
chan_a
,
CF_AUDIO_PAUSE_READ
);
switch_channel_set_flag
(
chan_b
,
CF_AUDIO_PAUSE_READ
);
switch_channel_set_flag
(
chan_a
,
CF_AUDIO_PAUSE_WRITE
);
switch_channel_set_flag
(
chan_b
,
CF_AUDIO_PAUSE_WRITE
);
switch_channel_set_flag
(
chan_a
,
CF_VIDEO_PAUSE_READ
);
switch_channel_set_flag
(
chan_b
,
CF_VIDEO_PAUSE_READ
);
}
if
(
bypass_media_after_bridge
)
{
if
(
bypass_media_after_bridge
)
{
const
char
*
source_a
=
switch_channel_get_variable
(
chan_a
,
"source"
);
const
char
*
source_a
=
switch_channel_get_variable
(
chan_a
,
"source"
);
const
char
*
source_b
=
switch_channel_get_variable
(
chan_b
,
"source"
);
const
char
*
source_b
=
switch_channel_get_variable
(
chan_b
,
"source"
);
...
@@ -494,6 +507,37 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
...
@@ -494,6 +507,37 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
#endif
#endif
if
(
read_frame_count
>=
DEFAULT_LEAD_FRAMES
&&
switch_channel_media_ack
(
chan_a
))
{
if
(
read_frame_count
>=
DEFAULT_LEAD_FRAMES
&&
switch_channel_media_ack
(
chan_a
))
{
if
(
!
played_banner
&&
switch_channel_test_flag
(
chan_a
,
CF_VIDEO
)
&&
switch_channel_test_flag
(
chan_b
,
CF_VIDEO
)
&&
switch_channel_test_flag
(
chan_a
,
CF_ANSWERED
)
&&
switch_channel_test_flag
(
chan_b
,
CF_ANSWERED
)
&&
++
banner_counter
>
100
&&
switch_channel_test_flag
(
chan_a
,
CF_VIDEO_READY
)
&&
switch_channel_test_flag
(
chan_b
,
CF_VIDEO_READY
)
&&
switch_channel_test_flag
(
chan_a
,
CF_BRIDGE_ORIGINATOR
)
&&
banner_file
)
{
const
char
*
b_banner_file
=
switch_channel_get_variable
(
chan_b
,
"video_pre_call_banner"
);
if
(
!
b_banner_file
)
{
b_banner_file
=
switch_channel_get_variable
(
chan_a
,
"video_pre_call_banner_bleg"
);
}
switch_channel_clear_flag
(
chan_a
,
CF_VIDEO_PAUSE_READ
);
switch_channel_clear_flag
(
chan_b
,
CF_VIDEO_PAUSE_READ
);
if
(
b_banner_file
)
{
switch_ivr_broadcast
(
switch_core_session_get_uuid
(
session_a
),
banner_file
,
SMF_ECHO_ALEG
);
switch_ivr_broadcast
(
switch_core_session_get_uuid
(
session_b
),
b_banner_file
,
SMF_ECHO_ALEG
);
}
else
{
switch_ivr_broadcast
(
switch_core_session_get_uuid
(
session_a
),
banner_file
,
SMF_ECHO_ALEG
|
SMF_ECHO_BLEG
);
}
played_banner
=
1
;
switch_channel_clear_flag
(
chan_a
,
CF_AUDIO_PAUSE_READ
);
switch_channel_clear_flag
(
chan_b
,
CF_AUDIO_PAUSE_READ
);
switch_channel_clear_flag
(
chan_a
,
CF_AUDIO_PAUSE_WRITE
);
switch_channel_clear_flag
(
chan_b
,
CF_AUDIO_PAUSE_WRITE
);
}
if
(
!
exec_check
)
{
if
(
!
exec_check
)
{
switch_channel_execute_on
(
chan_a
,
SWITCH_CHANNEL_EXECUTE_ON_PRE_BRIDGE_VARIABLE
);
switch_channel_execute_on
(
chan_a
,
SWITCH_CHANNEL_EXECUTE_ON_PRE_BRIDGE_VARIABLE
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论