Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
b100a406
提交
b100a406
authored
2月 05, 2008
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@7531
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
c5d8b78f
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
61 行增加
和
11 行删除
+61
-11
sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_glue.c
+5
-3
switch_ivr_async.c
src/switch_ivr_async.c
+30
-2
switch_ivr_bridge.c
src/switch_ivr_bridge.c
+24
-4
switch_rtp.c
src/switch_rtp.c
+2
-2
没有找到文件。
src/mod/endpoints/mod_sofia/sofia_glue.c
浏览文件 @
b100a406
...
...
@@ -1413,16 +1413,18 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
sofia_glue_check_video_codecs
(
tech_pvt
);
if
(
switch_test_flag
(
tech_pvt
,
TFLAG_VIDEO
)
&&
tech_pvt
->
video_rm_encoding
)
{
flags
=
(
switch_rtp_flag_t
)
(
SWITCH_RTP_FLAG_AUTOADJ
|
SWITCH_RTP_FLAG_DATAWAIT
|
SWITCH_RTP_FLAG_NOBLOCK
|
SWITCH_RTP_FLAG_RAW_WRITE
);
flags
=
(
switch_rtp_flag_t
)
(
SWITCH_RTP_FLAG_USE_TIMER
|
SWITCH_RTP_FLAG_AUTOADJ
|
SWITCH_RTP_FLAG_DATAWAIT
|
SWITCH_RTP_FLAG_NOBLOCK
|
SWITCH_RTP_FLAG_RAW_WRITE
);
sofia_glue_tech_set_video_codec
(
tech_pvt
,
0
);
/* set video timer to 10ms so it can co-exist with audio */
tech_pvt
->
video_rtp_session
=
switch_rtp_new
(
tech_pvt
->
local_sdp_audio_ip
,
tech_pvt
->
local_sdp_video_port
,
tech_pvt
->
remote_sdp_video_ip
,
tech_pvt
->
remote_sdp_video_port
,
tech_pvt
->
video_agreed_pt
,
tech_pvt
->
video_read_codec
.
implementation
->
samples_per_frame
,
0
,
1
,
1000
0
,
(
switch_rtp_flag_t
)
flags
,
NULL
,
&
err
,
...
...
src/switch_ivr_async.c
浏览文件 @
b100a406
...
...
@@ -33,6 +33,7 @@
#include <switch.h>
#ifdef SWITCH_VIDEO_IN_THREADS
struct
echo_helper
{
switch_core_session_t
*
session
;
int
up
;
...
...
@@ -54,24 +55,32 @@ static void *SWITCH_THREAD_FUNC echo_video_thread(switch_thread_t *thread, void
break
;
}
if
(
switch_test_flag
(
read_frame
,
SFF_CNG
))
{
continue
;
}
switch_core_session_write_video_frame
(
session
,
read_frame
,
-
1
,
0
);
}
eh
->
up
=
0
;
return
NULL
;
}
#endif
SWITCH_DECLARE
(
void
)
switch_ivr_session_echo
(
switch_core_session_t
*
session
)
{
switch_status_t
status
;
switch_frame_t
*
read_frame
;
struct
echo_helper
eh
=
{
0
};
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
#ifdef SWITCH_VIDEO_IN_THREADS
struct
echo_helper
eh
=
{
0
};
switch_thread_t
*
thread
;
switch_threadattr_t
*
thd_attr
=
NULL
;
#endif
switch_channel_pre_answer
(
channel
);
#ifdef SWITCH_VIDEO_IN_THREADS
if
(
switch_channel_test_flag
(
channel
,
CF_VIDEO
))
{
eh
.
session
=
session
;
switch_threadattr_create
(
&
thd_attr
,
switch_core_session_get_pool
(
session
));
...
...
@@ -79,6 +88,7 @@ SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session)
switch_threadattr_stacksize_set
(
thd_attr
,
SWITCH_THREAD_STACKSIZE
);
switch_thread_create
(
&
thread
,
thd_attr
,
echo_video_thread
,
&
eh
,
switch_core_session_get_pool
(
session
));
}
#endif
while
(
switch_channel_ready
(
channel
))
{
status
=
switch_core_session_read_frame
(
session
,
&
read_frame
,
-
1
,
0
);
...
...
@@ -86,13 +96,31 @@ SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session)
break
;
}
switch_core_session_write_frame
(
session
,
read_frame
,
-
1
,
0
);
#ifndef SWITCH_VIDEO_IN_THREADS
status
=
switch_core_session_read_video_frame
(
session
,
&
read_frame
,
-
1
,
0
);
if
(
!
SWITCH_READ_ACCEPTABLE
(
status
))
{
break
;
}
if
(
switch_test_flag
(
read_frame
,
SFF_CNG
))
{
continue
;
}
switch_core_session_write_video_frame
(
session
,
read_frame
,
-
1
,
0
);
#endif
}
#ifdef SWITCH_VIDEO_IN_THREADS
if
(
eh
.
up
)
{
while
(
eh
.
up
)
{
switch_yield
(
1000
);
}
}
#endif
}
typedef
struct
{
...
...
src/switch_ivr_bridge.c
浏览文件 @
b100a406
...
...
@@ -36,6 +36,7 @@ static const switch_state_handler_table_t audio_bridge_peer_state_handlers;
/* Bridge Related Stuff*/
/*********************************************************************************/
#ifdef SWITCH_VIDEO_IN_THREADS
struct
vid_helper
{
switch_core_session_t
*
session_a
;
switch_core_session_t
*
session_b
;
...
...
@@ -52,7 +53,7 @@ static void *SWITCH_THREAD_FUNC video_bridge_thread(switch_thread_t *thread, voi
vh
->
up
=
1
;
while
(
switch_channel_ready
(
channel
)
&&
vh
->
up
==
1
)
{
status
=
switch_core_session_read_video_frame
(
vh
->
session_a
,
&
read_frame
,
-
1
,
0
);
if
(
!
SWITCH_READ_ACCEPTABLE
(
status
))
{
break
;
}
...
...
@@ -64,7 +65,6 @@ static void *SWITCH_THREAD_FUNC video_bridge_thread(switch_thread_t *thread, voi
return
NULL
;
}
static
void
launch_video
(
struct
vid_helper
*
vh
)
{
switch_thread_t
*
thread
;
...
...
@@ -75,7 +75,7 @@ static void launch_video(struct vid_helper *vh)
switch_threadattr_stacksize_set
(
thd_attr
,
SWITCH_THREAD_STACKSIZE
);
switch_thread_create
(
&
thread
,
thd_attr
,
video_bridge_thread
,
vh
,
switch_core_session_get_pool
(
vh
->
session_a
));
}
#endif
struct
switch_ivr_bridge_data
{
switch_core_session_t
*
session
;
...
...
@@ -96,9 +96,12 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
switch_channel_t
*
chan_a
,
*
chan_b
;
switch_frame_t
*
read_frame
;
switch_core_session_t
*
session_a
,
*
session_b
;
uint32_t
loop_count
=
0
,
vid_launch
=
0
;
uint32_t
loop_count
=
0
;
const
char
*
app_name
=
NULL
,
*
app_arg
=
NULL
;
#ifdef SWITCH_VIDEO_IN_THREADS
struct
vid_helper
vh
=
{
0
};
uint32_t
vid_launch
=
0
;
#endif
session_a
=
data
->
session
;
if
(
!
(
session_b
=
switch_core_session_locate
(
data
->
b_uuid
)))
{
...
...
@@ -157,12 +160,14 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
continue
;
}
#ifdef SWITCH_VIDEO_IN_THREADS
if
(
switch_channel_test_flag
(
chan_a
,
CF_VIDEO
)
&&
switch_channel_test_flag
(
chan_b
,
CF_VIDEO
)
&&
!
vid_launch
)
{
vid_launch
++
;
vh
.
session_a
=
session_a
;
vh
.
session_b
=
session_b
;
launch_video
(
&
vh
);
}
#endif
/* if 1 channel has DTMF pass it to the other */
while
(
switch_channel_has_dtmf
(
chan_a
))
{
...
...
@@ -216,6 +221,19 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
}
}
#ifndef SWITCH_VIDEO_IN_THREADS
if
(
switch_channel_test_flag
(
chan_a
,
CF_VIDEO
)
&&
switch_channel_test_flag
(
chan_b
,
CF_VIDEO
))
{
/* read video from 1 channel and write it to the other */
status
=
switch_core_session_read_video_frame
(
session_a
,
&
read_frame
,
-
1
,
0
);
if
(
!
SWITCH_READ_ACCEPTABLE
(
status
))
{
break
;
}
switch_core_session_write_video_frame
(
session_b
,
read_frame
,
-
1
,
0
);
}
#endif
/* read audio from 1 channel and write it to the other */
status
=
switch_core_session_read_frame
(
session_a
,
&
read_frame
,
-
1
,
stream_id
);
...
...
@@ -237,6 +255,7 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
}
}
#ifdef SWITCH_VIDEO_IN_THREADS
if
(
vh
.
up
)
{
vh
.
up
=
-
1
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Ending video thread.
\n
"
);
...
...
@@ -244,6 +263,7 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
switch_yield
(
100000
);
}
}
#endif
if
(
switch_channel_get_state
(
chan_b
)
>=
CS_HANGUP
)
{
...
...
src/switch_rtp.c
浏览文件 @
b100a406
...
...
@@ -1040,7 +1040,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
while
(
switch_rtp_ready
(
rtp_session
))
{
bytes
=
sizeof
(
rtp_msg_t
);
status
=
switch_socket_recvfrom
(
rtp_session
->
from_addr
,
rtp_session
->
sock
,
0
,
(
void
*
)
&
rtp_session
->
recv_msg
,
&
bytes
);
if
(
!
SWITCH_STATUS_IS_BREAK
(
status
)
&&
rtp_session
->
timer
.
interval
)
{
switch_core_timer_step
(
&
rtp_session
->
timer
);
}
...
...
@@ -1151,7 +1151,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
}
bytes
=
jb_frame
->
dlen
+
rtp_header_len
;
rtp_session
->
recv_msg
.
header
.
ts
=
htonl
(
jb_frame
->
ts
);
}
else
if
(
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_USE_TIMER
))
{
/* We're late! We're Late! */
}
else
if
(
!
bytes
&&
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_USE_TIMER
))
{
/* We're late! We're Late! */
uint8_t
*
data
=
(
uint8_t
*
)
rtp_session
->
recv_msg
.
body
;
if
(
!
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_NOBLOCK
)
&&
status
==
SWITCH_STATUS_BREAK
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论