Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
2a50c6d5
提交
2a50c6d5
authored
12月 17, 2014
作者:
Anthony Minessale
提交者:
Michael Jerris
5月 28, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7501: use vidderbuffer in rtp
上级
7b323f0b
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
72 行增加
和
27 行删除
+72
-27
switch_rtp.h
src/include/switch_rtp.h
+4
-0
switch_types.h
src/include/switch_types.h
+3
-0
switch_rtp.c
src/switch_rtp.c
+65
-27
没有找到文件。
src/include/switch_rtp.h
浏览文件 @
2a50c6d5
...
@@ -49,6 +49,10 @@ SWITCH_BEGIN_EXTERN_C
...
@@ -49,6 +49,10 @@ SWITCH_BEGIN_EXTERN_C
//#define SWITCH_RTP_CRYPTO_KEY_32 "AES_CM_128_HMAC_SHA1_32"
//#define SWITCH_RTP_CRYPTO_KEY_32 "AES_CM_128_HMAC_SHA1_32"
#define SWITCH_RTP_CRYPTO_KEY_80 "AES_CM_128_HMAC_SHA1_80"
#define SWITCH_RTP_CRYPTO_KEY_80 "AES_CM_128_HMAC_SHA1_80"
typedef
struct
{
switch_rtp_hdr_t
header
;
char
body
[
SWITCH_RTP_MAX_BUF_LEN
];
}
switch_rtp_packet_t
;
typedef
enum
{
typedef
enum
{
SWITCH_RTP_CRYPTO_SEND
,
SWITCH_RTP_CRYPTO_SEND
,
...
...
src/include/switch_types.h
浏览文件 @
2a50c6d5
...
@@ -2492,6 +2492,9 @@ typedef struct switch_waitlist_s {
...
@@ -2492,6 +2492,9 @@ typedef struct switch_waitlist_s {
uint32_t
revents
;
uint32_t
revents
;
}
switch_waitlist_t
;
}
switch_waitlist_t
;
struct
switch_vb_s
;
typedef
struct
switch_vb_s
switch_vb_t
;
SWITCH_END_EXTERN_C
SWITCH_END_EXTERN_C
#endif
#endif
...
...
src/switch_rtp.c
浏览文件 @
2a50c6d5
...
@@ -54,6 +54,7 @@
...
@@ -54,6 +54,7 @@
#include <srtp.h>
#include <srtp.h>
#include <srtp_priv.h>
#include <srtp_priv.h>
#include <switch_ssl.h>
#include <switch_ssl.h>
#include <switch_vidderbuffer.h>
#define JITTER_LEAD_FRAMES 10
#define JITTER_LEAD_FRAMES 10
#define READ_INC(rtp_session) switch_mutex_lock(rtp_session->read_mutex); rtp_session->reading++
#define READ_INC(rtp_session) switch_mutex_lock(rtp_session->read_mutex); rtp_session->reading++
...
@@ -387,6 +388,7 @@ struct switch_rtp {
...
@@ -387,6 +388,7 @@ struct switch_rtp {
uint8_t
ready
;
uint8_t
ready
;
uint8_t
cn
;
uint8_t
cn
;
stfu_instance_t
*
jb
;
stfu_instance_t
*
jb
;
switch_vb_t
*
vb
;
uint32_t
max_missed_packets
;
uint32_t
max_missed_packets
;
uint32_t
missed_count
;
uint32_t
missed_count
;
rtp_msg_t
write_msg
;
rtp_msg_t
write_msg
;
...
@@ -3486,6 +3488,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
...
@@ -3486,6 +3488,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
if
(
switch_core_timer_init
(
&
rtp_session
->
timer
,
"soft"
,
1
,
90
,
pool
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_timer_init
(
&
rtp_session
->
timer
,
"soft"
,
1
,
90
,
pool
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_DEBUG
,
"Starting video timer.
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_DEBUG
,
"Starting video timer.
\n
"
);
}
}
switch_vb_create
(
&
rtp_session
->
vb
,
5
,
30
);
switch_vb_debug_level
(
rtp_session
->
vb
,
1
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_DEBUG
,
"Starting video buffer.
\n
"
);
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_DEBUG
,
"Not using a timer
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_DEBUG
,
"Not using a timer
\n
"
);
}
}
...
@@ -4120,6 +4127,10 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
...
@@ -4120,6 +4127,10 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
stfu_n_destroy
(
&
(
*
rtp_session
)
->
jb
);
stfu_n_destroy
(
&
(
*
rtp_session
)
->
jb
);
}
}
if
((
*
rtp_session
)
->
vb
)
{
switch_vb_destroy
(
&
(
*
rtp_session
)
->
vb
);
}
if
((
*
rtp_session
)
->
dtls
&&
(
*
rtp_session
)
->
dtls
==
(
*
rtp_session
)
->
rtcp_dtls
)
{
if
((
*
rtp_session
)
->
dtls
&&
(
*
rtp_session
)
->
dtls
==
(
*
rtp_session
)
->
rtcp_dtls
)
{
(
*
rtp_session
)
->
rtcp_dtls
=
NULL
;
(
*
rtp_session
)
->
rtcp_dtls
=
NULL
;
}
}
...
@@ -5039,37 +5050,45 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
...
@@ -5039,37 +5050,45 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
}
}
}
}
if
(
rtp_session
->
recv_msg
.
header
.
version
==
2
&&
*
bytes
)
{
if
(
rtp_session
->
jb
&&
!
rtp_session
->
pause_jb
&&
jb_valid
(
rtp_session
)
&&
rtp_session
->
recv_msg
.
header
.
version
==
2
&&
*
bytes
)
{
uint32_t
read_ssrc
=
ntohl
((
uint32_t
)
rtp_session
->
recv_msg
.
header
.
ssrc
);
if
(
rtp_session
->
vb
)
{
if
(
rtp_session
->
recv_msg
.
header
.
m
&&
rtp_session
->
recv_msg
.
header
.
pt
!=
rtp_session
->
recv_te
&&
switch_vb_put_packet
(
rtp_session
->
vb
,
(
switch_rtp_packet_t
*
)
&
rtp_session
->
recv_msg
,
*
bytes
);
!
rtp_session
->
flags
[
SWITCH_RTP_FLAG_VIDEO
]
&&
!
(
rtp_session
->
rtp_bugs
&
RTP_BUG_IGNORE_MARK_BIT
))
{
status
=
SWITCH_STATUS_FALSE
;
stfu_n_reset
(
rtp_session
->
jb
);
*
bytes
=
0
;
}
else
if
(
rtp_session
->
last_read_ssrc
&&
rtp_session
->
last_read_ssrc
!=
read_ssrc
)
{
stfu_n_reset
(
rtp_session
->
jb
);
}
}
rtp_session
->
last_read_ssrc
=
read_ssrc
;
if
(
!
rtp_session
->
flags
[
SWITCH_RTP_FLAG_USE_TIMER
]
&&
rtp_session
->
timer
.
interval
)
{
if
(
rtp_session
->
jb
&&
!
rtp_session
->
pause_jb
&&
jb_valid
(
rtp_session
))
{
switch_core_timer_sync
(
&
rtp_session
->
timer
);
uint32_t
read_ssrc
=
ntohl
((
uint32_t
)
rtp_session
->
recv_msg
.
header
.
ssrc
);
reset_jitter_seq
(
rtp_session
);
if
(
rtp_session
->
recv_msg
.
header
.
m
&&
rtp_session
->
recv_msg
.
header
.
pt
!=
rtp_session
->
recv_te
&&
}
!
rtp_session
->
flags
[
SWITCH_RTP_FLAG_VIDEO
]
&&
!
(
rtp_session
->
rtp_bugs
&
RTP_BUG_IGNORE_MARK_BIT
))
{
stfu_n_reset
(
rtp_session
->
jb
);
}
else
if
(
rtp_session
->
last_read_ssrc
&&
rtp_session
->
last_read_ssrc
!=
read_ssrc
)
{
stfu_n_reset
(
rtp_session
->
jb
);
}
rtp_session
->
last_read_ssrc
=
read_ssrc
;
if
(
stfu_n_eat
(
rtp_session
->
jb
,
rtp_session
->
last_read_ts
,
if
(
!
rtp_session
->
flags
[
SWITCH_RTP_FLAG_USE_TIMER
]
&&
rtp_session
->
timer
.
interval
)
{
ntohs
((
uint16_t
)
rtp_session
->
recv_msg
.
header
.
seq
),
switch_core_timer_sync
(
&
rtp_session
->
timer
);
rtp_session
->
recv_msg
.
header
.
pt
,
reset_jitter_seq
(
rtp_session
);
RTP_BODY
(
rtp_session
),
*
bytes
-
rtp_header_len
,
rtp_session
->
timer
.
samplecount
)
==
STFU_ITS_TOO_LATE
)
{
}
if
(
stfu_n_eat
(
rtp_session
->
jb
,
rtp_session
->
last_read_ts
,
ntohs
((
uint16_t
)
rtp_session
->
recv_msg
.
header
.
seq
),
rtp_session
->
recv_msg
.
header
.
pt
,
RTP_BODY
(
rtp_session
),
*
bytes
-
rtp_header_len
,
rtp_session
->
timer
.
samplecount
)
==
STFU_ITS_TOO_LATE
)
{
goto
more
;
goto
more
;
}
}
status
=
SWITCH_STATUS_FALSE
;
status
=
SWITCH_STATUS_FALSE
;
*
bytes
=
0
;
*
bytes
=
0
;
if
(
!
return_jb_packet
)
{
if
(
!
return_jb_packet
)
{
return
status
;
return
status
;
}
}
}
}
}
if
(
rtp_session
->
jb
&&
!
rtp_session
->
pause_jb
&&
jb_valid
(
rtp_session
))
{
if
(
rtp_session
->
jb
&&
!
rtp_session
->
pause_jb
&&
jb_valid
(
rtp_session
))
{
...
@@ -5096,6 +5115,19 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
...
@@ -5096,6 +5115,19 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
}
}
}
}
if
(
rtp_session
->
vb
)
{
if
(
switch_vb_get_packet
(
rtp_session
->
vb
,
(
switch_rtp_packet_t
*
)
&
rtp_session
->
recv_msg
,
bytes
)
==
SWITCH_STATUS_MORE_DATA
)
{
status
=
SWITCH_STATUS_FALSE
;
*
bytes
=
0
;
}
else
{
status
=
SWITCH_STATUS_SUCCESS
;
if
(
!
xcheck_jitter
)
{
check_jitter
(
rtp_session
);
xcheck_jitter
=
*
bytes
;
}
}
}
return
status
;
return
status
;
}
}
...
@@ -5522,6 +5554,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
...
@@ -5522,6 +5554,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
if
(
!
rtp_session
->
flags
[
SWITCH_RTP_FLAG_USE_TIMER
]
&&
rtp_session
->
read_pollfd
)
{
if
(
!
rtp_session
->
flags
[
SWITCH_RTP_FLAG_USE_TIMER
]
&&
rtp_session
->
read_pollfd
)
{
int
pt
=
poll_sec
*
1000000
;
int
pt
=
poll_sec
*
1000000
;
int
force
=
0
;
do_2833
(
rtp_session
);
do_2833
(
rtp_session
);
...
@@ -5539,12 +5572,17 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
...
@@ -5539,12 +5572,17 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
pt
=
200000
;
pt
=
200000
;
}
}
//if (using_ice(rtp_session)) {
if
(
rtp_session
->
vb
&&
switch_vb_frame_count
(
rtp_session
->
vb
))
{
// pt = 20000;
pt
=
10000
;
//}
force
=
1
;
}
poll_status
=
switch_poll
(
rtp_session
->
read_pollfd
,
1
,
&
fdr
,
pt
);
poll_status
=
switch_poll
(
rtp_session
->
read_pollfd
,
1
,
&
fdr
,
pt
);
if
(
rtp_session
->
vb
&&
force
)
{
poll_status
=
SWITCH_STATUS_SUCCESS
;
}
if
(
!
rtp_session
->
flags
[
SWITCH_RTP_FLAG_VIDEO
]
&&
rtp_session
->
dtmf_data
.
out_digit_dur
>
0
)
{
if
(
!
rtp_session
->
flags
[
SWITCH_RTP_FLAG_VIDEO
]
&&
rtp_session
->
dtmf_data
.
out_digit_dur
>
0
)
{
return_cng_frame
();
return_cng_frame
();
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论