Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
e6b11d1c
提交
e6b11d1c
authored
9月 15, 2017
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
NackGenerator: fix AddPacketsToNackList() method
上级
4b06142a
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
50 行增加
和
43 行删除
+50
-43
TODO_V2.md
TODO_V2.md
+2
-0
RtpStream.hpp
worker/include/RTC/RtpStream.hpp
+6
-5
RtpStreamRecv.hpp
worker/include/RTC/RtpStreamRecv.hpp
+2
-2
RtpStreamSend.hpp
worker/include/RTC/RtpStreamSend.hpp
+1
-4
NackGenerator.cpp
worker/src/RTC/NackGenerator.cpp
+18
-15
RtpStream.cpp
worker/src/RTC/RtpStream.cpp
+9
-8
RtpStreamSend.cpp
worker/src/RTC/RtpStreamSend.cpp
+12
-9
没有找到文件。
TODO_V2.md
浏览文件 @
e6b11d1c
# TODO in mediasoup v2 (server-side)
*
In
`RtpStreamSend::StorePacket()`
we should remove old packets (as
`NackGenerator`
does).
*
Remove
`producer.on('rtprawpacket')`
and, instead, create a special
`RtpConsumer`
or something like that.
*
Set a proper value for Producer::FullFrameRequestBlockTimeout (currently 1 second).
...
...
worker/include/RTC/RtpStream.hpp
浏览文件 @
e6b11d1c
...
...
@@ -65,12 +65,13 @@ namespace RTC
// Whether at least a RTP packet has been received.
// https://tools.ietf.org/html/rfc3550#appendix-A.1 stuff.
bool
started
{
false
};
uint16_t
maxSeq
{
0
};
// Highest seq. number seen.
uint32_t
cycles
{
0
};
// Shifted count of seq. number cycles.
uint32_t
baseSeq
{
0
};
// Base seq number.
uint32_t
badSeq
{
0
};
// Last 'bad' seq number + 1.
uint16_t
maxSeq
{
0
};
// Highest seq. number seen.
uint32_t
cycles
{
0
};
// Shifted count of seq. number cycles.
uint32_t
baseSeq
{
0
};
// Base seq number.
uint32_t
badSeq
{
0
};
// Last 'bad' seq number + 1.
// Others.
uint32_t
maxTimestamp
{
0
};
// Highest timestamp seen.
uint32_t
maxPacketTs
{
0
};
// Highest timestamp seen.
uint64_t
maxPacketMs
{
0
};
// When the packet with highest timestammp was seen.
Timer
*
healthCheckTimer
{
nullptr
};
bool
healthy
{
true
};
uint32_t
totalLost
{
0
};
...
...
worker/include/RTC/RtpStreamRecv.hpp
浏览文件 @
e6b11d1c
...
...
@@ -46,8 +46,8 @@ namespace RTC
// Passed by argument.
Listener
*
listener
{
nullptr
};
// Others.
uint32_t
expectedPrior
{
0
};
// Packet expected at last interval.
uint32_t
receivedPrior
{
0
};
// Packet received at last interval.
uint32_t
expectedPrior
{
0
};
// Packet expected at last interval.
uint32_t
receivedPrior
{
0
};
// Packet received at last interval.
uint32_t
lastSrTimestamp
{
0
};
// The middle 32 bits out of 64 in the NTP timestamp received in
// the most recent sender report.
uint64_t
lastSrReceived
{
0
};
// Wallclock time representing the most recent sender report
...
...
worker/include/RTC/RtpStreamSend.hpp
浏览文件 @
e6b11d1c
...
...
@@ -52,10 +52,7 @@ namespace RTC
Buffer
buffer
;
private
:
uint64_t
lastPacketTimeMs
{
0
};
// Time (MS) when the last packet was received.
uint32_t
lastPacketRtpTimestamp
{
0
};
// RTP Timestamp of the last packet.
// RTX related.
// Retransmittion related.
bool
hasRtx
{
false
};
uint8_t
rtxPayloadType
{
0
};
uint32_t
rtxSsrc
{
0
};
...
...
worker/src/RTC/NackGenerator.cpp
浏览文件 @
e6b11d1c
...
...
@@ -9,10 +9,10 @@ namespace RTC
{
/* Static. */
constexpr
uint32_t
MaxPacketAge
{
1
5
00
};
constexpr
size_t
MaxNackPackets
{
5
00
};
constexpr
uint32_t
MaxPacketAge
{
1
00
00
};
constexpr
size_t
MaxNackPackets
{
10
00
};
constexpr
uint32_t
DefaultRtt
{
100
};
constexpr
uint8_t
MaxNackRetries
{
8
};
constexpr
uint8_t
MaxNackRetries
{
10
};
constexpr
uint64_t
TimerInterval
{
50
};
/* Instance methods. */
...
...
@@ -111,22 +111,25 @@ namespace RTC
{
MS_TRACE
();
uint32_t
numItemsBefore
=
this
->
nackList
.
size
();
if
(
seq32End
>
MaxPacketAge
)
{
uint32_t
numItemsBefore
=
this
->
nackList
.
size
();
// Remove old packets.
auto
it
=
this
->
nackList
.
lower_bound
(
seq32End
-
MaxPacketAge
);
// Remove old packets.
auto
it
=
this
->
nackList
.
lower_bound
(
seq32End
-
MaxPacketAge
);
this
->
nackList
.
erase
(
this
->
nackList
.
begin
(),
it
);
this
->
nackList
.
erase
(
this
->
nackList
.
begin
(),
it
);
uint32_t
numItemsRemoved
=
numItemsBefore
-
this
->
nackList
.
size
();
uint32_t
numItemsRemoved
=
numItemsBefore
-
this
->
nackList
.
size
();
if
(
numItemsRemoved
>
0
)
{
MS_DEBUG_TAG
(
rtx
,
"removed %"
PRIu32
" NACK items due to too old seq number [seq32End:%"
PRIu32
"]"
,
numItemsRemoved
,
seq32End
);
if
(
numItemsRemoved
>
0
)
{
MS_DEBUG_TAG
(
rtx
,
"removed %"
PRIu32
" NACK items due to too old seq number [seq32End:%"
PRIu32
"]"
,
numItemsRemoved
,
seq32End
);
}
}
// If the nack list is too large, clear it and request a key frame.
...
...
worker/src/RTC/RtpStream.cpp
浏览文件 @
e6b11d1c
...
...
@@ -43,7 +43,6 @@ namespace RTC
static
const
Json
::
StaticString
JsonStringBitRate
{
"bitrate"
};
static
const
Json
::
StaticString
JsonStringJitter
{
"jitter"
};
static
const
Json
::
StaticString
JsonStringMaxTimestamp
{
"maxTimestamp"
};
static
const
Json
::
StaticString
JsonStringParams
{
"params"
};
static
const
Json
::
StaticString
JsonStringPacketCount
{
"packetCount"
};
static
const
Json
::
StaticString
JsonStringOctetCount
{
"octetCount"
};
...
...
@@ -55,7 +54,6 @@ namespace RTC
json
[
JsonStringBitRate
]
=
Json
::
UInt
{
GetBitRate
()
};
json
[
JsonStringJitter
]
=
Json
::
UInt
{
this
->
jitter
};
json
[
JsonStringMaxTimestamp
]
=
Json
::
UInt
{
this
->
maxTimestamp
};
json
[
JsonStringParams
]
=
this
->
params
.
ToJson
();
json
[
JsonStringPacketCount
]
=
static_cast
<
Json
::
UInt
>
(
this
->
counter
.
GetPacketCount
());
json
[
JsonStringOctetCount
]
=
static_cast
<
Json
::
UInt
>
(
this
->
counter
.
GetBytes
());
...
...
@@ -101,8 +99,11 @@ namespace RTC
this
->
cycles
+
static_cast
<
uint32_t
>
(
packet
->
GetSequenceNumber
()));
// Update highest seen RTP timestamp.
if
(
packet
->
GetTimestamp
()
>
this
->
maxTimestamp
)
this
->
maxTimestamp
=
packet
->
GetTimestamp
();
if
(
packet
->
GetTimestamp
()
>
this
->
maxPacketTs
)
{
this
->
maxPacketTs
=
packet
->
GetTimestamp
();
this
->
maxPacketMs
=
DepLibUV
::
GetTime
();
}
return
true
;
}
...
...
@@ -119,10 +120,10 @@ namespace RTC
MS_TRACE
();
// Initialize/reset RTP counters.
this
->
baseSeq
=
seq
;
this
->
maxSeq
=
seq
;
this
->
badSeq
=
RtpSeqMod
+
1
;
// So seq == badSeq is false.
this
->
max
Timestamp
=
0
;
// Also reset the highest seen RTP timestamp.
this
->
baseSeq
=
seq
;
this
->
maxSeq
=
seq
;
this
->
badSeq
=
RtpSeqMod
+
1
;
// So seq == badSeq is false.
this
->
max
PacketTs
=
0
;
// Also reset the highest seen RTP timestamp.
}
bool
RtpStream
::
UpdateSeq
(
RTC
::
RtpPacket
*
packet
)
...
...
worker/src/RTC/RtpStreamSend.cpp
浏览文件 @
e6b11d1c
...
...
@@ -12,7 +12,8 @@ namespace RTC
static
constexpr
uint32_t
RtpSeqMod
{
1
<<
16
};
// Don't retransmit packets older than this (ms).
static
constexpr
uint32_t
MaxRetransmissionDelay
{
250
};
// TODO: This must be tunned.
static
constexpr
uint32_t
MaxRetransmissionDelay
{
1000
};
static
constexpr
uint32_t
DefaultRtt
{
100
};
/* Instance methods. */
...
...
@@ -43,10 +44,6 @@ namespace RTC
if
(
!
this
->
storage
.
empty
())
StorePacket
(
packet
);
// Record current time and RTP timestamp.
this
->
lastPacketTimeMs
=
DepLibUV
::
GetTime
();
this
->
lastPacketRtpTimestamp
=
packet
->
GetTimestamp
();
return
true
;
}
...
...
@@ -182,13 +179,18 @@ namespace RTC
if
(
currentSeq32
==
seq32
)
{
auto
currentPacket
=
(
*
bufferIt
).
packet
;
uint32_t
diffMs
=
now
-
this
->
lastPacketTimeMs
;
// Calculate how the elapsed time between the max timestampt seen and
// the requested packet's timestampt (in ms).
uint32_t
diffTs
=
this
->
maxPacketTs
-
currentPacket
->
GetTimestamp
();
uint32_t
diffMs
=
diffTs
*
1000
/
this
->
params
.
clockRate
;
// Just provide the packet if no older than MaxRetransmissionDelay ms.
if
(
diffMs
>
MaxRetransmissionDelay
)
{
if
(
!
tooOldPacketFound
)
{
// TODO: May we ask for a key frame in this case?
MS_WARN_TAG
(
rtx
,
"ignoring retransmission for too old packet "
...
...
@@ -230,6 +232,7 @@ namespace RTC
break
;
}
// It can not be after this packet.
if
(
currentSeq32
>
seq32
)
break
;
...
...
@@ -296,10 +299,10 @@ namespace RTC
report
->
SetNtpFrac
(
ntp
.
fractions
);
// Calculate RTP timestamp diff between now and last received RTP packet.
uint32_t
diffMs
=
now
-
this
->
lastPacketTimeMs
;
uint32_t
diff
RtpTimestamp
=
diffMs
*
this
->
params
.
clockRate
/
1000
;
auto
diffMs
=
static_cast
<
uint32_t
>
(
now
-
this
->
maxPacketMs
)
;
uint32_t
diff
Ts
=
diffMs
*
this
->
params
.
clockRate
/
1000
;
report
->
SetRtpTs
(
this
->
lastPacketRtpTimestamp
+
diffRtpTimestamp
);
report
->
SetRtpTs
(
this
->
maxPacketTs
+
diffTs
);
return
report
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论