Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
7e047c3f
提交
7e047c3f
authored
12月 14, 2010
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more ongoing work on jb
上级
d11c83b1
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
59 行增加
和
22 行删除
+59
-22
stfu.c
libs/stfu/stfu.c
+55
-18
sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_glue.c
+3
-3
switch_rtp.c
src/switch_rtp.c
+1
-1
没有找到文件。
libs/stfu/stfu.c
浏览文件 @
7e047c3f
...
...
@@ -28,6 +28,11 @@
#include "stfu.h"
//#define DB_JB 1
#ifndef UINT_MAX
# define UINT_MAX 4294967295U
#endif
#ifdef _MSC_VER
/* warning C4706: assignment within conditional expression*/
#pragma warning(disable: 4706)
...
...
@@ -123,6 +128,7 @@ static stfu_status_t stfu_n_resize_aqueue(stfu_queue_t *queue, uint32_t qlen)
static
void
stfu_n_init_aqueue
(
stfu_queue_t
*
queue
,
uint32_t
qlen
)
{
queue
->
array
=
calloc
(
qlen
,
sizeof
(
struct
stfu_frame
));
assert
(
queue
->
array
!=
NULL
);
memset
(
queue
->
array
,
0
,
sizeof
(
struct
stfu_frame
)
*
qlen
);
...
...
@@ -166,6 +172,7 @@ stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen)
stfu_status_t
s
;
if
(
i
->
qlen
==
i
->
max_qlen
)
{
printf
(
"FUCKER1
\n
"
);
return
STFU_IT_FAILED
;
}
...
...
@@ -173,6 +180,7 @@ stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen)
if
(
i
->
qlen
<
i
->
max_qlen
)
{
qlen
=
i
->
max_qlen
;
}
else
{
printf
(
"FUCKER2
\n
"
);
return
STFU_IT_FAILED
;
}
}
...
...
@@ -196,6 +204,12 @@ stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_
return
NULL
;
}
memset
(
i
,
0
,
sizeof
(
*
i
));
#ifdef DB_JB
printf
(
"INIT %u %u
\n
"
,
qlen
,
max_qlen
);
#endif
i
->
qlen
=
qlen
;
i
->
max_qlen
=
max_qlen
;
i
->
orig_qlen
=
qlen
;
...
...
@@ -281,10 +295,11 @@ stfu_status_t stfu_n_sync(stfu_instance_t *i, uint32_t packets)
stfu_status_t
stfu_n_add_data
(
stfu_instance_t
*
i
,
uint32_t
ts
,
uint32_t
seq
,
uint32_t
pt
,
void
*
data
,
size_t
datalen
,
int
last
)
{
uint32_t
index
;
uint32_t
index
=
0
;
stfu_frame_t
*
frame
;
size_t
cplen
=
0
;
int
good_seq
=
0
,
good_ts
=
0
;
uint32_t
min_seq
=
UINT_MAX
,
min_ts
=
UINT_MAX
,
min_index
=
0
;
if
(
!
i
->
samples_per_packet
&&
ts
&&
i
->
last_rd_ts
)
{
i
->
ts_diff
=
ts
-
i
->
last_rd_ts
;
...
...
@@ -322,21 +337,20 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t seq, uin
i
->
period_packet_in_count
++
;
i
->
session_packet_in_count
++
;
if
(
i
->
session_packet_in_count
==
150
)
{
return
STFU_IT_WORKED
;
}
i
->
period_need_range_avg
=
i
->
period_need_range
/
(
i
->
period_missing_count
||
1
);
if
(
i
->
period_missing_count
>
i
->
qlen
*
2
)
{
#ifdef DB_JB
printf
(
"resize %u %u
\n
"
,
i
->
qlen
,
i
->
qlen
+
1
);
#endif
stfu_n_resize
(
i
,
i
->
qlen
+
1
);
stfu_n_reset_counters
(
i
);
}
if
(
i
->
qlen
>
i
->
orig_qlen
&&
(
i
->
consecutive_good_count
>
i
->
decrement_time
||
i
->
period_clean_count
>
i
->
decrement_time
))
{
stfu_n_resize
(
i
,
i
->
qlen
-
1
);
stfu_n_reset_counters
(
i
);
stfu_n_sync
(
i
,
i
->
qlen
);
}
else
{
if
(
i
->
qlen
>
i
->
orig_qlen
&&
(
i
->
consecutive_good_count
>
i
->
decrement_time
||
i
->
period_clean_count
>
i
->
decrement_time
))
{
stfu_n_resize
(
i
,
i
->
qlen
-
1
);
stfu_n_reset_counters
(
i
);
stfu_n_sync
(
i
,
i
->
qlen
);
}
}
if
((
i
->
period_packet_in_count
>
i
->
period_time
))
{
...
...
@@ -379,13 +393,31 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t seq, uin
return
STFU_IM_DONE
;
}
for
(
index
=
0
;
index
<
i
->
out_queue
->
array_size
;
index
++
)
{
for
(
index
=
0
;
index
<
i
->
in_queue
->
array_size
;
index
++
)
{
if
(
i
->
in_queue
->
array
[
index
].
was_read
)
{
min_index
=
index
;
break
;
}
if
(
i
->
in_queue
->
array
[
index
].
seq
<
min_seq
)
{
min_seq
=
i
->
in_queue
->
array
[
index
].
seq
;
min_index
=
index
;
}
if
(
i
->
in_queue
->
array
[
index
].
ts
<
min_ts
)
{
min_ts
=
i
->
in_queue
->
array
[
index
].
ts
;
min_index
=
index
;
}
}
index
=
i
->
in_queue
->
array_len
++
;
index
=
min_index
;
if
(
i
->
in_queue
->
array_len
<
i
->
in_queue
->
array_size
)
{
i
->
in_queue
->
array_len
++
;
}
assert
(
index
<
i
->
in_queue
->
array_size
);
frame
=
&
i
->
in_queue
->
array
[
index
];
...
...
@@ -468,7 +500,8 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i)
stfu_frame_t
*
rframe
=
NULL
;
int
found
=
0
;
if
(
!
i
->
samples_per_packet
||
((
i
->
out_queue
->
wr_len
==
i
->
out_queue
->
array_len
)
||
!
i
->
out_queue
->
array_len
))
{
if
(
!
i
->
samples_per_packet
||
!
i
->
out_queue
->
array_len
)
{
//|| ((i->out_queue->wr_len == i->out_queue->array_len) || !i->out_queue->array_len)) {
return
NULL
;
}
...
...
@@ -481,7 +514,11 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i)
if
(
i
->
cur_seq
==
0
)
{
i
->
cur_seq
=
i
->
out_queue
->
array
[
0
].
seq
;
}
else
{
i
->
cur_seq
++
;
i
->
cur_seq
++
;
/* if we bother using this for anything that doesn't have 16 bit seq, we'll make this a param */
if
(
i
->
cur_seq
==
65535
)
{
i
->
cur_seq
=
0
;
}
}
if
(
!
(
found
=
stfu_n_find_frame
(
i
,
i
->
out_queue
,
i
->
cur_ts
,
i
->
cur_seq
,
&
rframe
)))
{
...
...
@@ -496,7 +533,7 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i)
i
->
cur_seq
=
rframe
->
seq
;
i
->
cur_ts
=
rframe
->
ts
;
}
i
->
sync
--
;
i
->
sync
=
0
;
}
...
...
@@ -546,7 +583,7 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i)
#ifdef DB_JB
if
(
found
)
{
printf
(
"O: %u:%u %u
\n
"
,
rframe
->
seq
,
rframe
->
seq
,
rframe
->
plc
);
printf
(
"O: %u:%u %u
%d
\n
"
,
rframe
->
seq
,
rframe
->
ts
,
rframe
->
plc
,
rframe
->
seq
-
i
->
last_seq
);
}
else
{
printf
(
"DATA: %u %u %d %s %d
\n
"
,
i
->
packet_count
,
i
->
consecutive_good_count
,
i
->
out_queue
->
last_jitter
,
found
?
"found"
:
"not found"
,
i
->
qlen
);
}
...
...
src/mod/endpoints/mod_sofia/sofia_glue.c
浏览文件 @
7e047c3f
...
...
@@ -3153,19 +3153,19 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
if
((
val
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"jitterbuffer_msec"
)))
{
int
len
=
atoi
(
val
);
int
maxlen
=
5
0
;
int
maxlen
=
0
;
char
*
p
;
if
((
p
=
strchr
(
val
,
':'
)))
{
p
++
;
maxlen
=
atoi
(
val
);
maxlen
=
atoi
(
p
);
}
if
(
len
<
20
||
len
>
10000
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_ERROR
,
"Invalid Jitterbuffer spec [%d] must be between 20 and 10000
\n
"
,
len
);
}
else
{
int
qlen
,
maxqlen
=
0
;
int
qlen
,
maxqlen
=
5
0
;
qlen
=
len
/
(
tech_pvt
->
read_impl
.
microseconds_per_packet
/
1000
);
...
...
src/switch_rtp.c
浏览文件 @
7e047c3f
...
...
@@ -1667,7 +1667,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *
if
(
rtp_session
->
jb
)
{
stfu_n_resize
(
rtp_session
->
jb
,
queue_frames
);
}
else
{
rtp_session
->
jb
=
stfu_n_init
(
queue_frames
,
max_queue_frames
||
50
,
samples_per_packet
,
samples_per_second
);
rtp_session
->
jb
=
stfu_n_init
(
queue_frames
,
max_queue_frames
?
max_queue_frames
:
50
,
samples_per_packet
,
samples_per_second
);
}
READ_DEC
(
rtp_session
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论