Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
5c52c636
Commit
5c52c636
authored
3 years ago
by
ziyue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善nack/srtp相关代码
parent
80ab84cb
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
8 行增加
和
17 行删除
+8
-17
webrtc/Nack.cpp
+1
-1
webrtc/Nack.h
+3
-1
webrtc/WebRtcTransport.cpp
+3
-13
webrtc/WebRtcTransport.h
+1
-2
没有找到文件。
webrtc/Nack.cpp
查看文件 @
5c52c636
...
...
@@ -192,7 +192,7 @@ uint64_t NackContext::reSendNack() {
it
=
_nack_send_status
.
erase
(
it
);
continue
;
}
if
(
now
-
it
->
second
.
update_stamp
<
2
*
_rtt
)
{
if
(
now
-
it
->
second
.
update_stamp
<
kNackIntervalRatio
*
_rtt
)
{
//距离上次nack不足2倍的rtt,不用再发送nack
++
it
;
continue
;
...
...
This diff is collapsed.
Click to expand it.
webrtc/Nack.h
查看文件 @
5c52c636
...
...
@@ -39,11 +39,13 @@ public:
using
Ptr
=
std
::
shared_ptr
<
NackContext
>
;
using
onNack
=
function
<
void
(
const
FCI_NACK
&
nack
)
>
;
//最大保留的rtp丢包状态个数
static
constexpr
auto
kNackMaxSize
=
10
0
;
static
constexpr
auto
kNackMaxSize
=
10
24
;
//rtp丢包状态最长保留时间
static
constexpr
auto
kNackMaxMS
=
3
*
1000
;
//nack最多请求重传10次
static
constexpr
auto
kNackMaxCount
=
10
;
//nack重传频率,rtt的倍数
static
constexpr
auto
kNackIntervalRatio
=
2
.
0
f
;
NackContext
()
=
default
;
~
NackContext
()
=
default
;
...
...
This diff is collapsed.
Click to expand it.
webrtc/WebRtcTransport.cpp
查看文件 @
5c52c636
...
...
@@ -97,12 +97,7 @@ void WebRtcTransport::OnDtlsTransportConnected(
std
::
string
&
remoteCert
)
{
InfoL
;
_srtp_session_send
=
std
::
make_shared
<
RTC
::
SrtpSession
>
(
RTC
::
SrtpSession
::
Type
::
OUTBOUND
,
srtpCryptoSuite
,
srtpLocalKey
,
srtpLocalKeyLen
);
string
srtpRemoteKey_str
((
char
*
)
srtpRemoteKey
,
srtpRemoteKeyLen
);
_srtp_session_recv_alloc
=
[
srtpCryptoSuite
,
srtpRemoteKey_str
]()
{
return
std
::
make_shared
<
RTC
::
SrtpSession
>
(
RTC
::
SrtpSession
::
Type
::
INBOUND
,
srtpCryptoSuite
,
(
uint8_t
*
)
srtpRemoteKey_str
.
data
(),
srtpRemoteKey_str
.
size
());
};
_srtp_session_recv
=
std
::
make_shared
<
RTC
::
SrtpSession
>
(
RTC
::
SrtpSession
::
Type
::
INBOUND
,
srtpCryptoSuite
,
srtpRemoteKey
,
srtpRemoteKeyLen
);
onStartWebRTC
();
}
...
...
@@ -255,19 +250,14 @@ void WebRtcTransport::inputSockData(char *buf, size_t len, RTC::TransportTuple *
_dtls_transport
->
ProcessDtlsData
((
uint8_t
*
)
buf
,
len
);
return
;
}
RtpHeader
*
rtp
=
(
RtpHeader
*
)
buf
;
auto
it
=
_srtp_session_recv
.
find
(
rtp
->
pt
);
if
(
it
==
_srtp_session_recv
.
end
())
{
it
=
_srtp_session_recv
.
emplace
((
uint8_t
)
rtp
->
pt
,
_srtp_session_recv_alloc
()).
first
;
}
if
(
is_rtp
(
buf
))
{
if
(
it
->
second
->
DecryptSrtp
((
uint8_t
*
)
buf
,
&
len
))
{
if
(
_srtp_session_recv
->
DecryptSrtp
((
uint8_t
*
)
buf
,
&
len
))
{
onRtp
(
buf
,
len
);
}
return
;
}
if
(
is_rtcp
(
buf
))
{
if
(
it
->
second
->
DecryptSrtcp
((
uint8_t
*
)
buf
,
&
len
))
{
if
(
_srtp_session_recv
->
DecryptSrtcp
((
uint8_t
*
)
buf
,
&
len
))
{
onRtcp
(
buf
,
len
);
}
return
;
...
...
This diff is collapsed.
Click to expand it.
webrtc/WebRtcTransport.h
查看文件 @
5c52c636
...
...
@@ -122,10 +122,9 @@ private:
std
::
shared_ptr
<
RTC
::
IceServer
>
_ice_server
;
std
::
shared_ptr
<
RTC
::
DtlsTransport
>
_dtls_transport
;
std
::
shared_ptr
<
RTC
::
SrtpSession
>
_srtp_session_send
;
std
::
shared_ptr
<
RTC
::
SrtpSession
>
_srtp_session_recv
;
RtcSession
::
Ptr
_offer_sdp
;
RtcSession
::
Ptr
_answer_sdp
;
function
<
std
::
shared_ptr
<
RTC
::
SrtpSession
>
()
>
_srtp_session_recv_alloc
;
std
::
unordered_map
<
uint8_t
/*pt*/
,
std
::
shared_ptr
<
RTC
::
SrtpSession
>
>
_srtp_session_recv
;
};
class
RtpChannel
;
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论