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 个修改的文件
包含
29 行增加
和
22 行删除
+29
-22
TODO_V2.md
TODO_V2.md
+2
-0
RtpStream.hpp
worker/include/RTC/RtpStream.hpp
+2
-1
RtpStreamRecv.hpp
worker/include/RTC/RtpStreamRecv.hpp
+0
-0
RtpStreamSend.hpp
worker/include/RTC/RtpStreamSend.hpp
+1
-4
NackGenerator.cpp
worker/src/RTC/NackGenerator.cpp
+6
-3
RtpStream.cpp
worker/src/RTC/RtpStream.cpp
+6
-5
RtpStreamSend.cpp
worker/src/RTC/RtpStreamSend.cpp
+12
-9
没有找到文件。
TODO_V2.md
浏览文件 @
e6b11d1c
# TODO in mediasoup v2 (server-side)
# 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.
*
Remove
`producer.on('rtprawpacket')`
and, instead, create a special
`RtpConsumer`
or something like that.
*
Set a proper value for Producer::FullFrameRequestBlockTimeout (currently 1 second).
*
Set a proper value for Producer::FullFrameRequestBlockTimeout (currently 1 second).
...
...
worker/include/RTC/RtpStream.hpp
浏览文件 @
e6b11d1c
...
@@ -70,7 +70,8 @@ namespace RTC
...
@@ -70,7 +70,8 @@ namespace RTC
uint32_t
baseSeq
{
0
};
// Base seq number.
uint32_t
baseSeq
{
0
};
// Base seq number.
uint32_t
badSeq
{
0
};
// Last 'bad' seq number + 1.
uint32_t
badSeq
{
0
};
// Last 'bad' seq number + 1.
// Others.
// 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
};
Timer
*
healthCheckTimer
{
nullptr
};
bool
healthy
{
true
};
bool
healthy
{
true
};
uint32_t
totalLost
{
0
};
uint32_t
totalLost
{
0
};
...
...
worker/include/RTC/RtpStreamRecv.hpp
浏览文件 @
e6b11d1c
worker/include/RTC/RtpStreamSend.hpp
浏览文件 @
e6b11d1c
...
@@ -52,10 +52,7 @@ namespace RTC
...
@@ -52,10 +52,7 @@ namespace RTC
Buffer
buffer
;
Buffer
buffer
;
private
:
private
:
uint64_t
lastPacketTimeMs
{
0
};
// Time (MS) when the last packet was received.
// Retransmittion related.
uint32_t
lastPacketRtpTimestamp
{
0
};
// RTP Timestamp of the last packet.
// RTX related.
bool
hasRtx
{
false
};
bool
hasRtx
{
false
};
uint8_t
rtxPayloadType
{
0
};
uint8_t
rtxPayloadType
{
0
};
uint32_t
rtxSsrc
{
0
};
uint32_t
rtxSsrc
{
0
};
...
...
worker/src/RTC/NackGenerator.cpp
浏览文件 @
e6b11d1c
...
@@ -9,10 +9,10 @@ namespace RTC
...
@@ -9,10 +9,10 @@ namespace RTC
{
{
/* Static. */
/* Static. */
constexpr
uint32_t
MaxPacketAge
{
1
5
00
};
constexpr
uint32_t
MaxPacketAge
{
1
00
00
};
constexpr
size_t
MaxNackPackets
{
5
00
};
constexpr
size_t
MaxNackPackets
{
10
00
};
constexpr
uint32_t
DefaultRtt
{
100
};
constexpr
uint32_t
DefaultRtt
{
100
};
constexpr
uint8_t
MaxNackRetries
{
8
};
constexpr
uint8_t
MaxNackRetries
{
10
};
constexpr
uint64_t
TimerInterval
{
50
};
constexpr
uint64_t
TimerInterval
{
50
};
/* Instance methods. */
/* Instance methods. */
...
@@ -111,6 +111,8 @@ namespace RTC
...
@@ -111,6 +111,8 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
if
(
seq32End
>
MaxPacketAge
)
{
uint32_t
numItemsBefore
=
this
->
nackList
.
size
();
uint32_t
numItemsBefore
=
this
->
nackList
.
size
();
// Remove old packets.
// Remove old packets.
...
@@ -128,6 +130,7 @@ namespace RTC
...
@@ -128,6 +130,7 @@ namespace RTC
numItemsRemoved
,
numItemsRemoved
,
seq32End
);
seq32End
);
}
}
}
// If the nack list is too large, clear it and request a key frame.
// If the nack list is too large, clear it and request a key frame.
uint32_t
numNewNacks
=
seq32End
-
seq32Start
;
uint32_t
numNewNacks
=
seq32End
-
seq32Start
;
...
...
worker/src/RTC/RtpStream.cpp
浏览文件 @
e6b11d1c
...
@@ -43,7 +43,6 @@ namespace RTC
...
@@ -43,7 +43,6 @@ namespace RTC
static
const
Json
::
StaticString
JsonStringBitRate
{
"bitrate"
};
static
const
Json
::
StaticString
JsonStringBitRate
{
"bitrate"
};
static
const
Json
::
StaticString
JsonStringJitter
{
"jitter"
};
static
const
Json
::
StaticString
JsonStringJitter
{
"jitter"
};
static
const
Json
::
StaticString
JsonStringMaxTimestamp
{
"maxTimestamp"
};
static
const
Json
::
StaticString
JsonStringParams
{
"params"
};
static
const
Json
::
StaticString
JsonStringParams
{
"params"
};
static
const
Json
::
StaticString
JsonStringPacketCount
{
"packetCount"
};
static
const
Json
::
StaticString
JsonStringPacketCount
{
"packetCount"
};
static
const
Json
::
StaticString
JsonStringOctetCount
{
"octetCount"
};
static
const
Json
::
StaticString
JsonStringOctetCount
{
"octetCount"
};
...
@@ -55,7 +54,6 @@ namespace RTC
...
@@ -55,7 +54,6 @@ namespace RTC
json
[
JsonStringBitRate
]
=
Json
::
UInt
{
GetBitRate
()
};
json
[
JsonStringBitRate
]
=
Json
::
UInt
{
GetBitRate
()
};
json
[
JsonStringJitter
]
=
Json
::
UInt
{
this
->
jitter
};
json
[
JsonStringJitter
]
=
Json
::
UInt
{
this
->
jitter
};
json
[
JsonStringMaxTimestamp
]
=
Json
::
UInt
{
this
->
maxTimestamp
};
json
[
JsonStringParams
]
=
this
->
params
.
ToJson
();
json
[
JsonStringParams
]
=
this
->
params
.
ToJson
();
json
[
JsonStringPacketCount
]
=
static_cast
<
Json
::
UInt
>
(
this
->
counter
.
GetPacketCount
());
json
[
JsonStringPacketCount
]
=
static_cast
<
Json
::
UInt
>
(
this
->
counter
.
GetPacketCount
());
json
[
JsonStringOctetCount
]
=
static_cast
<
Json
::
UInt
>
(
this
->
counter
.
GetBytes
());
json
[
JsonStringOctetCount
]
=
static_cast
<
Json
::
UInt
>
(
this
->
counter
.
GetBytes
());
...
@@ -101,8 +99,11 @@ namespace RTC
...
@@ -101,8 +99,11 @@ namespace RTC
this
->
cycles
+
static_cast
<
uint32_t
>
(
packet
->
GetSequenceNumber
()));
this
->
cycles
+
static_cast
<
uint32_t
>
(
packet
->
GetSequenceNumber
()));
// Update highest seen RTP timestamp.
// Update highest seen RTP timestamp.
if
(
packet
->
GetTimestamp
()
>
this
->
maxTimestamp
)
if
(
packet
->
GetTimestamp
()
>
this
->
maxPacketTs
)
this
->
maxTimestamp
=
packet
->
GetTimestamp
();
{
this
->
maxPacketTs
=
packet
->
GetTimestamp
();
this
->
maxPacketMs
=
DepLibUV
::
GetTime
();
}
return
true
;
return
true
;
}
}
...
@@ -122,7 +123,7 @@ namespace RTC
...
@@ -122,7 +123,7 @@ namespace RTC
this
->
baseSeq
=
seq
;
this
->
baseSeq
=
seq
;
this
->
maxSeq
=
seq
;
this
->
maxSeq
=
seq
;
this
->
badSeq
=
RtpSeqMod
+
1
;
// So seq == badSeq is false.
this
->
badSeq
=
RtpSeqMod
+
1
;
// So seq == badSeq is false.
this
->
max
Timestamp
=
0
;
// Also reset the highest seen RTP timestamp.
this
->
max
PacketTs
=
0
;
// Also reset the highest seen RTP timestamp.
}
}
bool
RtpStream
::
UpdateSeq
(
RTC
::
RtpPacket
*
packet
)
bool
RtpStream
::
UpdateSeq
(
RTC
::
RtpPacket
*
packet
)
...
...
worker/src/RTC/RtpStreamSend.cpp
浏览文件 @
e6b11d1c
...
@@ -12,7 +12,8 @@ namespace RTC
...
@@ -12,7 +12,8 @@ namespace RTC
static
constexpr
uint32_t
RtpSeqMod
{
1
<<
16
};
static
constexpr
uint32_t
RtpSeqMod
{
1
<<
16
};
// Don't retransmit packets older than this (ms).
// 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
};
static
constexpr
uint32_t
DefaultRtt
{
100
};
/* Instance methods. */
/* Instance methods. */
...
@@ -43,10 +44,6 @@ namespace RTC
...
@@ -43,10 +44,6 @@ namespace RTC
if
(
!
this
->
storage
.
empty
())
if
(
!
this
->
storage
.
empty
())
StorePacket
(
packet
);
StorePacket
(
packet
);
// Record current time and RTP timestamp.
this
->
lastPacketTimeMs
=
DepLibUV
::
GetTime
();
this
->
lastPacketRtpTimestamp
=
packet
->
GetTimestamp
();
return
true
;
return
true
;
}
}
...
@@ -182,13 +179,18 @@ namespace RTC
...
@@ -182,13 +179,18 @@ namespace RTC
if
(
currentSeq32
==
seq32
)
if
(
currentSeq32
==
seq32
)
{
{
auto
currentPacket
=
(
*
bufferIt
).
packet
;
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.
// Just provide the packet if no older than MaxRetransmissionDelay ms.
if
(
diffMs
>
MaxRetransmissionDelay
)
if
(
diffMs
>
MaxRetransmissionDelay
)
{
{
if
(
!
tooOldPacketFound
)
if
(
!
tooOldPacketFound
)
{
{
// TODO: May we ask for a key frame in this case?
MS_WARN_TAG
(
MS_WARN_TAG
(
rtx
,
rtx
,
"ignoring retransmission for too old packet "
"ignoring retransmission for too old packet "
...
@@ -230,6 +232,7 @@ namespace RTC
...
@@ -230,6 +232,7 @@ namespace RTC
break
;
break
;
}
}
// It can not be after this packet.
// It can not be after this packet.
if
(
currentSeq32
>
seq32
)
if
(
currentSeq32
>
seq32
)
break
;
break
;
...
@@ -296,10 +299,10 @@ namespace RTC
...
@@ -296,10 +299,10 @@ namespace RTC
report
->
SetNtpFrac
(
ntp
.
fractions
);
report
->
SetNtpFrac
(
ntp
.
fractions
);
// Calculate RTP timestamp diff between now and last received RTP packet.
// Calculate RTP timestamp diff between now and last received RTP packet.
uint32_t
diffMs
=
now
-
this
->
lastPacketTimeMs
;
auto
diffMs
=
static_cast
<
uint32_t
>
(
now
-
this
->
maxPacketMs
)
;
uint32_t
diff
RtpTimestamp
=
diffMs
*
this
->
params
.
clockRate
/
1000
;
uint32_t
diff
Ts
=
diffMs
*
this
->
params
.
clockRate
/
1000
;
report
->
SetRtpTs
(
this
->
lastPacketRtpTimestamp
+
diffRtpTimestamp
);
report
->
SetRtpTs
(
this
->
maxPacketTs
+
diffTs
);
return
report
;
return
report
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论