Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
8f091050
提交
8f091050
authored
12月 03, 2014
作者:
Anthony Minessale
提交者:
Michael Jerris
5月 28, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7500: add keyframe req and session refresh req debounce
上级
91602e9c
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
67 行增加
和
36 行删除
+67
-36
switch_core_media.c
src/switch_core_media.c
+67
-9
switch_core_session.c
src/switch_core_session.c
+0
-27
没有找到文件。
src/switch_core_media.c
浏览文件 @
8f091050
...
@@ -48,6 +48,7 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess
...
@@ -48,6 +48,7 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess
#define MAX_CODEC_CHECK_FRAMES 50//x:mod_sofia.h
#define MAX_CODEC_CHECK_FRAMES 50//x:mod_sofia.h
#define MAX_MISMATCH_FRAMES 5//x:mod_sofia.h
#define MAX_MISMATCH_FRAMES 5//x:mod_sofia.h
#define type2str(type) type == SWITCH_MEDIA_TYPE_VIDEO ? "video" : "audio"
#define type2str(type) type == SWITCH_MEDIA_TYPE_VIDEO ? "video" : "audio"
#define VIDEO_REFRESH_FREQ 1000000
typedef
enum
{
typedef
enum
{
SMF_INIT
=
(
1
<<
0
),
SMF_INIT
=
(
1
<<
0
),
...
@@ -159,7 +160,6 @@ typedef struct switch_rtp_engine_s {
...
@@ -159,7 +160,6 @@ typedef struct switch_rtp_engine_s {
}
switch_rtp_engine_t
;
}
switch_rtp_engine_t
;
struct
switch_media_handle_s
{
struct
switch_media_handle_s
{
switch_core_session_t
*
session
;
switch_core_session_t
*
session
;
switch_channel_t
*
channel
;
switch_channel_t
*
channel
;
...
@@ -196,6 +196,8 @@ struct switch_media_handle_s {
...
@@ -196,6 +196,8 @@ struct switch_media_handle_s {
switch_rtp_crypto_key_type_t
crypto_suite_order
[
CRYPTO_INVALID
+
1
];
switch_rtp_crypto_key_type_t
crypto_suite_order
[
CRYPTO_INVALID
+
1
];
switch_time_t
video_last_key_time
;
switch_time_t
video_last_key_time
;
switch_time_t
video_init
;
switch_time_t
video_init
;
switch_time_t
last_codec_refresh
;
switch_time_t
last_video_refresh_req
;
switch_timer_t
video_timer
;
switch_timer_t
video_timer
;
switch_video_function_t
video_function
;
switch_video_function_t
video_function
;
void
*
video_user_data
;
void
*
video_user_data
;
...
@@ -9539,6 +9541,48 @@ SWITCH_DECLARE(switch_timer_t *) switch_core_media_get_timer(switch_core_session
...
@@ -9539,6 +9541,48 @@ SWITCH_DECLARE(switch_timer_t *) switch_core_media_get_timer(switch_core_session
}
}
SWITCH_DECLARE
(
switch_status_t
)
switch_core_session_refresh_video
(
switch_core_session_t
*
session
)
{
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_media_handle_t
*
smh
=
NULL
;
switch_assert
(
session
);
if
(
!
(
smh
=
session
->
media_handle
))
{
return
SWITCH_STATUS_FALSE
;
}
if
(
switch_channel_test_flag
(
channel
,
CF_VIDEO
))
{
switch_core_session_message_t
msg
=
{
0
};
switch_time_t
now
=
switch_micro_time_now
();
if
(
smh
->
last_video_refresh_req
&&
(
now
-
smh
->
last_video_refresh_req
)
<
VIDEO_REFRESH_FREQ
)
{
return
SWITCH_STATUS_BREAK
;
}
smh
->
last_video_refresh_req
=
now
;
msg
.
from
=
__FILE__
;
msg
.
message_id
=
SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ
;
switch_core_session_receive_message
(
session
,
&
msg
);
return
SWITCH_STATUS_SUCCESS
;
}
return
SWITCH_STATUS_FALSE
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_core_session_refresh_video_both_ways
(
switch_core_session_t
*
session
)
{
if
(
switch_channel_test_flag
(
session
->
channel
,
CF_VIDEO
))
{
switch_core_session_refresh_video
(
session
);
switch_core_media_gen_key_frame
(
session
);
return
SWITCH_STATUS_SUCCESS
;
}
return
SWITCH_STATUS_FALSE
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_core_media_codec_control
(
switch_core_session_t
*
session
,
SWITCH_DECLARE
(
switch_status_t
)
switch_core_media_codec_control
(
switch_core_session_t
*
session
,
switch_media_type_t
mtype
,
switch_media_type_t
mtype
,
switch_io_type_t
iotype
,
switch_io_type_t
iotype
,
...
@@ -9575,6 +9619,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_codec_control(switch_core_sess
...
@@ -9575,6 +9619,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_codec_control(switch_core_sess
}
}
if
(
codec
)
{
if
(
codec
)
{
if
(
cmd
==
SCC_VIDEO_REFRESH
)
{
switch_time_t
now
=
switch_micro_time_now
();
if
(
smh
->
last_codec_refresh
&&
(
now
-
smh
->
last_codec_refresh
)
<
VIDEO_REFRESH_FREQ
)
{
return
SWITCH_STATUS_BREAK
;
}
smh
->
last_codec_refresh
=
now
;
}
return
switch_core_codec_control
(
codec
,
cmd
,
ctype
,
cmd_data
,
rtype
,
ret_data
);
return
switch_core_codec_control
(
codec
,
cmd
,
ctype
,
cmd_data
,
rtype
,
ret_data
);
}
}
...
@@ -9761,14 +9814,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
...
@@ -9761,14 +9814,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
}
}
if
(
switch_channel_test_flag
(
session
->
channel
,
CF_VIDEO_DEBUG_READ
))
{
if
(
switch_channel_test_flag
(
session
->
channel
,
CF_VIDEO_DEBUG_READ
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"seq: %d ts: %ld len: %4d %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x mark: %d %s
\n
"
,
if
(
switch_test_flag
((
*
frame
),
SFF_CNG
))
{
(
*
frame
)
->
seq
,
(
*
frame
)
->
timestamp
,
(
*
frame
)
->
datalen
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"VIDEO: CNG
\n
"
);
*
((
uint8_t
*
)(
*
frame
)
->
data
),
*
((
uint8_t
*
)(
*
frame
)
->
data
+
1
),
}
else
{
*
((
uint8_t
*
)(
*
frame
)
->
data
+
2
),
*
((
uint8_t
*
)(
*
frame
)
->
data
+
3
),
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
*
((
uint8_t
*
)(
*
frame
)
->
data
+
4
),
*
((
uint8_t
*
)(
*
frame
)
->
data
+
5
),
"VIDEO: seq: %d ts: %ld len: %4d %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x mark: %d
\n
"
,
*
((
uint8_t
*
)(
*
frame
)
->
data
+
6
),
*
((
uint8_t
*
)(
*
frame
)
->
data
+
7
),
(
*
frame
)
->
seq
,
(
*
frame
)
->
timestamp
,
(
*
frame
)
->
datalen
,
*
((
uint8_t
*
)(
*
frame
)
->
data
+
8
),
*
((
uint8_t
*
)(
*
frame
)
->
data
+
9
),
*
((
uint8_t
*
)(
*
frame
)
->
data
),
*
((
uint8_t
*
)(
*
frame
)
->
data
+
1
),
*
((
uint8_t
*
)(
*
frame
)
->
data
+
10
),
(
*
frame
)
->
m
,
switch_test_flag
((
*
frame
),
SFF_CNG
)
?
" CNG"
:
""
);
*
((
uint8_t
*
)(
*
frame
)
->
data
+
2
),
*
((
uint8_t
*
)(
*
frame
)
->
data
+
3
),
*
((
uint8_t
*
)(
*
frame
)
->
data
+
4
),
*
((
uint8_t
*
)(
*
frame
)
->
data
+
5
),
*
((
uint8_t
*
)(
*
frame
)
->
data
+
6
),
*
((
uint8_t
*
)(
*
frame
)
->
data
+
7
),
*
((
uint8_t
*
)(
*
frame
)
->
data
+
8
),
*
((
uint8_t
*
)(
*
frame
)
->
data
+
9
),
*
((
uint8_t
*
)(
*
frame
)
->
data
+
10
),
(
*
frame
)
->
m
);
}
}
}
...
...
src/switch_core_session.c
浏览文件 @
8f091050
...
@@ -3048,33 +3048,6 @@ SWITCH_DECLARE(switch_log_level_t) switch_core_session_get_loglevel(switch_core_
...
@@ -3048,33 +3048,6 @@ SWITCH_DECLARE(switch_log_level_t) switch_core_session_get_loglevel(switch_core_
return
session
->
loglevel
;
return
session
->
loglevel
;
}
}
SWITCH_DECLARE
(
switch_status_t
)
switch_core_session_refresh_video
(
switch_core_session_t
*
session
)
{
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
if
(
switch_channel_test_flag
(
channel
,
CF_VIDEO
))
{
switch_core_session_message_t
msg
=
{
0
};
msg
.
from
=
__FILE__
;
msg
.
message_id
=
SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ
;
switch_core_session_receive_message
(
session
,
&
msg
);
return
SWITCH_STATUS_SUCCESS
;
}
return
SWITCH_STATUS_FALSE
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_core_session_refresh_video_both_ways
(
switch_core_session_t
*
session
)
{
if
(
switch_channel_test_flag
(
session
->
channel
,
CF_VIDEO
))
{
switch_core_session_refresh_video
(
session
);
switch_core_media_gen_key_frame
(
session
);
return
SWITCH_STATUS_SUCCESS
;
}
return
SWITCH_STATUS_FALSE
;
}
SWITCH_DECLARE
(
void
)
switch_core_session_debug_pool
(
switch_stream_handle_t
*
stream
)
SWITCH_DECLARE
(
void
)
switch_core_session_debug_pool
(
switch_stream_handle_t
*
stream
)
{
{
stream
->
write_function
(
stream
,
"Thread pool: running:%d busy:%d popping:%d
\n
"
,
stream
->
write_function
(
stream
,
"Thread pool: running:%d busy:%d popping:%d
\n
"
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论