Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
44e79295
提交
44e79295
authored
11月 15, 2014
作者:
Anthony Minessale
提交者:
Michael Jerris
5月 28, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7500: revert earlier bridge change
上级
3c29d4e8
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
1 行增加
和
131 行删除
+1
-131
switch_types.h
src/include/switch_types.h
+0
-1
switch_core_media.c
src/switch_core_media.c
+1
-115
switch_ivr_bridge.c
src/switch_ivr_bridge.c
+0
-15
没有找到文件。
src/include/switch_types.h
浏览文件 @
44e79295
...
...
@@ -1447,7 +1447,6 @@ typedef enum {
CF_VIDEO_BREAK
,
CF_AUDIO_PAUSE
,
CF_VIDEO_PAUSE
,
CF_VIDEO_BRIDGE
,
CF_BYPASS_MEDIA_AFTER_HOLD
,
CF_HANGUP_HELD
,
CF_CONFERENCE_RESET_MEDIA
,
...
...
src/switch_core_media.c
浏览文件 @
44e79295
...
...
@@ -4407,112 +4407,6 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session
return
changed
;
}
#define BUF_SIZE (352 * 288 * 3 / 2 * 4) // big enough for 4CIF, looks like C doesn't like huge array
#define FPS 15
static
switch_status_t
video_bridge_callback
(
switch_core_session_t
*
session
,
switch_bool_t
video_transcoding
,
uint32_t
*
ts
)
{
switch_frame_t
*
read_frame
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
switch_core_session_t
*
session_b
=
switch_channel_get_private
(
session
->
channel
,
"_video_bridged_session_"
);
switch_codec_t
*
codec
,
*
other_codec
;
status
=
switch_core_session_read_video_frame
(
session
,
&
read_frame
,
SWITCH_IO_FLAG_NONE
,
0
);
if
(
!
SWITCH_READ_ACCEPTABLE
(
status
))
{
switch_cond_next
();
return
status
;
}
if
(
switch_channel_test_flag
(
session
->
channel
,
CF_VIDEO_REFRESH_REQ
))
{
switch_core_session_refresh_video
(
session
);
switch_channel_clear_flag
(
session
->
channel
,
CF_VIDEO_REFRESH_REQ
);
}
if
(
switch_test_flag
(
read_frame
,
SFF_CNG
))
{
return
status
;
}
if
(
!
session_b
||
!
switch_channel_up_nosig
(
session_b
->
channel
))
{
// echo and return
switch_core_session_write_video_frame
(
session
,
read_frame
,
SWITCH_IO_FLAG_NONE
,
0
);
return
status
;
}
codec
=
read_frame
->
codec
;
other_codec
=
session_b
->
video_write_codec
;
if
(
codec
->
implementation
->
impl_id
==
other_codec
->
implementation
->
impl_id
)
{
switch_core_session_write_video_frame
(
session_b
,
read_frame
,
SWITCH_IO_FLAG_NONE
,
0
);
return
status
;
}
if
(
!
video_transcoding
)
{
// echo back
switch_core_session_write_video_frame
(
session
,
read_frame
,
SWITCH_IO_FLAG_NONE
,
0
);
return
status
;
}
else
{
uint8_t
rtp_buff
[
1500
]
=
{
0
};
uint32_t
flag
=
0
;
uint32_t
encoded_data_len
=
1500
;
switch_frame_t
write_frame
=
{
0
};
switch_image_t
*
img
=
NULL
;
#if 0
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%d/%s != %d/%s need transcoding!!!\n",
codec->implementation->impl_id, codec->implementation->iananame,
other_codec->implementation->impl_id, other_codec->implementation->iananame);
#endif
// uncomment to test only one leg
// if (!strcmp(codec->implementation->iananame, "VP8")) return status;
// if (!strcmp(codec->implementation->iananame, "H264")) return status;
switch_core_codec_decode_video
(
codec
,
read_frame
,
&
img
,
&
flag
);
if
(
!
img
)
return
SWITCH_STATUS_SUCCESS
;
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s decoded_data_len: %d size: %dx%d\n", codec->implementation->iananame, decoded_data_len, codec->dec_picture.width, codec->dec_picture.height);
write_frame
.
packet
=
rtp_buff
;
write_frame
.
data
=
rtp_buff
+
12
;
encoded_data_len
=
1500
;
switch_core_codec_encode_video
(
other_codec
,
img
,
rtp_buff
+
12
,
&
encoded_data_len
,
&
flag
);
while
(
encoded_data_len
)
{
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "encoded: %s [%d] flag=%d ts=%u\n", other_codec->implementation->iananame, encoded_data_len, flag, *ts);
write_frame
.
datalen
=
encoded_data_len
;
write_frame
.
packetlen
=
write_frame
.
datalen
+
12
;
write_frame
.
m
=
flag
&
SFF_MARKER
?
1
:
0
;
write_frame
.
timestamp
=
*
ts
;
if
(
write_frame
.
m
)
*
ts
+=
90000
/
FPS
;
if
(
1
)
{
/* set correct mark and ts */
switch_rtp_hdr_t
*
rtp
=
(
switch_rtp_hdr_t
*
)
write_frame
.
packet
;
memset
(
rtp
,
0
,
12
);
rtp
->
version
=
2
;
rtp
->
m
=
write_frame
.
m
;
rtp
->
ts
=
htonl
(
write_frame
.
timestamp
);
rtp
->
ssrc
=
(
uint32_t
)
((
intptr_t
)
rtp
+
(
uint32_t
)
switch_epoch_time_now
(
NULL
));
switch_set_flag
(
&
write_frame
,
SFF_RAW_RTP
);
}
// switch_rtp_set_flag(session_b->media_handle->engines[SWITCH_MEDIA_TYPE_VIDEO].rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_WRITE);
switch_rtp_set_flag
(
session_b
->
media_handle
->
engines
[
SWITCH_MEDIA_TYPE_VIDEO
].
rtp_session
,
SWITCH_RTP_FLAG_RAW_WRITE
);
switch_core_session_write_video_frame
(
session_b
,
&
write_frame
,
SWITCH_IO_FLAG_NONE
,
0
);
encoded_data_len
=
1500
;
switch_core_codec_encode_video
(
other_codec
,
NULL
,
rtp_buff
+
12
,
&
encoded_data_len
,
&
flag
);
}
}
return
status
;
}
static
void
*
SWITCH_THREAD_FUNC
video_helper_thread
(
switch_thread_t
*
thread
,
void
*
obj
)
{
struct
media_helper
*
mh
=
obj
;
...
...
@@ -4521,8 +4415,6 @@ 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
rtp_ts
=
0
;
switch_bool_t
video_transcoding
=
SWITCH_FALSE
;
if
(
!
(
smh
=
session
->
media_handle
))
{
return
NULL
;
...
...
@@ -4536,7 +4428,6 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s Video thread started. Echo is %s
\n
"
,
switch_channel_get_name
(
session
->
channel
),
switch_channel_test_flag
(
channel
,
CF_VIDEO_ECHO
)
?
"on"
:
"off"
);
switch_core_session_refresh_video
(
session
);
video_transcoding
=
switch_true
(
switch_channel_get_variable
(
channel
,
"video_transcoding"
));
while
(
switch_channel_up_nosig
(
channel
))
{
...
...
@@ -4547,7 +4438,6 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s Video thread resumed Echo is %s
\n
"
,
switch_channel_get_name
(
session
->
channel
),
switch_channel_test_flag
(
channel
,
CF_VIDEO_ECHO
)
?
"on"
:
"off"
);
switch_core_session_refresh_video
(
session
);
video_transcoding
=
switch_true
(
switch_channel_get_variable
(
channel
,
"video_transcoding"
));
}
if
(
switch_channel_test_flag
(
channel
,
CF_VIDEO_PASSIVE
))
{
...
...
@@ -4559,11 +4449,7 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
continue
;
}
if
(
switch_channel_test_flag
(
channel
,
CF_VIDEO_BRIDGE
))
{
video_bridge_callback
(
session
,
video_transcoding
,
&
rtp_ts
);
continue
;
}
status
=
switch_core_session_read_video_frame
(
session
,
&
read_frame
,
SWITCH_IO_FLAG_NONE
,
0
);
if
(
!
SWITCH_READ_ACCEPTABLE
(
status
))
{
...
...
src/switch_ivr_bridge.c
浏览文件 @
44e79295
...
...
@@ -46,7 +46,6 @@ struct vid_helper {
int
up
;
};
#if 0
static
void
*
SWITCH_THREAD_FUNC
video_bridge_thread
(
switch_thread_t
*
thread
,
void
*
obj
)
{
struct
vid_helper
*
vh
=
obj
;
...
...
@@ -109,17 +108,9 @@ static void *SWITCH_THREAD_FUNC video_bridge_thread(switch_thread_t *thread, voi
vh
->
up
=
0
;
return
NULL
;
}
#endif
static
switch_thread_t
*
launch_video
(
struct
vid_helper
*
vh
)
{
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
vh
->
session_a
);
switch_channel_set_private
(
channel
,
"_video_bridged_session_"
,
vh
->
session_b
);
switch_channel_set_flag
(
channel
,
CF_VIDEO_BRIDGE
);
return
NULL
;
#if 0
switch_thread_t
*
thread
;
switch_threadattr_t
*
thd_attr
=
NULL
;
...
...
@@ -127,8 +118,6 @@ static switch_thread_t *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
));
return
thread
;
#endif
}
#endif
...
...
@@ -601,10 +590,6 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
end_of_bridge_loop:
#ifdef SWITCH_VIDEO_IN_THREADS
switch_channel_clear_flag
(
chan_a
,
CF_VIDEO_BRIDGE
);
switch_channel_clear_flag
(
chan_b
,
CF_VIDEO_BRIDGE
);
if
(
vid_thread
)
{
vh
.
up
=
-
1
;
switch_channel_set_flag
(
chan_a
,
CF_NOT_READY
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论