Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
18c32d29
提交
18c32d29
authored
4月 10, 2019
作者:
José Luis Millán
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RtpStream: spatial and temporal layer granularity transmission counters
上级
694d28c5
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
213 行增加
和
19 行删除
+213
-19
H264.hpp
worker/include/RTC/Codecs/H264.hpp
+6
-0
PayloadDescriptorHandler.hpp
worker/include/RTC/Codecs/PayloadDescriptorHandler.hpp
+1
-0
VP8.hpp
worker/include/RTC/Codecs/VP8.hpp
+6
-0
RtpPacket.hpp
worker/include/RTC/RtpPacket.hpp
+9
-0
RtpStream.hpp
worker/include/RTC/RtpStream.hpp
+5
-10
RtpStreamRecv.hpp
worker/include/RTC/RtpStreamRecv.hpp
+38
-0
RtpStreamSend.hpp
worker/include/RTC/RtpStreamSend.hpp
+12
-0
RtpStream.cpp
worker/src/RTC/RtpStream.cpp
+0
-6
RtpStreamRecv.cpp
worker/src/RTC/RtpStreamRecv.cpp
+119
-3
RtpStreamSend.cpp
worker/src/RTC/RtpStreamSend.cpp
+17
-0
没有找到文件。
worker/include/RTC/Codecs/H264.hpp
浏览文件 @
18c32d29
...
@@ -46,6 +46,7 @@ namespace RTC
...
@@ -46,6 +46,7 @@ namespace RTC
void
Dump
()
const
;
void
Dump
()
const
;
bool
Encode
(
RTC
::
Codecs
::
EncodingContext
*
context
,
uint8_t
*
data
);
bool
Encode
(
RTC
::
Codecs
::
EncodingContext
*
context
,
uint8_t
*
data
);
void
Restore
(
uint8_t
*
data
);
void
Restore
(
uint8_t
*
data
);
uint8_t
GetSpatialLayer
()
const
;
uint8_t
GetTemporalLayer
()
const
;
uint8_t
GetTemporalLayer
()
const
;
bool
IsKeyFrame
()
const
;
bool
IsKeyFrame
()
const
;
...
@@ -70,6 +71,11 @@ namespace RTC
...
@@ -70,6 +71,11 @@ namespace RTC
{
{
}
}
inline
uint8_t
H264
::
PayloadDescriptorHandler
::
GetSpatialLayer
()
const
{
return
0u
;
};
inline
uint8_t
H264
::
PayloadDescriptorHandler
::
GetTemporalLayer
()
const
inline
uint8_t
H264
::
PayloadDescriptorHandler
::
GetTemporalLayer
()
const
{
{
return
0u
;
return
0u
;
...
...
worker/include/RTC/Codecs/PayloadDescriptorHandler.hpp
浏览文件 @
18c32d29
...
@@ -45,6 +45,7 @@ namespace RTC
...
@@ -45,6 +45,7 @@ namespace RTC
virtual
void
Dump
()
const
=
0
;
virtual
void
Dump
()
const
=
0
;
virtual
bool
Encode
(
RTC
::
Codecs
::
EncodingContext
*
context
,
uint8_t
*
data
)
=
0
;
virtual
bool
Encode
(
RTC
::
Codecs
::
EncodingContext
*
context
,
uint8_t
*
data
)
=
0
;
virtual
void
Restore
(
uint8_t
*
data
)
=
0
;
virtual
void
Restore
(
uint8_t
*
data
)
=
0
;
virtual
uint8_t
GetSpatialLayer
()
const
=
0
;
virtual
uint8_t
GetTemporalLayer
()
const
=
0
;
virtual
uint8_t
GetTemporalLayer
()
const
=
0
;
virtual
bool
IsKeyFrame
()
const
=
0
;
virtual
bool
IsKeyFrame
()
const
=
0
;
...
...
worker/include/RTC/Codecs/VP8.hpp
浏览文件 @
18c32d29
...
@@ -102,6 +102,7 @@ namespace RTC
...
@@ -102,6 +102,7 @@ namespace RTC
void
Dump
()
const
;
void
Dump
()
const
;
bool
Encode
(
RTC
::
Codecs
::
EncodingContext
*
encodingContext
,
uint8_t
*
data
);
bool
Encode
(
RTC
::
Codecs
::
EncodingContext
*
encodingContext
,
uint8_t
*
data
);
void
Restore
(
uint8_t
*
data
);
void
Restore
(
uint8_t
*
data
);
uint8_t
GetSpatialLayer
()
const
;
uint8_t
GetTemporalLayer
()
const
;
uint8_t
GetTemporalLayer
()
const
;
bool
IsKeyFrame
()
const
;
bool
IsKeyFrame
()
const
;
...
@@ -119,6 +120,11 @@ namespace RTC
...
@@ -119,6 +120,11 @@ namespace RTC
/* Inline PayloadDescriptorHandler methods */
/* Inline PayloadDescriptorHandler methods */
inline
uint8_t
VP8
::
PayloadDescriptorHandler
::
GetSpatialLayer
()
const
{
return
0u
;
};
inline
uint8_t
VP8
::
PayloadDescriptorHandler
::
GetTemporalLayer
()
const
inline
uint8_t
VP8
::
PayloadDescriptorHandler
::
GetTemporalLayer
()
const
{
{
if
(
this
->
payloadDescriptor
->
hasTlIndex
)
if
(
this
->
payloadDescriptor
->
hasTlIndex
)
...
...
worker/include/RTC/RtpPacket.hpp
浏览文件 @
18c32d29
...
@@ -137,6 +137,7 @@ namespace RTC
...
@@ -137,6 +137,7 @@ namespace RTC
uint8_t
*
GetPayload
()
const
;
uint8_t
*
GetPayload
()
const
;
size_t
GetPayloadLength
()
const
;
size_t
GetPayloadLength
()
const
;
uint8_t
GetPayloadPadding
()
const
;
uint8_t
GetPayloadPadding
()
const
;
uint8_t
GetSpatialLayer
()
const
;
uint8_t
GetTemporalLayer
()
const
;
uint8_t
GetTemporalLayer
()
const
;
bool
IsKeyFrame
()
const
;
bool
IsKeyFrame
()
const
;
RtpPacket
*
Clone
(
const
uint8_t
*
buffer
)
const
;
RtpPacket
*
Clone
(
const
uint8_t
*
buffer
)
const
;
...
@@ -509,6 +510,14 @@ namespace RTC
...
@@ -509,6 +510,14 @@ namespace RTC
return
this
->
payloadDescriptorHandler
->
GetTemporalLayer
();
return
this
->
payloadDescriptorHandler
->
GetTemporalLayer
();
}
}
inline
uint8_t
RtpPacket
::
GetSpatialLayer
()
const
{
if
(
!
this
->
payloadDescriptorHandler
)
return
0u
;
return
this
->
payloadDescriptorHandler
->
GetSpatialLayer
();
}
inline
bool
RtpPacket
::
IsKeyFrame
()
const
inline
bool
RtpPacket
::
IsKeyFrame
()
const
{
{
if
(
!
this
->
payloadDescriptorHandler
)
if
(
!
this
->
payloadDescriptorHandler
)
...
...
worker/include/RTC/RtpStream.hpp
浏览文件 @
18c32d29
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
#include "RTC/RTCP/ReceiverReport.hpp"
#include "RTC/RTCP/ReceiverReport.hpp"
#include "RTC/RTCP/Sdes.hpp"
#include "RTC/RTCP/Sdes.hpp"
#include "RTC/RTCP/SenderReport.hpp"
#include "RTC/RTCP/SenderReport.hpp"
#include "RTC/RtpDataCounter.hpp"
#include "RTC/RtpDictionaries.hpp"
#include "RTC/RtpDictionaries.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/RtpPacket.hpp"
#include <string>
#include <string>
...
@@ -71,10 +70,12 @@ namespace RTC
...
@@ -71,10 +70,12 @@ namespace RTC
uint8_t
GetSpatialLayers
()
const
;
uint8_t
GetSpatialLayers
()
const
;
uint8_t
GetTemporalLayers
()
const
;
uint8_t
GetTemporalLayers
()
const
;
virtual
bool
ReceivePacket
(
RTC
::
RtpPacket
*
packet
);
virtual
bool
ReceivePacket
(
RTC
::
RtpPacket
*
packet
);
virtual
void
Pause
()
=
0
;
virtual
void
Pause
()
=
0
;
virtual
void
Resume
()
=
0
;
virtual
void
Resume
()
=
0
;
virtual
uint32_t
GetBitrate
(
uint64_t
now
)
=
0
;
virtual
uint32_t
GetBitrate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
)
=
0
;
virtual
uint32_t
GetLayerBitrate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
)
=
0
;
void
ResetScore
(
uint8_t
score
,
bool
notify
);
void
ResetScore
(
uint8_t
score
,
bool
notify
);
uint32_t
GetBitrate
(
uint64_t
now
);
uint8_t
GetFractionLost
()
const
;
uint8_t
GetFractionLost
()
const
;
float
GetLossPercentage
()
const
;
float
GetLossPercentage
()
const
;
uint64_t
GetMaxPacketMs
()
const
;
uint64_t
GetMaxPacketMs
()
const
;
...
@@ -114,7 +115,6 @@ namespace RTC
...
@@ -114,7 +115,6 @@ namespace RTC
size_t
repairedPrior
{
0
};
// Packets repaired at last interval.
size_t
repairedPrior
{
0
};
// Packets repaired at last interval.
size_t
retransmittedPrior
{
0
};
// Packets retransmitted at last interval.
size_t
retransmittedPrior
{
0
};
// Packets retransmitted at last interval.
uint32_t
expectedPrior
{
0
};
// Packets expected at last interval.
uint32_t
expectedPrior
{
0
};
// Packets expected at last interval.
RTC
::
RtpDataCounter
transmissionCounter
;
private
:
private
:
// Score related.
// Score related.
...
@@ -191,11 +191,6 @@ namespace RTC
...
@@ -191,11 +191,6 @@ namespace RTC
return
this
->
params
.
temporalLayers
;
return
this
->
params
.
temporalLayers
;
}
}
inline
uint32_t
RtpStream
::
GetBitrate
(
uint64_t
now
)
{
return
this
->
transmissionCounter
.
GetRate
(
now
);
}
inline
uint8_t
RtpStream
::
GetFractionLost
()
const
inline
uint8_t
RtpStream
::
GetFractionLost
()
const
{
{
return
this
->
fractionLost
;
return
this
->
fractionLost
;
...
...
worker/include/RTC/RtpStreamRecv.hpp
浏览文件 @
18c32d29
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define MS_RTC_RTP_STREAM_RECV_HPP
#define MS_RTC_RTP_STREAM_RECV_HPP
#include "RTC/NackGenerator.hpp"
#include "RTC/NackGenerator.hpp"
#include "RTC/RtpDataCounter.hpp"
#include "RTC/RtpStream.hpp"
#include "RTC/RtpStream.hpp"
#include "handles/Timer.hpp"
#include "handles/Timer.hpp"
#include <vector>
#include <vector>
...
@@ -22,6 +23,22 @@ namespace RTC
...
@@ -22,6 +23,22 @@ namespace RTC
RTC
::
RtpStreamRecv
*
rtpStream
,
uint8_t
&
worstRemoteFractionLost
)
=
0
;
RTC
::
RtpStreamRecv
*
rtpStream
,
uint8_t
&
worstRemoteFractionLost
)
=
0
;
};
};
public
:
class
TransmissionCounter
{
public
:
TransmissionCounter
(
uint8_t
spatialLayers
,
uint8_t
temporalLayers
);
void
Update
(
RTC
::
RtpPacket
*
packet
);
uint32_t
GetRate
(
uint64_t
now
);
uint32_t
GetRate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
);
uint32_t
GetLayerRate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
);
size_t
GetPacketCount
()
const
;
size_t
GetBytes
()
const
;
private
:
std
::
vector
<
std
::
vector
<
RTC
::
RtpDataCounter
>>
spatialLayerCounters
;
};
public
:
public
:
RtpStreamRecv
(
RTC
::
RtpStreamRecv
::
Listener
*
listener
,
RTC
::
RtpStream
::
Params
&
params
);
RtpStreamRecv
(
RTC
::
RtpStreamRecv
::
Listener
*
listener
,
RTC
::
RtpStream
::
Params
&
params
);
~
RtpStreamRecv
();
~
RtpStreamRecv
();
...
@@ -35,6 +52,9 @@ namespace RTC
...
@@ -35,6 +52,9 @@ namespace RTC
void
RequestKeyFrame
();
void
RequestKeyFrame
();
void
Pause
()
override
;
void
Pause
()
override
;
void
Resume
()
override
;
void
Resume
()
override
;
uint32_t
GetBitrate
(
uint64_t
now
)
override
;
uint32_t
GetBitrate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
)
override
;
uint32_t
GetLayerBitrate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
)
override
;
private
:
private
:
void
CalculateJitter
(
uint32_t
rtpTimestamp
);
void
CalculateJitter
(
uint32_t
rtpTimestamp
);
...
@@ -63,7 +83,25 @@ namespace RTC
...
@@ -63,7 +83,25 @@ namespace RTC
bool
inactive
{
false
};
// Stream is inactive.
bool
inactive
{
false
};
// Stream is inactive.
std
::
unique_ptr
<
RTC
::
NackGenerator
>
nackGenerator
;
std
::
unique_ptr
<
RTC
::
NackGenerator
>
nackGenerator
;
Timer
*
inactivityCheckPeriodicTimer
{
nullptr
};
Timer
*
inactivityCheckPeriodicTimer
{
nullptr
};
TransmissionCounter
transmissionCounter
;
};
};
/* Inline instance methods */
inline
uint32_t
RtpStreamRecv
::
GetBitrate
(
uint64_t
now
)
{
return
this
->
transmissionCounter
.
GetRate
(
now
);
}
inline
uint32_t
RtpStreamRecv
::
GetBitrate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
)
{
return
this
->
transmissionCounter
.
GetRate
(
now
,
spatialLayer
,
temporalLayer
);
}
inline
uint32_t
RtpStreamRecv
::
GetLayerBitrate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
)
{
return
this
->
transmissionCounter
.
GetRate
(
now
,
spatialLayer
,
temporalLayer
);
}
}
// namespace RTC
}
// namespace RTC
#endif
#endif
worker/include/RTC/RtpStreamSend.hpp
浏览文件 @
18c32d29
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define MS_RTC_RTP_STREAM_SEND_HPP
#define MS_RTC_RTP_STREAM_SEND_HPP
#include "Utils.hpp"
#include "Utils.hpp"
#include "RTC/RtpDataCounter.hpp"
#include "RTC/RtpStream.hpp"
#include "RTC/RtpStream.hpp"
#include <list>
#include <list>
#include <vector>
#include <vector>
...
@@ -50,6 +51,9 @@ namespace RTC
...
@@ -50,6 +51,9 @@ namespace RTC
RTC
::
RTCP
::
SdesChunk
*
GetRtcpSdesChunk
();
RTC
::
RTCP
::
SdesChunk
*
GetRtcpSdesChunk
();
void
Pause
()
override
;
void
Pause
()
override
;
void
Resume
()
override
;
void
Resume
()
override
;
uint32_t
GetBitrate
(
uint64_t
now
)
override
;
uint32_t
GetBitrate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
)
override
;
uint32_t
GetLayerBitrate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
)
override
;
private
:
private
:
void
StorePacket
(
RTC
::
RtpPacket
*
packet
);
void
StorePacket
(
RTC
::
RtpPacket
*
packet
);
...
@@ -64,14 +68,22 @@ namespace RTC
...
@@ -64,14 +68,22 @@ namespace RTC
std
::
list
<
BufferItem
>
buffer
;
std
::
list
<
BufferItem
>
buffer
;
float
rtt
{
0
};
float
rtt
{
0
};
uint16_t
rtxSeq
{
0
};
uint16_t
rtxSeq
{
0
};
RTC
::
RtpDataCounter
transmissionCounter
;
};
};
/* Inline instance methods */
inline
void
RtpStreamSend
::
SetRtx
(
uint8_t
payloadType
,
uint32_t
ssrc
)
inline
void
RtpStreamSend
::
SetRtx
(
uint8_t
payloadType
,
uint32_t
ssrc
)
{
{
RTC
::
RtpStream
::
SetRtx
(
payloadType
,
ssrc
);
RTC
::
RtpStream
::
SetRtx
(
payloadType
,
ssrc
);
this
->
rtxSeq
=
Utils
::
Crypto
::
GetRandomUInt
(
0u
,
0xFFFF
);
this
->
rtxSeq
=
Utils
::
Crypto
::
GetRandomUInt
(
0u
,
0xFFFF
);
}
}
inline
uint32_t
RtpStreamSend
::
GetBitrate
(
uint64_t
now
)
{
return
this
->
transmissionCounter
.
GetRate
(
now
);
}
}
// namespace RTC
}
// namespace RTC
#endif
#endif
worker/src/RTC/RtpStream.cpp
浏览文件 @
18c32d29
...
@@ -50,15 +50,9 @@ namespace RTC
...
@@ -50,15 +50,9 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
uint64_t
now
=
DepLibUV
::
GetTime
();
jsonObject
[
"timestamp"
]
=
now
;
jsonObject
[
"ssrc"
]
=
this
->
params
.
ssrc
;
jsonObject
[
"ssrc"
]
=
this
->
params
.
ssrc
;
jsonObject
[
"kind"
]
=
RtpCodecMimeType
::
type2String
[
this
->
params
.
mimeType
.
type
];
jsonObject
[
"kind"
]
=
RtpCodecMimeType
::
type2String
[
this
->
params
.
mimeType
.
type
];
jsonObject
[
"mimeType"
]
=
this
->
params
.
mimeType
.
ToString
();
jsonObject
[
"mimeType"
]
=
this
->
params
.
mimeType
.
ToString
();
jsonObject
[
"packetCount"
]
=
this
->
transmissionCounter
.
GetPacketCount
();
jsonObject
[
"byteCount"
]
=
this
->
transmissionCounter
.
GetBytes
();
jsonObject
[
"bitrate"
]
=
this
->
transmissionCounter
.
GetRate
(
now
);
jsonObject
[
"packetsLost"
]
=
this
->
packetsLost
;
jsonObject
[
"packetsLost"
]
=
this
->
packetsLost
;
jsonObject
[
"fractionLost"
]
=
this
->
fractionLost
;
jsonObject
[
"fractionLost"
]
=
this
->
fractionLost
;
jsonObject
[
"packetsDiscarded"
]
=
this
->
packetsDiscarded
;
jsonObject
[
"packetsDiscarded"
]
=
this
->
packetsDiscarded
;
...
...
worker/src/RTC/RtpStreamRecv.cpp
浏览文件 @
18c32d29
...
@@ -12,10 +12,120 @@ namespace RTC
...
@@ -12,10 +12,120 @@ namespace RTC
static
constexpr
uint16_t
InactivityCheckPeriod
{
250
};
static
constexpr
uint16_t
InactivityCheckPeriod
{
250
};
/* TransmissionCounter methods. */
RtpStreamRecv
::
TransmissionCounter
::
TransmissionCounter
(
uint8_t
spatialLayers
,
uint8_t
temporalLayers
)
{
// Reserve vectors capacity.
this
->
spatialLayerCounters
=
std
::
vector
<
std
::
vector
<
RTC
::
RtpDataCounter
>>
(
spatialLayers
);
;
for
(
auto
&
spatialLayerCounter
:
this
->
spatialLayerCounters
)
{
spatialLayerCounter
=
std
::
vector
<
RTC
::
RtpDataCounter
>
(
temporalLayers
);
}
}
void
RtpStreamRecv
::
TransmissionCounter
::
Update
(
RTC
::
RtpPacket
*
packet
)
{
auto
spatialLayer
=
packet
->
GetSpatialLayer
();
auto
temporalLayer
=
packet
->
GetTemporalLayer
();
// Sanity check. Do not allow spatial layers higher than defined.
if
(
spatialLayer
>
this
->
spatialLayerCounters
.
size
()
-
1
)
spatialLayer
=
this
->
spatialLayerCounters
.
size
()
-
1
;
// Sanity check. Do not allow temporal layers higher than defined.
if
(
temporalLayer
>
this
->
spatialLayerCounters
[
0
].
size
()
-
1
)
temporalLayer
=
this
->
spatialLayerCounters
[
0
].
size
()
-
1
;
auto
&
counter
=
this
->
spatialLayerCounters
.
at
(
spatialLayer
).
at
(
temporalLayer
);
counter
.
Update
(
packet
);
}
uint32_t
RtpStreamRecv
::
TransmissionCounter
::
GetRate
(
uint64_t
now
)
{
uint32_t
rate
{
0u
};
for
(
auto
&
spatialLayerCounter
:
this
->
spatialLayerCounters
)
{
for
(
auto
&
temporalLayerCounter
:
spatialLayerCounter
)
{
rate
+=
temporalLayerCounter
.
GetRate
(
now
);
}
}
return
rate
;
}
uint32_t
RtpStreamRecv
::
TransmissionCounter
::
GetRate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
)
{
uint32_t
rate
{
0u
};
uint8_t
spatialLayerIdx
{
0u
};
uint8_t
temporalLayerIdx
{
0u
};
for
(
auto
&
spatialLayerCounter
:
this
->
spatialLayerCounters
)
{
for
(
auto
&
temporalLayerCounter
:
spatialLayerCounter
)
{
rate
+=
temporalLayerCounter
.
GetRate
(
now
);
if
(
++
temporalLayerIdx
>
temporalLayer
)
break
;
}
if
(
++
spatialLayerIdx
>
spatialLayer
)
break
;
}
return
rate
;
}
size_t
RtpStreamRecv
::
TransmissionCounter
::
GetPacketCount
()
const
{
size_t
packetCount
{
0u
};
for
(
auto
&
spatialLayerCounter
:
this
->
spatialLayerCounters
)
{
for
(
auto
&
temporalLayerCounter
:
spatialLayerCounter
)
{
packetCount
+=
temporalLayerCounter
.
GetPacketCount
();
}
}
return
packetCount
;
}
size_t
RtpStreamRecv
::
TransmissionCounter
::
GetBytes
()
const
{
size_t
bytes
{
0u
};
for
(
auto
&
spatialLayerCounter
:
this
->
spatialLayerCounters
)
{
for
(
auto
&
temporalLayerCounter
:
spatialLayerCounter
)
{
bytes
+=
temporalLayerCounter
.
GetBytes
();
}
}
return
bytes
;
}
uint32_t
RtpStreamRecv
::
TransmissionCounter
::
GetLayerRate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
)
{
auto
&
counter
=
this
->
spatialLayerCounters
.
at
(
spatialLayer
).
at
(
temporalLayer
);
return
counter
.
GetRate
(
now
);
}
/* Instance methods. */
/* Instance methods. */
RtpStreamRecv
::
RtpStreamRecv
(
RTC
::
RtpStreamRecv
::
Listener
*
listener
,
RTC
::
RtpStream
::
Params
&
params
)
RtpStreamRecv
::
RtpStreamRecv
(
RTC
::
RtpStreamRecv
::
Listener
*
listener
,
RTC
::
RtpStream
::
Params
&
params
)
:
RTC
::
RtpStream
::
RtpStream
(
listener
,
params
,
10
)
:
RTC
::
RtpStream
::
RtpStream
(
listener
,
params
,
10
),
transmissionCounter
(
params
.
spatialLayers
,
params
.
temporalLayers
)
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -45,10 +155,16 @@ namespace RTC
...
@@ -45,10 +155,16 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
uint64_t
now
=
DepLibUV
::
GetTime
();
RTC
::
RtpStream
::
FillJsonStats
(
jsonObject
);
RTC
::
RtpStream
::
FillJsonStats
(
jsonObject
);
jsonObject
[
"type"
]
=
"inbound-rtp"
;
jsonObject
[
"timestamp"
]
=
now
;
jsonObject
[
"jitter"
]
=
this
->
jitter
;
jsonObject
[
"type"
]
=
"inbound-rtp"
;
jsonObject
[
"jitter"
]
=
this
->
jitter
;
jsonObject
[
"packetCount"
]
=
this
->
transmissionCounter
.
GetPacketCount
();
jsonObject
[
"byteCount"
]
=
this
->
transmissionCounter
.
GetBytes
();
jsonObject
[
"bitrate"
]
=
this
->
transmissionCounter
.
GetRate
(
now
);
}
}
bool
RtpStreamRecv
::
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
bool
RtpStreamRecv
::
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
...
...
worker/src/RTC/RtpStreamSend.cpp
浏览文件 @
18c32d29
...
@@ -39,10 +39,16 @@ namespace RTC
...
@@ -39,10 +39,16 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
uint64_t
now
=
DepLibUV
::
GetTime
();
RTC
::
RtpStream
::
FillJsonStats
(
jsonObject
);
RTC
::
RtpStream
::
FillJsonStats
(
jsonObject
);
jsonObject
[
"timestamp"
]
=
now
;
jsonObject
[
"type"
]
=
"outbound-rtp"
;
jsonObject
[
"type"
]
=
"outbound-rtp"
;
jsonObject
[
"roundTripTime"
]
=
this
->
rtt
;
jsonObject
[
"roundTripTime"
]
=
this
->
rtt
;
jsonObject
[
"packetCount"
]
=
this
->
transmissionCounter
.
GetPacketCount
();
jsonObject
[
"byteCount"
]
=
this
->
transmissionCounter
.
GetBytes
();
jsonObject
[
"bitrate"
]
=
this
->
transmissionCounter
.
GetRate
(
now
);
}
}
bool
RtpStreamSend
::
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
bool
RtpStreamSend
::
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
...
@@ -209,6 +215,17 @@ namespace RTC
...
@@ -209,6 +215,17 @@ namespace RTC
MS_TRACE
();
MS_TRACE
();
}
}
uint32_t
RtpStreamSend
::
GetBitrate
(
uint64_t
/*now*/
,
uint8_t
/*spatialLayer*/
,
uint8_t
/*temporalLayer*/
)
{
MS_ABORT
(
"Invalid method call"
);
}
uint32_t
RtpStreamSend
::
GetLayerBitrate
(
uint64_t
/*now*/
,
uint8_t
/*spatialLayer*/
,
uint8_t
/*temporalLayer*/
)
{
MS_ABORT
(
"Invalid method call"
);
}
void
RtpStreamSend
::
ClearRetransmissionBuffer
()
void
RtpStreamSend
::
ClearRetransmissionBuffer
()
{
{
MS_TRACE
();
MS_TRACE
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论