Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
45494ab2
提交
45494ab2
authored
9月 18, 2015
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-8130 more refactoring
上级
d8e7897f
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
52 行增加
和
28 行删除
+52
-28
switch_jitterbuffer.c
src/switch_jitterbuffer.c
+34
-10
switch_rtp.c
src/switch_rtp.c
+18
-18
没有找到文件。
src/switch_jitterbuffer.c
浏览文件 @
45494ab2
...
...
@@ -402,6 +402,26 @@ static inline uint32_t jb_find_highest_ts(switch_jb_t *jb)
}
#endif
static
inline
switch_jb_node_t
*
jb_find_penultimate_node
(
switch_jb_t
*
jb
)
{
switch_jb_node_t
*
np
,
*
highest
=
NULL
,
*
second_highest
=
NULL
;
switch_mutex_lock
(
jb
->
list_mutex
);
for
(
np
=
jb
->
node_list
;
np
;
np
=
np
->
next
)
{
if
(
!
np
->
visible
)
continue
;
if
(
!
highest
||
ntohl
(
highest
->
packet
.
header
.
ts
)
<
ntohl
(
np
->
packet
.
header
.
ts
))
{
if
(
highest
)
second_highest
=
highest
;
highest
=
np
;
}
}
switch_mutex_unlock
(
jb
->
list_mutex
);
return
second_highest
?
second_highest
:
highest
;
}
static
inline
void
jb_hit
(
switch_jb_t
*
jb
)
{
jb
->
period_good_count
++
;
...
...
@@ -480,9 +500,9 @@ static inline void jb_miss(switch_jb_t *jb)
jb
->
consec_good_count
=
0
;
}
static
inline
int
verify_
oldest
_frame
(
switch_jb_t
*
jb
)
static
inline
int
verify_
penultimate
_frame
(
switch_jb_t
*
jb
)
{
switch_jb_node_t
*
lowest
=
jb_find_
lowest
_node
(
jb
),
*
np
=
NULL
;
switch_jb_node_t
*
lowest
=
jb_find_
penultimate
_node
(
jb
),
*
np
=
NULL
;
int
r
=
0
;
if
(
!
lowest
||
!
(
lowest
=
jb_find_lowest_seq
(
jb
,
lowest
->
packet
.
header
.
ts
)))
{
...
...
@@ -511,9 +531,9 @@ static inline int verify_oldest_frame(switch_jb_t *jb)
end:
if
(
!
r
&&
jb
->
session
)
{
switch_core_session_request_video_refresh
(
jb
->
session
);
}
//
if (!r && jb->session) {
//
switch_core_session_request_video_refresh(jb->session);
//
}
return
r
;
}
...
...
@@ -572,7 +592,7 @@ static inline void add_node(switch_jb_t *jb, switch_rtp_packet_t *packet, switch
jb
->
complete_frames
++
;
jb_debug
(
jb
,
2
,
"WRITE frame ts: %u complete=%u/%u n:%u
\n
"
,
ntohl
(
node
->
packet
.
header
.
ts
),
jb
->
complete_frames
,
jb
->
frame_len
,
jb
->
visible_nodes
);
jb
->
highest_wrote_ts
=
packet
->
header
.
ts
;
verify_
oldest
_frame
(
jb
);
verify_
penultimate
_frame
(
jb
);
}
else
if
(
!
jb
->
write_init
)
{
jb
->
highest_wrote_ts
=
packet
->
header
.
ts
;
}
...
...
@@ -653,9 +673,9 @@ static inline switch_status_t jb_next_packet_by_seq(switch_jb_t *jb, switch_jb_n
if
(
jb
->
type
==
SJB_VIDEO
)
{
int
x
;
if
(
jb
->
session
)
{
switch_core_session_request_video_refresh
(
jb
->
session
);
}
//
if (jb->session) {
//
switch_core_session_request_video_refresh(jb->session);
//
}
for
(
x
=
0
;
x
<
10
;
x
++
)
{
increment_seq
(
jb
);
...
...
@@ -785,6 +805,10 @@ SWITCH_DECLARE(void) switch_jb_reset(switch_jb_t *jb)
switch_core_inthash_destroy
(
&
jb
->
missing_seq_hash
);
switch_core_inthash_init
(
&
jb
->
missing_seq_hash
);
switch_mutex_unlock
(
jb
->
mutex
);
if
(
jb
->
session
)
{
switch_core_session_request_video_refresh
(
jb
->
session
);
}
}
jb_debug
(
jb
,
2
,
"%s"
,
"RESET BUFFER
\n
"
);
...
...
@@ -1187,7 +1211,7 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
switch_mutex_unlock
(
jb
->
mutex
);
if
(
status
==
SWITCH_STATUS_SUCCESS
)
{
if
(
status
==
SWITCH_STATUS_SUCCESS
&&
jb
->
type
==
SJB_AUDIO
)
{
if
(
jb
->
complete_frames
>
jb
->
max_frame_len
)
{
drop_oldest_frame
(
jb
);
}
...
...
src/switch_rtp.c
浏览文件 @
45494ab2
...
...
@@ -1895,14 +1895,14 @@ static int using_ice(switch_rtp_t *rtp_session)
return
0
;
}
#define MAX_NACK 1
0
#define MAX_NACK 1
static
int
check_rtcp_and_ice
(
switch_rtp_t
*
rtp_session
)
{
int
ret
=
0
;
int
rtcp_ok
=
0
,
rtcp_fb
=
0
;
switch_time_t
now
=
switch_micro_time_now
();
int
rate
=
0
,
nack_ttl
=
0
;
uint32_t
cur_nack
[
MAX_NACK
];
uint32_t
cur_nack
[
MAX_NACK
]
=
{
0
}
;
if
(
rtp_session
->
flags
[
SWITCH_RTP_FLAG_AUTO_CNG
]
&&
rtp_session
->
send_msg
.
header
.
ts
&&
rtp_session
->
cng_pt
!=
INVALID_PT
&&
(
rtp_session
->
timer
.
samplecount
-
rtp_session
->
last_write_samplecount
>=
rtp_session
->
samples_per_interval
*
60
))
{
...
...
@@ -7031,31 +7031,31 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
}
if
(
!
rtp_session
->
ts_norm
.
last_ssrc
||
send_msg
->
header
.
ssrc
!=
rtp_session
->
ts_norm
.
last_ssrc
)
{
#define USE_DELTA
#ifdef USE_DELTA
if
(
rtp_session
->
ts_norm
.
last_ssrc
)
{
rtp_session
->
ts_norm
.
delta_ct
=
1
;
rtp_session
->
ts_norm
.
delta_ttl
=
0
;
if
(
rtp_session
->
ts_norm
.
delta
)
{
rtp_session
->
ts_norm
.
ts
+=
rtp_session
->
ts_norm
.
delta
;
if
(
switch_rtp_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_GEN_TS_DELTA
))
{
if
(
rtp_session
->
ts_norm
.
last_ssrc
)
{
rtp_session
->
ts_norm
.
delta_ct
=
1
;
rtp_session
->
ts_norm
.
delta_ttl
=
0
;
if
(
rtp_session
->
ts_norm
.
delta
)
{
rtp_session
->
ts_norm
.
ts
+=
rtp_session
->
ts_norm
.
delta
;
}
}
}
#endif
rtp_session
->
ts_norm
.
last_ssrc
=
send_msg
->
header
.
ssrc
;
rtp_session
->
ts_norm
.
last_frame
=
ntohl
(
send_msg
->
header
.
ts
);
}
if
(
ntohl
(
send_msg
->
header
.
ts
)
!=
rtp_session
->
ts_norm
.
last_frame
)
{
#ifdef USE_DELTA
int32_t
delta
=
(
int32_t
)
(
ntohl
(
send_msg
->
header
.
ts
)
-
rtp_session
->
ts_norm
.
last_frame
);
if
(
switch_rtp_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_GEN_TS_DELTA
))
{
int32_t
delta
=
(
int32_t
)
(
ntohl
(
send_msg
->
header
.
ts
)
-
rtp_session
->
ts_norm
.
last_frame
);
rtp_session
->
ts_norm
.
delta
=
delta
;
rtp_session
->
ts_norm
.
ts
+=
rtp_session
->
ts_norm
.
delta
;
#else
switch_core_timer_sync
(
&
rtp_session
->
timer
);
rtp_session
->
ts_norm
.
ts
=
rtp_session
->
timer
.
samplecount
;
#endif
rtp_session
->
ts_norm
.
delta
=
delta
;
rtp_session
->
ts_norm
.
ts
+=
rtp_session
->
ts_norm
.
delta
;
}
else
{
switch_core_timer_sync
(
&
rtp_session
->
timer
);
rtp_session
->
ts_norm
.
ts
=
rtp_session
->
timer
.
samplecount
;
}
}
rtp_session
->
ts_norm
.
last_frame
=
ntohl
(
send_msg
->
header
.
ts
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论