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
fda4e83a
Commit
fda4e83a
authored
Jun 18, 2022
by
xiongguangjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
srt support tlpktdrop=0 feature
parent
56b8a860
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
28 行增加
和
12 行删除
+28
-12
srt/PacketQueue.cpp
+8
-3
srt/PacketQueue.hpp
+4
-1
srt/PacketSendQueue.cpp
+8
-3
srt/PacketSendQueue.hpp
+3
-1
srt/SrtTransport.cpp
+5
-4
没有找到文件。
srt/PacketQueue.cpp
查看文件 @
fda4e83a
...
...
@@ -237,11 +237,16 @@ std::string PacketQueue::dump() {
//////////////////// PacketRecvQueue //////////////////////////////////
PacketRecvQueue
::
PacketRecvQueue
(
uint32_t
max_size
,
uint32_t
init_seq
,
uint32_t
latency
)
PacketRecvQueue
::
PacketRecvQueue
(
uint32_t
max_size
,
uint32_t
init_seq
,
uint32_t
latency
,
uint32_t
flag
)
:
_pkt_cap
(
max_size
)
,
_pkt_latency
(
latency
)
,
_pkt_expected_seq
(
init_seq
)
,
_pkt_buf
(
max_size
)
{}
,
_pkt_buf
(
max_size
)
,
_srt_flag
(
flag
)
{}
bool
PacketRecvQueue
::
TLPKTDrop
(){
return
(
_srt_flag
&
HSExtMessage
::
HS_EXT_MSG_TLPKTDROP
)
&&
(
_srt_flag
&
HSExtMessage
::
HS_EXT_MSG_TSBPDRCV
);
}
bool
PacketRecvQueue
::
inputPacket
(
DataPacket
::
Ptr
pkt
,
std
::
list
<
DataPacket
::
Ptr
>
&
out
)
{
// TraceL << dump() << " seq:" << pkt->packet_seq_number;
while
(
_size
>
0
&&
_start
==
_end
)
{
...
...
@@ -265,7 +270,7 @@ bool PacketRecvQueue::inputPacket(DataPacket::Ptr pkt, std::list<DataPacket::Ptr
_start
=
(
_start
+
1
)
%
_pkt_cap
;
it
=
_pkt_buf
[
_start
];
}
while
(
timeLatency
()
>
_pkt_latency
)
{
while
(
timeLatency
()
>
_pkt_latency
&&
TLPKTDrop
()
)
{
it
=
_pkt_buf
[
_start
];
if
(
it
)
{
_pkt_buf
[
_start
]
=
nullptr
;
...
...
srt/PacketQueue.hpp
查看文件 @
fda4e83a
...
...
@@ -65,7 +65,7 @@ class PacketRecvQueue : public PacketQueueInterface {
public
:
using
Ptr
=
std
::
shared_ptr
<
PacketRecvQueue
>
;
PacketRecvQueue
(
uint32_t
max_size
,
uint32_t
init_seq
,
uint32_t
latency
);
PacketRecvQueue
(
uint32_t
max_size
,
uint32_t
init_seq
,
uint32_t
latency
,
uint32_t
flag
=
0xbf
);
~
PacketRecvQueue
()
=
default
;
bool
inputPacket
(
DataPacket
::
Ptr
pkt
,
std
::
list
<
DataPacket
::
Ptr
>
&
out
);
...
...
@@ -85,12 +85,15 @@ private:
void
insertToCycleBuf
(
DataPacket
::
Ptr
pkt
,
uint32_t
diff
);
DataPacket
::
Ptr
getFirst
();
DataPacket
::
Ptr
getLast
();
bool
TLPKTDrop
();
private
:
uint32_t
_pkt_cap
;
uint32_t
_pkt_latency
;
uint32_t
_pkt_expected_seq
;
uint32_t
_srt_flag
;
std
::
vector
<
DataPacket
::
Ptr
>
_pkt_buf
;
uint32_t
_start
=
0
;
uint32_t
_end
=
0
;
...
...
srt/PacketSendQueue.cpp
查看文件 @
fda4e83a
...
...
@@ -2,9 +2,10 @@
namespace
SRT
{
PacketSendQueue
::
PacketSendQueue
(
uint32_t
max_size
,
uint32_t
latency
)
PacketSendQueue
::
PacketSendQueue
(
uint32_t
max_size
,
uint32_t
latency
,
uint32_t
flag
)
:
_pkt_cap
(
max_size
)
,
_pkt_latency
(
latency
)
{}
,
_pkt_latency
(
latency
)
,
_srt_flag
(
flag
)
{}
bool
PacketSendQueue
::
drop
(
uint32_t
num
)
{
decltype
(
_pkt_cache
.
begin
())
it
;
...
...
@@ -24,12 +25,16 @@ bool PacketSendQueue::inputPacket(DataPacket::Ptr pkt) {
while
(
_pkt_cache
.
size
()
>
_pkt_cap
)
{
_pkt_cache
.
pop_front
();
}
while
(
timeLatency
()
>
_pkt_latency
)
{
while
(
timeLatency
()
>
_pkt_latency
&&
TLPKTDrop
()
)
{
_pkt_cache
.
pop_front
();
}
return
true
;
}
bool
PacketSendQueue
::
TLPKTDrop
(){
return
(
_srt_flag
&
HSExtMessage
::
HS_EXT_MSG_TLPKTDROP
)
&&
(
_srt_flag
&
HSExtMessage
::
HS_EXT_MSG_TSBPDSND
);
}
std
::
list
<
DataPacket
::
Ptr
>
PacketSendQueue
::
findPacketBySeq
(
uint32_t
start
,
uint32_t
end
)
{
std
::
list
<
DataPacket
::
Ptr
>
re
;
decltype
(
_pkt_cache
.
begin
())
it
;
...
...
srt/PacketSendQueue.hpp
查看文件 @
fda4e83a
...
...
@@ -16,7 +16,7 @@ public:
using
Ptr
=
std
::
shared_ptr
<
PacketSendQueue
>
;
using
LostPair
=
std
::
pair
<
uint32_t
,
uint32_t
>
;
PacketSendQueue
(
uint32_t
max_size
,
uint32_t
latency
);
PacketSendQueue
(
uint32_t
max_size
,
uint32_t
latency
,
uint32_t
flag
=
0xbf
);
~
PacketSendQueue
()
=
default
;
bool
drop
(
uint32_t
num
);
...
...
@@ -25,7 +25,9 @@ public:
private
:
uint32_t
timeLatency
();
bool
TLPKTDrop
();
private
:
uint32_t
_srt_flag
;
uint32_t
_pkt_cap
;
uint32_t
_pkt_latency
;
std
::
list
<
DataPacket
::
Ptr
>
_pkt_cache
;
...
...
srt/SrtTransport.cpp
查看文件 @
fda4e83a
...
...
@@ -182,9 +182,9 @@ void SrtTransport::handleHandshakeConclusion(HandshakePacket &pkt, struct sockad
}
if
(
req
)
{
if
(
req
->
srt_flag
!=
srt_flag
)
{
WarnL
<<
"
not support
flag "
<<
req
->
srt_flag
;
WarnL
<<
" flag "
<<
req
->
srt_flag
;
}
//
srt_flag = req->srt_flag;
srt_flag
=
req
->
srt_flag
;
delay
=
delay
<=
req
->
recv_tsbpd_delay
?
req
->
recv_tsbpd_delay
:
delay
;
}
TraceL
<<
getIdentifier
()
<<
" CONCLUSION Phase "
;
...
...
@@ -214,8 +214,8 @@ void SrtTransport::handleHandshakeConclusion(HandshakePacket &pkt, struct sockad
sendControlPacket
(
res
,
true
);
TraceL
<<
" buf size = "
<<
res
->
max_flow_window_size
<<
" init seq ="
<<
_init_seq_number
<<
" latency="
<<
delay
;
_recv_buf
=
std
::
make_shared
<
PacketRecvQueue
>
(
getPktBufSize
(),
_init_seq_number
,
delay
*
1e3
);
_send_buf
=
std
::
make_shared
<
PacketSendQueue
>
(
getPktBufSize
(),
delay
*
1e3
);
_recv_buf
=
std
::
make_shared
<
PacketRecvQueue
>
(
getPktBufSize
(),
_init_seq_number
,
delay
*
1e3
,
srt_flag
);
_send_buf
=
std
::
make_shared
<
PacketSendQueue
>
(
getPktBufSize
(),
delay
*
1e3
,
srt_flag
);
_send_packet_seq_number
=
_init_seq_number
;
_buf_delay
=
delay
;
onHandShakeFinished
(
_stream_id
,
addr
);
...
...
@@ -413,6 +413,7 @@ void SrtTransport::sendACKPacket() {
_last_ack_pkt_seq_num
=
pkt
->
last_ack_pkt_seq_number
;
sendControlPacket
(
pkt
,
true
);
// TraceL<<"send ack "<<pkt->dump();
// TraceL<<_recv_buf->dump();
}
void
SrtTransport
::
sendLightACKPacket
()
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论