Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
5da274f0
提交
5da274f0
authored
3月 26, 2017
作者:
Iñaki Baz Castillo
提交者:
GitHub
3月 26, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #77 from ibc/rtt
Rtt calculation. Closes #73
上级
f4dcdc1f
0bc5513d
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
61 行增加
和
2 行删除
+61
-2
RtpSender.hpp
worker/include/RTC/RtpSender.hpp
+2
-0
RtpStreamSend.hpp
worker/include/RTC/RtpStreamSend.hpp
+10
-0
Room.cpp
worker/src/RTC/Room.cpp
+1
-2
RtpSender.cpp
worker/src/RTC/RtpSender.cpp
+14
-0
RtpStreamSend.cpp
worker/src/RTC/RtpStreamSend.cpp
+34
-0
没有找到文件。
worker/include/RTC/RtpSender.hpp
浏览文件 @
5da274f0
...
...
@@ -8,6 +8,7 @@
#include "RTC/RtpPacket.hpp"
#include "RTC/RtpDataCounter.hpp"
#include "RTC/RTCP/Sdes.hpp"
#include "RTC/RTCP/ReceiverReport.hpp"
#include "RTC/RTCP/FeedbackRtpNack.hpp"
#include "RTC/RTCP/CompoundPacket.hpp"
#include "Channel/Request.hpp"
...
...
@@ -61,6 +62,7 @@ namespace RTC
void
SendRtpPacket
(
RTC
::
RtpPacket
*
packet
);
void
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
uint64_t
now
);
void
ReceiveNack
(
RTC
::
RTCP
::
FeedbackRtpNackPacket
*
nackPacket
);
void
ReceiveRtcpReceiverReport
(
RTC
::
RTCP
::
ReceiverReport
*
report
);
uint32_t
GetTransmissionRate
(
uint64_t
now
);
private
:
...
...
worker/include/RTC/RtpStreamSend.hpp
浏览文件 @
5da274f0
...
...
@@ -3,6 +3,7 @@
#include "RTC/RtpStream.hpp"
#include "RTC/RTCP/SenderReport.hpp"
#include "RTC/RTCP/ReceiverReport.hpp"
#include <vector>
#include <list>
...
...
@@ -30,8 +31,10 @@ namespace RTC
virtual
Json
::
Value
toJson
()
const
override
;
bool
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
override
;
void
ReceiveRtcpReceiverReport
(
RTC
::
RTCP
::
ReceiverReport
*
report
);
void
RequestRtpRetransmission
(
uint16_t
seq
,
uint16_t
bitmask
,
std
::
vector
<
RTC
::
RtpPacket
*>&
container
);
RTC
::
RTCP
::
SenderReport
*
GetRtcpSenderReport
(
uint64_t
now
);
uint32_t
GetRtt
()
const
;
private
:
void
ClearBuffer
();
...
...
@@ -50,7 +53,14 @@ namespace RTC
size_t
receivedBytes
=
0
;
// Bytes received.
uint64_t
lastPacketTimeMs
=
0
;
// Time (MS) when the last packet was received.
uint32_t
lastPacketRtpTimestamp
=
0
;
// RTP Timestamp of the last packet.
uint32_t
rtt
;
// Round trip time.
};
inline
uint32_t
RtpStreamSend
::
GetRtt
()
const
{
return
this
->
rtt
;
}
}
#endif
worker/src/RTC/Room.cpp
浏览文件 @
5da274f0
...
...
@@ -624,8 +624,7 @@ namespace RTC
MS_ASSERT
(
this
->
mapRtpSenderRtpReceiver
.
find
(
rtpSender
)
!=
this
->
mapRtpSenderRtpReceiver
.
end
(),
"RtpSender not present in the map"
);
// TODO: Calculate real downstream stats for the given RtpSender,
// considering the ReceiverReport generated locally and this one.
rtpSender
->
ReceiveRtcpReceiverReport
(
report
);
}
void
Room
::
onPeerRtcpFeedback
(
RTC
::
Peer
*
peer
,
RTC
::
RtpSender
*
rtpSender
,
RTC
::
RTCP
::
FeedbackPsPacket
*
packet
)
...
...
worker/src/RTC/RtpSender.cpp
浏览文件 @
5da274f0
...
...
@@ -385,6 +385,20 @@ namespace RTC
}
}
void
RtpSender
::
ReceiveRtcpReceiverReport
(
RTC
::
RTCP
::
ReceiverReport
*
report
)
{
MS_TRACE
();
if
(
!
this
->
rtpStream
)
{
MS_WARN_TAG
(
rtp
,
"no RtpStreamSend"
);
return
;
}
this
->
rtpStream
->
ReceiveRtcpReceiverReport
(
report
);
}
void
RtpSender
::
CreateRtpStream
(
RTC
::
RtpEncodingParameters
&
encoding
)
{
MS_TRACE
();
...
...
worker/src/RTC/RtpStreamSend.cpp
浏览文件 @
5da274f0
...
...
@@ -36,6 +36,7 @@ namespace RTC
static
const
Json
::
StaticString
k_received
(
"received"
);
static
const
Json
::
StaticString
k_maxTimestamp
(
"maxTimestamp"
);
static
const
Json
::
StaticString
k_receivedBytes
(
"receivedBytes"
);
static
const
Json
::
StaticString
k_rtt
(
"rtt"
);
Json
::
Value
json
(
Json
::
objectValue
);
...
...
@@ -43,6 +44,7 @@ namespace RTC
json
[
k_received
]
=
(
Json
::
UInt
)
this
->
received
;
json
[
k_maxTimestamp
]
=
(
Json
::
UInt
)
this
->
max_timestamp
;
json
[
k_receivedBytes
]
=
(
Json
::
UInt
)
this
->
receivedBytes
;
json
[
k_rtt
]
=
(
Json
::
UInt
)
this
->
rtt
;
return
json
;
}
...
...
@@ -69,6 +71,38 @@ namespace RTC
return
true
;
}
void
RtpStreamSend
::
ReceiveRtcpReceiverReport
(
RTC
::
RTCP
::
ReceiverReport
*
report
)
{
MS_TRACE
();
/* Calculate RTT. */
// If no SR has been received yet, Last Sender Timestamp is set to zero.
if
(
report
->
GetLastSenderReport
()
==
0
)
{
// TODO: Remove.
MS_DEBUG_TAG
(
rtp
,
"report->GetLastSenderReport() == 0"
);
report
->
Dump
();
return
;
}
// Get the compact NTP representation of the current timestamp.
Utils
::
Time
::
Ntp
nowNtp
;
Utils
::
Time
::
CurrentTimeNtp
(
nowNtp
);
uint32_t
nowCompactNtp
=
(
nowNtp
.
seconds
&
0x0000FFFF
)
<<
16
;
nowCompactNtp
|=
(
nowNtp
.
fractions
&
0xFFFF0000
)
>>
16
;
uint32_t
lastSr
=
report
->
GetLastSenderReport
();
uint32_t
dlsr
=
report
->
GetDelaySinceLastSenderReport
();
// RTT in 1/2^16 seconds.
uint32_t
rtt
=
nowCompactNtp
-
dlsr
-
lastSr
;
// RTT in milliseconds.
this
->
rtt
=
((
rtt
>>
16
)
*
1000
);
this
->
rtt
+=
(
static_cast
<
float
>
(
rtt
&
0x0000FFFF
)
/
65536
)
*
1000
;
}
// This method looks for the requested RTP packets and inserts them into the
// given container (and set to null the next container position).
void
RtpStreamSend
::
RequestRtpRetransmission
(
uint16_t
seq
,
uint16_t
bitmask
,
std
::
vector
<
RTC
::
RtpPacket
*>&
container
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论