Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
92a66fb1
提交
92a66fb1
authored
9月 30, 2014
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
improve adaptive jitter buffer ascending check
上级
56edfc70
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
43 行增加
和
17 行删除
+43
-17
switch_stfu.h
src/include/switch_stfu.h
+2
-1
switch_stfu.c
src/switch_stfu.c
+41
-16
没有找到文件。
src/include/switch_stfu.h
浏览文件 @
92a66fb1
...
...
@@ -181,7 +181,8 @@ typedef void (*stfu_n_call_me_t)(stfu_instance_t *i, void *);
void
stfu_n_report
(
stfu_instance_t
*
i
,
stfu_report_t
*
r
);
void
stfu_n_destroy
(
stfu_instance_t
**
i
);
stfu_instance_t
*
stfu_n_init
(
uint32_t
qlen
,
uint32_t
max_qlen
,
uint32_t
samples_per_packet
,
uint32_t
samples_per_second
,
uint32_t
max_drift_ms
);
stfu_status_t
stfu_n_resize
(
stfu_instance_t
*
i
,
uint32_t
qlen
);
stfu_status_t
_stfu_n_resize
(
stfu_instance_t
*
i
,
int32_t
qlen
,
int
line
);
#define stfu_n_resize(_i, _ql) _stfu_n_resize(_i, _ql, __LINE__)
stfu_status_t
stfu_n_add_data
(
stfu_instance_t
*
i
,
uint32_t
ts
,
uint16_t
seq
,
uint32_t
pt
,
void
*
data
,
size_t
datalen
,
uint32_t
timer_ts
,
int
last
);
stfu_frame_t
*
stfu_n_read_a_frame
(
stfu_instance_t
*
i
);
SWITCH_DECLARE
(
int32_t
)
stfu_n_copy_next_frame
(
stfu_instance_t
*
jb
,
uint32_t
timestamp
,
uint16_t
seq
,
uint16_t
distance
,
stfu_frame_t
*
next_frame
);
...
...
src/switch_stfu.c
浏览文件 @
92a66fb1
...
...
@@ -31,6 +31,9 @@
//#define DB_JB 1
#define DBG_IN 1
#define DBG_OUT 2
#ifndef UINT_MAX
# define UINT_MAX 4294967295U
#endif
...
...
@@ -230,8 +233,20 @@ void stfu_n_debug(stfu_instance_t *i, const char *name)
if
(
i
->
name
)
free
(
i
->
name
);
if
(
name
)
{
int
debug
=
0
;
if
(
strstr
(
name
,
":out"
))
{
debug
|=
DBG_OUT
;
}
if
(
strstr
(
name
,
":in"
))
{
debug
|=
DBG_IN
;
}
if
(
debug
)
i
->
debug
=
debug
;
else
i
->
debug
=
3
;
i
->
name
=
strdup
(
name
);
i
->
debug
=
1
;
}
else
{
i
->
name
=
strdup
(
"none"
);
i
->
debug
=
0
;
...
...
@@ -250,14 +265,17 @@ void stfu_n_report(stfu_instance_t *i, stfu_report_t *r)
r
->
period_missing_percent
=
i
->
period_missing_percent
;
}
stfu_status_t
stfu_n_resize
(
stfu_instance_t
*
i
,
uint32_t
qlen
)
stfu_status_t
_stfu_n_resize
(
stfu_instance_t
*
i
,
int32_t
qlen
,
int
line
)
{
stfu_status_t
s
;
uint32_t
incr
=
qlen
;
if
(
i
->
qlen
==
i
->
max_qlen
)
{
return
STFU_IT_FAILED
;
}
qlen
=
i
->
qlen
+
incr
;
if
(
i
->
max_qlen
&&
qlen
>
i
->
max_qlen
)
{
if
(
i
->
qlen
<
i
->
max_qlen
)
{
qlen
=
i
->
max_qlen
;
...
...
@@ -266,6 +284,10 @@ stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen)
}
}
if
(
stfu_log
!=
null_logger
&&
i
->
debug
)
{
stfu_log
(
STFU_LOG_EMERG
,
"%d %s resize %s %u %u
\n
"
,
line
,
i
->
name
,
incr
>
0
?
"up"
:
"down"
,
i
->
qlen
,
i
->
qlen
+
incr
);
}
if
((
s
=
stfu_n_resize_aqueue
(
&
i
->
a_queue
,
qlen
))
==
STFU_IT_WORKED
)
{
stfu_n_resize_aqueue
(
&
i
->
b_queue
,
qlen
);
s
=
stfu_n_resize_aqueue
(
&
i
->
c_queue
,
qlen
);
...
...
@@ -278,6 +300,14 @@ stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen)
i
->
last_frame
=
NULL
;
}
if
(
s
==
STFU_IT_WORKED
)
{
if
(
incr
<
0
)
{
stfu_n_sync
(
i
,
i
->
qlen
);
}
else
{
stfu_n_reset_counters
(
i
);
}
}
return
s
;
}
...
...
@@ -481,6 +511,7 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint16_t seq, uin
if
(
++
i
->
drift_dropped_packets
<
i
->
drift_max_dropped
)
{
stfu_log
(
STFU_LOG_EMERG
,
"%s TOO LATE !!! %u
\n\n\n
"
,
i
->
name
,
ts
);
stfu_n_reset
(
i
);
stfu_n_resize
(
i
,
1
);
//stfu_n_sync(i, 1);
//return STFU_ITS_TOO_LATE;
}
...
...
@@ -504,6 +535,7 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint16_t seq, uin
if
(
stfu_log
!=
null_logger
&&
i
->
debug
)
{
stfu_log
(
STFU_LOG_EMERG
,
"%s TOO LATE !!! %u
\n\n\n
"
,
i
->
name
,
ts
);
}
stfu_n_resize
(
i
,
1
);
stfu_n_sync
(
i
,
1
);
return
STFU_ITS_TOO_LATE
;
}
...
...
@@ -521,13 +553,8 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint16_t seq, uin
i
->
period_need_range_avg
=
i
->
period_need_range
/
least1
(
i
->
period_missing_count
);
if
(
i
->
period_missing_count
>
i
->
qlen
*
2
)
{
if
(
stfu_log
!=
null_logger
&&
i
->
debug
)
{
stfu_log
(
STFU_LOG_EMERG
,
"%s resize up %u %u
\n
"
,
i
->
name
,
i
->
qlen
,
i
->
qlen
+
1
);
}
stfu_n_resize
(
i
,
i
->
qlen
+
1
);
stfu_n_reset_counters
(
i
);
stfu_n_resize
(
i
,
1
);
}
i
->
diff
=
0
;
...
...
@@ -551,18 +578,16 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint16_t seq, uin
stfu_log
(
STFU_LOG_EMERG
,
"PERIOD %f jitter missing:%f q:%d/%d
\n
"
,
i
->
period_jitter_percent
,
i
->
period_missing_percent
,
i
->
qlen
,
i
->
orig_qlen
);
}
if
(
i
->
qlen
>
i
->
orig_qlen
&&
i
->
period_jitter_percent
<
PERIOD_JITTER_TOLERANCE
&&
i
->
period_missing_percent
<
PERIOD_JITTER_TOLERANCE
)
{
if
(
stfu_log
!=
null_logger
&&
i
->
debug
)
{
stfu_
log
(
STFU_LOG_EMERG
,
"%s resize down %u %u
\n
"
,
i
->
name
,
i
->
qlen
,
i
->
qlen
-
1
);
if
(
i
->
qlen
>
i
->
orig_qlen
)
{
if
(
i
->
period_jitter_percent
<
PERIOD_JITTER_TOLERANCE
&&
i
->
period_missing_percent
<
PERIOD_JITTER_TOLERANCE
)
{
stfu_
n_resize
(
i
,
-
1
);
}
stfu_n_resize
(
i
,
i
->
qlen
-
1
);
stfu_n_sync
(
i
,
i
->
qlen
);
}
stfu_n_reset_counters
(
i
);
}
if
(
stfu_log
!=
null_logger
&&
i
->
debug
)
{
if
(
stfu_log
!=
null_logger
&&
(
i
->
debug
&
DBG_IN
)
)
{
double
jitter_percent
=
(
double
)(((
double
)
i
->
period_jitter_count
/
(
double
)
i
->
period_packet_in_count
)
*
100
.
0
f
);
double
missing_percent
=
(
double
)(((
double
)
i
->
period_missing_count
/
(
double
)
i
->
period_packet_in_count
)
*
100
.
0
f
);
...
...
@@ -808,9 +833,9 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i)
}
}
if
(
stfu_log
!=
null_logger
&&
i
->
debug
)
{
if
(
stfu_log
!=
null_logger
&&
(
i
->
debug
&
DBG_OUT
)
)
{
if
(
found
)
{
stfu_log
(
STFU_LOG_EMERG
,
"
%s OUT:
%u:%u %u
\n
"
,
i
->
name
,
rframe
->
ts
,
rframe
->
ts
/
i
->
samples_per_packet
,
rframe
->
plc
);
stfu_log
(
STFU_LOG_EMERG
,
"
O: %s
%u:%u %u
\n
"
,
i
->
name
,
rframe
->
ts
,
rframe
->
ts
/
i
->
samples_per_packet
,
rframe
->
plc
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论