Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
79570051
提交
79570051
authored
2月 22, 2023
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RtpStreamSend.cpp: cosmetic, use braces
上级
72794578
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
42 行增加
和
0 行删除
+42
-0
RtpStreamSend.cpp
worker/src/RTC/RtpStreamSend.cpp
+42
-0
没有找到文件。
worker/src/RTC/RtpStreamSend.cpp
浏览文件 @
79570051
...
...
@@ -49,12 +49,16 @@ namespace RTC
RtpStreamSend
::
StorageItem
*
RtpStreamSend
::
StorageItemBuffer
::
Get
(
uint16_t
seq
)
const
{
if
(
RTC
::
SeqManager
<
uint16_t
>::
IsSeqLowerThan
(
seq
,
this
->
startSeq
))
{
return
nullptr
;
}
auto
idx
{
static_cast
<
uint16_t
>
(
seq
-
this
->
startSeq
)
};
if
(
this
->
buffer
.
empty
()
||
idx
>
static_cast
<
uint16_t
>
(
this
->
buffer
.
size
()
-
1
))
{
return
nullptr
;
}
return
this
->
buffer
.
at
(
idx
);
}
...
...
@@ -141,7 +145,9 @@ namespace RTC
for
(
auto
*
storageItem
:
this
->
buffer
)
{
if
(
!
storageItem
)
{
continue
;
}
// Reset the storage item (decrease RTP packet shared pointer counter).
storageItem
->
Reset
();
...
...
@@ -205,11 +211,15 @@ namespace RTC
// Call the parent method.
if
(
!
RtpStream
::
ReceiveStreamPacket
(
packet
))
{
return
false
;
}
// If NACK is enabled, store the packet into the buffer.
if
(
this
->
params
.
useNack
)
{
StorePacket
(
packet
,
sharedPacket
);
}
// Increase transmission counter.
this
->
transmissionCounter
.
Update
(
packet
);
...
...
@@ -234,7 +244,9 @@ namespace RTC
for
(
auto
*
storageItem
:
RetransmissionContainer
)
{
if
(
!
storageItem
)
{
break
;
}
// Note that this is an already RTX encoded packet if RTX is used
// (FillRetransmissionContainer() did it).
...
...
@@ -249,7 +261,9 @@ namespace RTC
// Mark the packet as repaired (only if this is the first retransmission).
if
(
storageItem
->
sentTimes
==
1
)
{
RTC
::
RtpStream
::
PacketRepaired
(
packet
.
get
());
}
if
(
HasRtx
())
{
...
...
@@ -302,7 +316,9 @@ namespace RTC
// If no Sender Report was received by the remote endpoint yet, ignore lastSr
// and dlsr values in the Receiver Report.
if
(
lastSr
&&
dlsr
&&
(
compactNtp
>
dlsr
+
lastSr
))
{
rtt
=
compactNtp
-
dlsr
-
lastSr
;
}
// RTT in milliseconds.
this
->
rtt
=
static_cast
<
float
>
(
rtt
>>
16
)
*
1000
;
...
...
@@ -343,7 +359,9 @@ namespace RTC
MS_TRACE
();
if
(
this
->
transmissionCounter
.
GetPacketCount
()
==
0u
)
{
return
nullptr
;
}
auto
ntp
=
Utils
::
Time
::
TimeMs2Ntp
(
nowMs
);
auto
*
report
=
new
RTC
::
RTCP
::
SenderReport
();
...
...
@@ -371,7 +389,9 @@ namespace RTC
MS_TRACE
();
if
(
this
->
lastRrReceivedMs
==
0u
)
{
return
nullptr
;
}
// Get delay in milliseconds.
auto
delayMs
=
static_cast
<
uint32_t
>
(
nowMs
-
this
->
lastRrReceivedMs
);
...
...
@@ -469,7 +489,9 @@ namespace RTC
// RTP packet is older than the retransmission buffer size.
if
(
static_cast
<
uint32_t
>
(
diffTs
*
1000
/
this
->
params
.
clockRate
)
>=
this
->
retransmissionBufferSize
)
{
return
;
}
}
}
...
...
@@ -483,7 +505,9 @@ namespace RTC
if
(
storageItem
)
{
if
(
packet
->
GetTimestamp
()
==
storageItem
->
timestamp
)
{
return
;
}
// Reset the storage item.
storageItem
->
Reset
();
...
...
@@ -527,11 +551,15 @@ namespace RTC
// Processing RTP packet is older than first one.
if
(
RTC
::
SeqManager
<
uint32_t
>::
IsSeqLowerThan
(
packet
->
GetTimestamp
(),
storageItem
->
timestamp
))
{
break
;
}
// First RTP packet is recent enough.
if
(
static_cast
<
uint32_t
>
(
diffTs
*
1000
/
clockRate
)
<
this
->
retransmissionBufferSize
)
{
break
;
}
// Unfill the buffer start item.
this
->
storageItemBuffer
.
RemoveFirst
();
...
...
@@ -603,7 +631,9 @@ namespace RTC
// Update MID RTP extension value.
if
(
!
this
->
mid
.
empty
())
{
packet
->
UpdateMid
(
mid
);
}
const
uint32_t
diffTs
=
this
->
maxPacketTs
-
packet
->
GetTimestamp
();
...
...
@@ -670,7 +700,9 @@ namespace RTC
sent
=
true
;
if
(
isFirstPacket
)
{
firstPacketSent
=
true
;
}
}
}
...
...
@@ -728,9 +760,13 @@ namespace RTC
uint32_t
lost
;
if
(
totalLost
<
this
->
lostPriorScore
)
{
lost
=
0
;
}
else
{
lost
=
totalLost
-
this
->
lostPriorScore
;
}
this
->
lostPriorScore
=
totalLost
;
...
...
@@ -755,10 +791,14 @@ namespace RTC
}
if
(
lost
>
sent
)
{
lost
=
sent
;
}
if
(
repaired
>
lost
)
{
repaired
=
lost
;
}
#if MS_LOG_DEV_LEVEL == 3
MS_DEBUG_TAG
(
...
...
@@ -783,7 +823,9 @@ namespace RTC
MS_ASSERT
(
retransmitted
>=
repaired
,
"repaired packets cannot be more than retransmitted ones"
);
if
(
retransmitted
>
0
)
{
repairedWeight
*=
static_cast
<
float
>
(
repaired
)
/
retransmitted
;
}
lost
-=
repaired
*
repairedWeight
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论