Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
3bdad193
Unverified
提交
3bdad193
authored
2月 03, 2023
作者:
José Luis Millán
提交者:
GitHub
2月 03, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Worker: More const correctness and qualified auto enhancements (#1006)
上级
f02edc62
显示空白字符变更
内嵌
并排
正在显示
31 个修改的文件
包含
114 行增加
和
112 行删除
+114
-112
.clang-tidy
worker/.clang-tidy
+1
-1
Consumer.cpp
worker/src/RTC/Consumer.cpp
+1
-1
DirectTransport.cpp
worker/src/RTC/DirectTransport.cpp
+3
-3
PipeConsumer.cpp
worker/src/RTC/PipeConsumer.cpp
+2
-2
PortManager.cpp
worker/src/RTC/PortManager.cpp
+3
-3
Producer.cpp
worker/src/RTC/Producer.cpp
+17
-17
RateCalculator.cpp
worker/src/RTC/RateCalculator.cpp
+1
-1
Router.cpp
worker/src/RTC/Router.cpp
+1
-1
RtpListener.cpp
worker/src/RTC/RtpListener.cpp
+9
-9
RtpPacket.cpp
worker/src/RTC/RtpPacket.cpp
+1
-1
RtpProbationGenerator.cpp
worker/src/RTC/RtpProbationGenerator.cpp
+1
-1
RtpStreamRecv.cpp
worker/src/RTC/RtpStreamRecv.cpp
+9
-8
RtpStreamSend.cpp
worker/src/RTC/RtpStreamSend.cpp
+4
-4
SctpAssociation.cpp
worker/src/RTC/SctpAssociation.cpp
+3
-3
SenderBandwidthEstimator.cpp
worker/src/RTC/SenderBandwidthEstimator.cpp
+1
-1
SeqManager.cpp
worker/src/RTC/SeqManager.cpp
+1
-1
SimulcastConsumer.cpp
worker/src/RTC/SimulcastConsumer.cpp
+4
-4
StunPacket.cpp
worker/src/RTC/StunPacket.cpp
+5
-4
Transport.cpp
worker/src/RTC/Transport.cpp
+8
-8
TransportCongestionControlServer.cpp
worker/src/RTC/TransportCongestionControlServer.cpp
+1
-1
TrendCalculator.cpp
worker/src/RTC/TrendCalculator.cpp
+1
-1
WebRtcServer.cpp
worker/src/RTC/WebRtcServer.cpp
+2
-2
WebRtcTransport.cpp
worker/src/RTC/WebRtcTransport.cpp
+3
-3
Settings.cpp
worker/src/Settings.cpp
+1
-1
Worker.cpp
worker/src/Worker.cpp
+5
-5
SignalsHandler.cpp
worker/src/handles/SignalsHandler.cpp
+1
-1
TcpConnectionHandler.cpp
worker/src/handles/TcpConnectionHandler.cpp
+1
-1
UnixStreamSocket.cpp
worker/src/handles/UnixStreamSocket.cpp
+1
-1
main.cpp
worker/src/main.cpp
+1
-1
TestRtpPacket.cpp
worker/test/src/RTC/TestRtpPacket.cpp
+1
-1
TestRtpStreamSend.cpp
worker/test/src/RTC/TestRtpStreamSend.cpp
+21
-21
没有找到文件。
worker/.clang-tidy
浏览文件 @
3bdad193
---
---
Checks: '*,-llvmlibc-*,-boost-use-to-string,-cert-*,-clang-analyzer-osx.*,-clang-analyzer-optin.osx.*,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-special-member-functions,-google-readability-*,-llvm-include-order,-readability-else-after-return,-readability-implicit-bool-cast,-modernize-pass-by-value,-cppcoreguidelines-no-malloc,-modernize-make-unique,-google-default-arguments,-hicpp-uppercase-literal-suffix,-readability-uppercase-literal-suffix,-hicpp-braces-around-statements,-hicpp-vararg,-hicpp-no-array-decay,-cppcoreguidelines-avoid-c-arrays,-hicpp-avoid-c-arrays,-modernize-avoid-c-arrays,-fuchsia-default-arguments-calls,-readability-implicit-bool-conversion,-modernize-use-trailing-return-type,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-init-variables,-readability-magic-numbers,-cppcoreguidelines-avoid-goto,-hicpp-avoid-goto,-cppcoreguidelines-owning-memory,-hicpp-special-member-functions,-google-runtime-references,-fuchsia-default-arguments-declarations,-cppcoreguidelines-non-private-member-variables-in-classes,-misc-non-private-member-variables-in-classes,-hicpp-signed-bitwise,-readability-function-cognitive-complexity,-altera*'
Checks: '*,-llvmlibc-*,-boost-use-to-string,-cert-*,-clang-analyzer-osx.*,-clang-analyzer-optin.osx.*,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-special-member-functions,-google-readability-*,-llvm-include-order,-readability-else-after-return,-readability-implicit-bool-cast,-modernize-pass-by-value,-cppcoreguidelines-no-malloc,-modernize-make-unique,-google-default-arguments,-hicpp-uppercase-literal-suffix,-readability-uppercase-literal-suffix,-hicpp-braces-around-statements,-hicpp-vararg,-hicpp-no-array-decay,-cppcoreguidelines-avoid-c-arrays,-hicpp-avoid-c-arrays,-modernize-avoid-c-arrays,-fuchsia-default-arguments-calls,-readability-implicit-bool-conversion,-modernize-use-trailing-return-type,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-init-variables,-readability-magic-numbers,-cppcoreguidelines-avoid-goto,-hicpp-avoid-goto,-cppcoreguidelines-owning-memory,-hicpp-special-member-functions,-google-runtime-references,-fuchsia-default-arguments-declarations,-cppcoreguidelines-non-private-member-variables-in-classes,-misc-non-private-member-variables-in-classes,-hicpp-signed-bitwise,-readability-function-cognitive-complexity,-altera*
,-readability-identifier-length
'
HeaderFilterRegex: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
AnalyzeTemporaryDtors: false
...
...
worker/src/RTC/Consumer.cpp
浏览文件 @
3bdad193
...
@@ -347,7 +347,7 @@ namespace RTC
...
@@ -347,7 +347,7 @@ namespace RTC
if
(
!
type
.
is_string
())
if
(
!
type
.
is_string
())
MS_THROW_TYPE_ERROR
(
"wrong type (not a string)"
);
MS_THROW_TYPE_ERROR
(
"wrong type (not a string)"
);
std
::
string
typeStr
=
type
.
get
<
std
::
string
>
();
const
std
::
string
typeStr
=
type
.
get
<
std
::
string
>
();
if
(
typeStr
==
"rtp"
)
if
(
typeStr
==
"rtp"
)
newTraceEventTypes
.
rtp
=
true
;
newTraceEventTypes
.
rtp
=
true
;
...
...
worker/src/RTC/DirectTransport.cpp
浏览文件 @
3bdad193
...
@@ -122,7 +122,7 @@ namespace RTC
...
@@ -122,7 +122,7 @@ namespace RTC
}
}
const
uint8_t
*
data
=
packet
->
GetData
();
const
uint8_t
*
data
=
packet
->
GetData
();
size_t
len
=
packet
->
GetSize
();
const
size_t
len
=
packet
->
GetSize
();
// Notify the Node DirectTransport.
// Notify the Node DirectTransport.
this
->
shared
->
payloadChannelNotifier
->
Emit
(
consumer
->
id
,
"rtp"
,
data
,
len
);
this
->
shared
->
payloadChannelNotifier
->
Emit
(
consumer
->
id
,
"rtp"
,
data
,
len
);
...
@@ -142,7 +142,7 @@ namespace RTC
...
@@ -142,7 +142,7 @@ namespace RTC
MS_TRACE
();
MS_TRACE
();
const
uint8_t
*
data
=
packet
->
GetData
();
const
uint8_t
*
data
=
packet
->
GetData
();
size_t
len
=
packet
->
GetSize
();
const
size_t
len
=
packet
->
GetSize
();
// Notify the Node DirectTransport.
// Notify the Node DirectTransport.
this
->
shared
->
payloadChannelNotifier
->
Emit
(
this
->
id
,
"rtcp"
,
data
,
len
);
this
->
shared
->
payloadChannelNotifier
->
Emit
(
this
->
id
,
"rtcp"
,
data
,
len
);
...
@@ -158,7 +158,7 @@ namespace RTC
...
@@ -158,7 +158,7 @@ namespace RTC
packet
->
Serialize
(
RTC
::
RTCP
::
Buffer
);
packet
->
Serialize
(
RTC
::
RTCP
::
Buffer
);
const
uint8_t
*
data
=
packet
->
GetData
();
const
uint8_t
*
data
=
packet
->
GetData
();
size_t
len
=
packet
->
GetSize
();
const
size_t
len
=
packet
->
GetSize
();
// Notify the Node DirectTransport.
// Notify the Node DirectTransport.
this
->
shared
->
payloadChannelNotifier
->
Emit
(
this
->
id
,
"rtcp"
,
data
,
len
);
this
->
shared
->
payloadChannelNotifier
->
Emit
(
this
->
id
,
"rtcp"
,
data
,
len
);
...
...
worker/src/RTC/PipeConsumer.cpp
浏览文件 @
3bdad193
...
@@ -26,7 +26,7 @@ namespace RTC
...
@@ -26,7 +26,7 @@ namespace RTC
MS_THROW_TYPE_ERROR
(
"number of rtpParameters.encodings and consumableRtpEncodings do not match"
);
MS_THROW_TYPE_ERROR
(
"number of rtpParameters.encodings and consumableRtpEncodings do not match"
);
auto
&
encoding
=
this
->
rtpParameters
.
encodings
[
0
];
auto
&
encoding
=
this
->
rtpParameters
.
encodings
[
0
];
auto
*
mediaCodec
=
this
->
rtpParameters
.
GetCodecForEncoding
(
encoding
);
const
auto
*
mediaCodec
=
this
->
rtpParameters
.
GetCodecForEncoding
(
encoding
);
this
->
keyFrameSupported
=
RTC
::
Codecs
::
Tools
::
CanBeKeyFrame
(
mediaCodec
->
mimeType
);
this
->
keyFrameSupported
=
RTC
::
Codecs
::
Tools
::
CanBeKeyFrame
(
mediaCodec
->
mimeType
);
...
@@ -226,7 +226,7 @@ namespace RTC
...
@@ -226,7 +226,7 @@ namespace RTC
return
;
return
;
// Whether this is the first packet after re-sync.
// Whether this is the first packet after re-sync.
bool
isSyncPacket
=
syncRequired
;
const
bool
isSyncPacket
=
syncRequired
;
// Sync sequence number and timestamp if required.
// Sync sequence number and timestamp if required.
if
(
isSyncPacket
)
if
(
isSyncPacket
)
...
...
worker/src/RTC/PortManager.cpp
浏览文件 @
3bdad193
...
@@ -39,13 +39,13 @@ namespace RTC
...
@@ -39,13 +39,13 @@ namespace RTC
Utils
::
IP
::
NormalizeIp
(
ip
);
Utils
::
IP
::
NormalizeIp
(
ip
);
int
err
;
int
err
;
int
family
=
Utils
::
IP
::
GetFamily
(
ip
);
const
int
family
=
Utils
::
IP
::
GetFamily
(
ip
);
struct
sockaddr_storage
bindAddr
;
// NOLINT(cppcoreguidelines-pro-type-member-init)
struct
sockaddr_storage
bindAddr
;
// NOLINT(cppcoreguidelines-pro-type-member-init)
size_t
portIdx
;
size_t
portIdx
;
int
flags
{
0
};
int
flags
{
0
};
std
::
vector
<
bool
>&
ports
=
PortManager
::
GetPorts
(
transport
,
ip
);
std
::
vector
<
bool
>&
ports
=
PortManager
::
GetPorts
(
transport
,
ip
);
size_t
attempt
{
0u
};
size_t
attempt
{
0u
};
size_t
numAttempts
=
ports
.
size
();
const
size_t
numAttempts
=
ports
.
size
();
uv_handle_t
*
uvHandle
{
nullptr
};
uv_handle_t
*
uvHandle
{
nullptr
};
uint16_t
port
;
uint16_t
port
;
std
::
string
transportStr
;
std
::
string
transportStr
;
...
@@ -322,7 +322,7 @@ namespace RTC
...
@@ -322,7 +322,7 @@ namespace RTC
Utils
::
IP
::
NormalizeIp
(
ip
);
Utils
::
IP
::
NormalizeIp
(
ip
);
int
err
;
int
err
;
int
family
=
Utils
::
IP
::
GetFamily
(
ip
);
const
int
family
=
Utils
::
IP
::
GetFamily
(
ip
);
struct
sockaddr_storage
bindAddr
;
// NOLINT(cppcoreguidelines-pro-type-member-init)
struct
sockaddr_storage
bindAddr
;
// NOLINT(cppcoreguidelines-pro-type-member-init)
int
flags
{
0
};
int
flags
{
0
};
uv_handle_t
*
uvHandle
{
nullptr
};
uv_handle_t
*
uvHandle
{
nullptr
};
...
...
worker/src/RTC/Producer.cpp
浏览文件 @
3bdad193
...
@@ -67,7 +67,7 @@ namespace RTC
...
@@ -67,7 +67,7 @@ namespace RTC
this
->
rtpStreamScores
.
resize
(
this
->
rtpParameters
.
encodings
.
size
(),
0u
);
this
->
rtpStreamScores
.
resize
(
this
->
rtpParameters
.
encodings
.
size
(),
0u
);
auto
&
encoding
=
this
->
rtpParameters
.
encodings
[
0
];
auto
&
encoding
=
this
->
rtpParameters
.
encodings
[
0
];
auto
*
mediaCodec
=
this
->
rtpParameters
.
GetCodecForEncoding
(
encoding
);
const
auto
*
mediaCodec
=
this
->
rtpParameters
.
GetCodecForEncoding
(
encoding
);
if
(
!
RTC
::
Codecs
::
Tools
::
IsValidTypeForCodec
(
this
->
type
,
mediaCodec
->
mimeType
))
if
(
!
RTC
::
Codecs
::
Tools
::
IsValidTypeForCodec
(
this
->
type
,
mediaCodec
->
mimeType
))
{
{
...
@@ -373,7 +373,7 @@ namespace RTC
...
@@ -373,7 +373,7 @@ namespace RTC
auto
jsonCodecsIt
=
jsonRtpMappingIt
->
find
(
"codecs"
);
auto
jsonCodecsIt
=
jsonRtpMappingIt
->
find
(
"codecs"
);
size_t
idx
{
0
};
size_t
idx
{
0
};
for
(
auto
&
kv
:
this
->
rtpMapping
.
codecs
)
for
(
const
auto
&
kv
:
this
->
rtpMapping
.
codecs
)
{
{
jsonCodecsIt
->
emplace_back
(
json
::
value_t
::
object
);
jsonCodecsIt
->
emplace_back
(
json
::
value_t
::
object
);
...
@@ -590,7 +590,7 @@ namespace RTC
...
@@ -590,7 +590,7 @@ namespace RTC
if
(
!
type
.
is_string
())
if
(
!
type
.
is_string
())
MS_THROW_TYPE_ERROR
(
"wrong type (not a string)"
);
MS_THROW_TYPE_ERROR
(
"wrong type (not a string)"
);
std
::
string
typeStr
=
type
.
get
<
std
::
string
>
();
const
std
::
string
typeStr
=
type
.
get
<
std
::
string
>
();
if
(
typeStr
==
"rtp"
)
if
(
typeStr
==
"rtp"
)
newTraceEventTypes
.
rtp
=
true
;
newTraceEventTypes
.
rtp
=
true
;
...
@@ -782,7 +782,7 @@ namespace RTC
...
@@ -782,7 +782,7 @@ namespace RTC
if
(
it
!=
this
->
mapSsrcRtpStream
.
end
())
if
(
it
!=
this
->
mapSsrcRtpStream
.
end
())
{
{
auto
*
rtpStream
=
it
->
second
;
auto
*
rtpStream
=
it
->
second
;
bool
first
=
rtpStream
->
GetSenderReportNtpMs
()
==
0
;
const
bool
first
=
rtpStream
->
GetSenderReportNtpMs
()
==
0
;
rtpStream
->
ReceiveRtcpSenderReport
(
report
);
rtpStream
->
ReceiveRtcpSenderReport
(
report
);
...
@@ -882,7 +882,7 @@ namespace RTC
...
@@ -882,7 +882,7 @@ namespace RTC
return
;
return
;
}
}
uint32_t
ssrc
=
it
->
second
;
const
uint32_t
ssrc
=
it
->
second
;
// If the current RTP packet is a key frame for the given mapped SSRC do
// If the current RTP packet is a key frame for the given mapped SSRC do
// nothing since we are gonna provide Consumers with the requested key frame
// nothing since we are gonna provide Consumers with the requested key frame
...
@@ -909,8 +909,8 @@ namespace RTC
...
@@ -909,8 +909,8 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
uint32_t
ssrc
=
packet
->
GetSsrc
();
const
uint32_t
ssrc
=
packet
->
GetSsrc
();
uint8_t
payloadType
=
packet
->
GetPayloadType
();
const
uint8_t
payloadType
=
packet
->
GetPayloadType
();
// If stream found in media ssrcs map, return it.
// If stream found in media ssrcs map, return it.
{
{
...
@@ -944,8 +944,8 @@ namespace RTC
...
@@ -944,8 +944,8 @@ namespace RTC
auto
&
encoding
=
this
->
rtpParameters
.
encodings
[
i
];
auto
&
encoding
=
this
->
rtpParameters
.
encodings
[
i
];
const
auto
*
mediaCodec
=
this
->
rtpParameters
.
GetCodecForEncoding
(
encoding
);
const
auto
*
mediaCodec
=
this
->
rtpParameters
.
GetCodecForEncoding
(
encoding
);
const
auto
*
rtxCodec
=
this
->
rtpParameters
.
GetRtxCodecForEncoding
(
encoding
);
const
auto
*
rtxCodec
=
this
->
rtpParameters
.
GetRtxCodecForEncoding
(
encoding
);
bool
isMediaPacket
=
(
mediaCodec
->
payloadType
==
payloadType
);
const
bool
isMediaPacket
=
(
mediaCodec
->
payloadType
==
payloadType
);
bool
isRtxPacket
=
(
rtxCodec
&&
rtxCodec
->
payloadType
==
payloadType
);
const
bool
isRtxPacket
=
(
rtxCodec
&&
rtxCodec
->
payloadType
==
payloadType
);
if
(
isMediaPacket
&&
encoding
.
ssrc
==
ssrc
)
if
(
isMediaPacket
&&
encoding
.
ssrc
==
ssrc
)
{
{
...
@@ -999,8 +999,8 @@ namespace RTC
...
@@ -999,8 +999,8 @@ namespace RTC
const
auto
*
mediaCodec
=
this
->
rtpParameters
.
GetCodecForEncoding
(
encoding
);
const
auto
*
mediaCodec
=
this
->
rtpParameters
.
GetCodecForEncoding
(
encoding
);
const
auto
*
rtxCodec
=
this
->
rtpParameters
.
GetRtxCodecForEncoding
(
encoding
);
const
auto
*
rtxCodec
=
this
->
rtpParameters
.
GetRtxCodecForEncoding
(
encoding
);
bool
isMediaPacket
=
(
mediaCodec
->
payloadType
==
payloadType
);
const
bool
isMediaPacket
=
(
mediaCodec
->
payloadType
==
payloadType
);
bool
isRtxPacket
=
(
rtxCodec
&&
rtxCodec
->
payloadType
==
payloadType
);
const
bool
isRtxPacket
=
(
rtxCodec
&&
rtxCodec
->
payloadType
==
payloadType
);
if
(
isMediaPacket
)
if
(
isMediaPacket
)
{
{
...
@@ -1074,8 +1074,8 @@ namespace RTC
...
@@ -1074,8 +1074,8 @@ namespace RTC
auto
&
encoding
=
this
->
rtpParameters
.
encodings
[
0
];
auto
&
encoding
=
this
->
rtpParameters
.
encodings
[
0
];
const
auto
*
mediaCodec
=
this
->
rtpParameters
.
GetCodecForEncoding
(
encoding
);
const
auto
*
mediaCodec
=
this
->
rtpParameters
.
GetCodecForEncoding
(
encoding
);
const
auto
*
rtxCodec
=
this
->
rtpParameters
.
GetRtxCodecForEncoding
(
encoding
);
const
auto
*
rtxCodec
=
this
->
rtpParameters
.
GetRtxCodecForEncoding
(
encoding
);
bool
isMediaPacket
=
(
mediaCodec
->
payloadType
==
payloadType
);
const
bool
isMediaPacket
=
(
mediaCodec
->
payloadType
==
payloadType
);
bool
isRtxPacket
=
(
rtxCodec
&&
rtxCodec
->
payloadType
==
payloadType
);
const
bool
isRtxPacket
=
(
rtxCodec
&&
rtxCodec
->
payloadType
==
payloadType
);
if
(
isMediaPacket
)
if
(
isMediaPacket
)
{
{
...
@@ -1134,7 +1134,7 @@ namespace RTC
...
@@ -1134,7 +1134,7 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
uint32_t
ssrc
=
packet
->
GetSsrc
();
const
uint32_t
ssrc
=
packet
->
GetSsrc
();
MS_ASSERT
(
MS_ASSERT
(
this
->
mapSsrcRtpStream
.
find
(
ssrc
)
==
this
->
mapSsrcRtpStream
.
end
(),
this
->
mapSsrcRtpStream
.
find
(
ssrc
)
==
this
->
mapSsrcRtpStream
.
end
(),
...
@@ -1263,7 +1263,7 @@ namespace RTC
...
@@ -1263,7 +1263,7 @@ namespace RTC
// Mangle the payload type.
// Mangle the payload type.
{
{
uint8_t
payloadType
=
packet
->
GetPayloadType
();
const
uint8_t
payloadType
=
packet
->
GetPayloadType
();
auto
it
=
this
->
rtpMapping
.
codecs
.
find
(
payloadType
);
auto
it
=
this
->
rtpMapping
.
codecs
.
find
(
payloadType
);
if
(
it
==
this
->
rtpMapping
.
codecs
.
end
())
if
(
it
==
this
->
rtpMapping
.
codecs
.
end
())
...
@@ -1273,14 +1273,14 @@ namespace RTC
...
@@ -1273,14 +1273,14 @@ namespace RTC
return
false
;
return
false
;
}
}
uint8_t
mappedPayloadType
=
it
->
second
;
const
uint8_t
mappedPayloadType
=
it
->
second
;
packet
->
SetPayloadType
(
mappedPayloadType
);
packet
->
SetPayloadType
(
mappedPayloadType
);
}
}
// Mangle the SSRC.
// Mangle the SSRC.
{
{
uint32_t
mappedSsrc
=
this
->
mapRtpStreamMappedSsrc
.
at
(
rtpStream
);
const
uint32_t
mappedSsrc
=
this
->
mapRtpStreamMappedSsrc
.
at
(
rtpStream
);
packet
->
SetSsrc
(
mappedSsrc
);
packet
->
SetSsrc
(
mappedSsrc
);
}
}
...
...
worker/src/RTC/RateCalculator.cpp
浏览文件 @
3bdad193
...
@@ -116,7 +116,7 @@ namespace RTC
...
@@ -116,7 +116,7 @@ namespace RTC
void
RtpDataCounter
::
Update
(
RTC
::
RtpPacket
*
packet
)
void
RtpDataCounter
::
Update
(
RTC
::
RtpPacket
*
packet
)
{
{
uint64_t
nowMs
=
DepLibUV
::
GetTimeMs
();
const
uint64_t
nowMs
=
DepLibUV
::
GetTimeMs
();
this
->
packets
++
;
this
->
packets
++
;
this
->
rate
.
Update
(
packet
->
GetSize
(),
nowMs
);
this
->
rate
.
Update
(
packet
->
GetSize
(),
nowMs
);
...
...
worker/src/RTC/Router.cpp
浏览文件 @
3bdad193
...
@@ -790,7 +790,7 @@ namespace RTC
...
@@ -790,7 +790,7 @@ namespace RTC
for
(
const
auto
&
kv
:
producer
->
GetRtpStreams
())
for
(
const
auto
&
kv
:
producer
->
GetRtpStreams
())
{
{
auto
*
rtpStream
=
kv
.
first
;
auto
*
rtpStream
=
kv
.
first
;
uint32_t
mappedSsrc
=
kv
.
second
;
const
uint32_t
mappedSsrc
=
kv
.
second
;
consumer
->
ProducerRtpStream
(
rtpStream
,
mappedSsrc
);
consumer
->
ProducerRtpStream
(
rtpStream
,
mappedSsrc
);
}
}
...
...
worker/src/RTC/RtpListener.cpp
浏览文件 @
3bdad193
...
@@ -23,7 +23,7 @@ namespace RTC
...
@@ -23,7 +23,7 @@ namespace RTC
auto
jsonRidTableIt
=
jsonObject
.
find
(
"ridTable"
);
auto
jsonRidTableIt
=
jsonObject
.
find
(
"ridTable"
);
// Add ssrcTable.
// Add ssrcTable.
for
(
auto
&
kv
:
this
->
ssrcTable
)
for
(
const
auto
&
kv
:
this
->
ssrcTable
)
{
{
auto
ssrc
=
kv
.
first
;
auto
ssrc
=
kv
.
first
;
auto
*
producer
=
kv
.
second
;
auto
*
producer
=
kv
.
second
;
...
@@ -32,18 +32,18 @@ namespace RTC
...
@@ -32,18 +32,18 @@ namespace RTC
}
}
// Add midTable.
// Add midTable.
for
(
auto
&
kv
:
this
->
midTable
)
for
(
const
auto
&
kv
:
this
->
midTable
)
{
{
auto
&
mid
=
kv
.
first
;
const
auto
&
mid
=
kv
.
first
;
auto
*
producer
=
kv
.
second
;
auto
*
producer
=
kv
.
second
;
(
*
jsonMidTableIt
)[
mid
]
=
producer
->
id
;
(
*
jsonMidTableIt
)[
mid
]
=
producer
->
id
;
}
}
// Add ridTable.
// Add ridTable.
for
(
auto
&
kv
:
this
->
ridTable
)
for
(
const
auto
&
kv
:
this
->
ridTable
)
{
{
auto
&
rid
=
kv
.
first
;
const
auto
&
rid
=
kv
.
first
;
auto
*
producer
=
kv
.
second
;
auto
*
producer
=
kv
.
second
;
(
*
jsonRidTableIt
)[
rid
]
=
producer
->
id
;
(
*
jsonRidTableIt
)[
rid
]
=
producer
->
id
;
...
@@ -57,7 +57,7 @@ namespace RTC
...
@@ -57,7 +57,7 @@ namespace RTC
const
auto
&
rtpParameters
=
producer
->
GetRtpParameters
();
const
auto
&
rtpParameters
=
producer
->
GetRtpParameters
();
// Add entries into the ssrcTable.
// Add entries into the ssrcTable.
for
(
auto
&
encoding
:
rtpParameters
.
encodings
)
for
(
const
auto
&
encoding
:
rtpParameters
.
encodings
)
{
{
uint32_t
ssrc
;
uint32_t
ssrc
;
...
@@ -99,7 +99,7 @@ namespace RTC
...
@@ -99,7 +99,7 @@ namespace RTC
// Add entries into midTable.
// Add entries into midTable.
if
(
!
rtpParameters
.
mid
.
empty
())
if
(
!
rtpParameters
.
mid
.
empty
())
{
{
auto
&
mid
=
rtpParameters
.
mid
;
const
auto
&
mid
=
rtpParameters
.
mid
;
if
(
this
->
midTable
.
find
(
mid
)
==
this
->
midTable
.
end
())
if
(
this
->
midTable
.
find
(
mid
)
==
this
->
midTable
.
end
())
{
{
...
@@ -114,9 +114,9 @@ namespace RTC
...
@@ -114,9 +114,9 @@ namespace RTC
}
}
// Add entries into ridTable.
// Add entries into ridTable.
for
(
auto
&
encoding
:
rtpParameters
.
encodings
)
for
(
const
auto
&
encoding
:
rtpParameters
.
encodings
)
{
{
auto
&
rid
=
encoding
.
rid
;
const
auto
&
rid
=
encoding
.
rid
;
if
(
rid
.
empty
())
if
(
rid
.
empty
())
continue
;
continue
;
...
...
worker/src/RTC/RtpPacket.cpp
浏览文件 @
3bdad193
...
@@ -543,7 +543,7 @@ namespace RTC
...
@@ -543,7 +543,7 @@ namespace RTC
if
(
!
extenValue
)
if
(
!
extenValue
)
return
;
return
;
size_t
midLen
=
mid
.
length
();
const
size_t
midLen
=
mid
.
length
();
// Here we assume that there is MidMaxLength available bytes, even if now
// Here we assume that there is MidMaxLength available bytes, even if now
// they are padding bytes.
// they are padding bytes.
...
...
worker/src/RTC/RtpProbationGenerator.cpp
浏览文件 @
3bdad193
...
@@ -17,7 +17,7 @@ namespace RTC
...
@@ -17,7 +17,7 @@ namespace RTC
// Probation RTP header.
// Probation RTP header.
// Caution: This must have an exact size for the RTP extensions to be added
// Caution: This must have an exact size for the RTP extensions to be added
// and must align extensions to 4 bytes.
// and must align extensions to 4 bytes.
static
uint8_t
ProbationPacketHeader
[]
=
static
const
uint8_t
ProbationPacketHeader
[]
=
{
{
0
b10010000
,
0
b01111111
,
0
,
0
,
// PayloadType: 127, Sequence Number: 0
0
b10010000
,
0
b01111111
,
0
,
0
,
// PayloadType: 127, Sequence Number: 0
0
,
0
,
0
,
0
,
// Timestamp: 0
0
,
0
,
0
,
0
,
// Timestamp: 0
...
...
worker/src/RTC/RtpStreamRecv.cpp
浏览文件 @
3bdad193
...
@@ -440,11 +440,12 @@ namespace RTC
...
@@ -440,11 +440,12 @@ namespace RTC
this
->
packetsLost
=
0u
;
this
->
packetsLost
=
0u
;
// Calculate Fraction Lost.
// Calculate Fraction Lost.
uint32_t
expectedInterval
=
expected
-
this
->
expectedPrior
;
const
uint32_t
expectedInterval
=
expected
-
this
->
expectedPrior
;
this
->
expectedPrior
=
expected
;
this
->
expectedPrior
=
expected
;
uint32_t
receivedInterval
=
this
->
mediaTransmissionCounter
.
GetPacketCount
()
-
this
->
receivedPrior
;
const
uint32_t
receivedInterval
=
this
->
mediaTransmissionCounter
.
GetPacketCount
()
-
this
->
receivedPrior
;
this
->
receivedPrior
=
this
->
mediaTransmissionCounter
.
GetPacketCount
();
this
->
receivedPrior
=
this
->
mediaTransmissionCounter
.
GetPacketCount
();
...
@@ -669,14 +670,14 @@ namespace RTC
...
@@ -669,14 +670,14 @@ namespace RTC
MS_TRACE
();
MS_TRACE
();
// Calculate number of packets expected in this interval.
// Calculate number of packets expected in this interval.
auto
totalExpected
=
GetExpectedPackets
();
const
auto
totalExpected
=
GetExpectedPackets
();
uint32_t
expected
=
totalExpected
-
this
->
expectedPriorScore
;
const
uint32_t
expected
=
totalExpected
-
this
->
expectedPriorScore
;
this
->
expectedPriorScore
=
totalExpected
;
this
->
expectedPriorScore
=
totalExpected
;
// Calculate number of packets received in this interval.
// Calculate number of packets received in this interval.
auto
totalReceived
=
this
->
mediaTransmissionCounter
.
GetPacketCount
();
const
auto
totalReceived
=
this
->
mediaTransmissionCounter
.
GetPacketCount
();
uint32_t
received
=
totalReceived
-
this
->
receivedPriorScore
;
const
uint32_t
received
=
totalReceived
-
this
->
receivedPriorScore
;
this
->
receivedPriorScore
=
totalReceived
;
this
->
receivedPriorScore
=
totalReceived
;
...
@@ -689,13 +690,13 @@ namespace RTC
...
@@ -689,13 +690,13 @@ namespace RTC
lost
=
expected
-
received
;
lost
=
expected
-
received
;
// Calculate number of packets repaired in this interval.
// Calculate number of packets repaired in this interval.
auto
totalRepaired
=
this
->
packetsRepaired
;
const
auto
totalRepaired
=
this
->
packetsRepaired
;
uint32_t
repaired
=
totalRepaired
-
this
->
repairedPriorScore
;
uint32_t
repaired
=
totalRepaired
-
this
->
repairedPriorScore
;
this
->
repairedPriorScore
=
totalRepaired
;
this
->
repairedPriorScore
=
totalRepaired
;
// Calculate number of packets retransmitted in this interval.
// Calculate number of packets retransmitted in this interval.
auto
totatRetransmitted
=
this
->
packetsRetransmitted
;
const
auto
totatRetransmitted
=
this
->
packetsRetransmitted
;
uint32_t
retransmitted
=
totatRetransmitted
-
this
->
retransmittedPriorScore
;
uint32_t
retransmitted
=
totatRetransmitted
-
this
->
retransmittedPriorScore
;
this
->
retransmittedPriorScore
=
totatRetransmitted
;
this
->
retransmittedPriorScore
=
totatRetransmitted
;
...
...
worker/src/RTC/RtpStreamSend.cpp
浏览文件 @
3bdad193
...
@@ -180,7 +180,7 @@ namespace RTC
...
@@ -180,7 +180,7 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
uint64_t
nowMs
=
DepLibUV
::
GetTimeMs
();
const
uint64_t
nowMs
=
DepLibUV
::
GetTimeMs
();
RTC
::
RtpStream
::
FillJsonStats
(
jsonObject
);
RTC
::
RtpStream
::
FillJsonStats
(
jsonObject
);
...
@@ -465,7 +465,7 @@ namespace RTC
...
@@ -465,7 +465,7 @@ namespace RTC
// Processing RTP packet is older than first one.
// Processing RTP packet is older than first one.
if
(
RTC
::
SeqManager
<
uint32_t
>::
IsSeqLowerThan
(
packet
->
GetTimestamp
(),
storageItem
->
timestamp
))
if
(
RTC
::
SeqManager
<
uint32_t
>::
IsSeqLowerThan
(
packet
->
GetTimestamp
(),
storageItem
->
timestamp
))
{
{
uint32_t
diffTs
{
storageItem
->
timestamp
-
packet
->
GetTimestamp
()
};
const
uint32_t
diffTs
{
storageItem
->
timestamp
-
packet
->
GetTimestamp
()
};
// RTP packet is older than the retransmission buffer size.
// RTP packet is older than the retransmission buffer size.
if
(
static_cast
<
uint32_t
>
(
diffTs
*
1000
/
this
->
params
.
clockRate
)
>=
this
->
retransmissionBufferSize
)
if
(
static_cast
<
uint32_t
>
(
diffTs
*
1000
/
this
->
params
.
clockRate
)
>=
this
->
retransmissionBufferSize
)
...
@@ -523,7 +523,7 @@ namespace RTC
...
@@ -523,7 +523,7 @@ namespace RTC
for
(
size_t
i
{
0
};
i
<
bufferSize
&&
this
->
storageItemBuffer
.
GetBufferSize
()
!=
0
;
++
i
)
for
(
size_t
i
{
0
};
i
<
bufferSize
&&
this
->
storageItemBuffer
.
GetBufferSize
()
!=
0
;
++
i
)
{
{
auto
*
storageItem
=
this
->
storageItemBuffer
.
GetFirst
();
auto
*
storageItem
=
this
->
storageItemBuffer
.
GetFirst
();
uint32_t
diffTs
{
packet
->
GetTimestamp
()
-
storageItem
->
timestamp
};
const
uint32_t
diffTs
{
packet
->
GetTimestamp
()
-
storageItem
->
timestamp
};
// Processing RTP packet is older than first one.
// Processing RTP packet is older than first one.
if
(
RTC
::
SeqManager
<
uint32_t
>::
IsSeqLowerThan
(
packet
->
GetTimestamp
(),
storageItem
->
timestamp
))
if
(
RTC
::
SeqManager
<
uint32_t
>::
IsSeqLowerThan
(
packet
->
GetTimestamp
(),
storageItem
->
timestamp
))
...
@@ -605,7 +605,7 @@ namespace RTC
...
@@ -605,7 +605,7 @@ namespace RTC
if
(
!
this
->
mid
.
empty
())
if
(
!
this
->
mid
.
empty
())
packet
->
UpdateMid
(
mid
);
packet
->
UpdateMid
(
mid
);
uint32_t
diffTs
=
this
->
maxPacketTs
-
packet
->
GetTimestamp
();
const
uint32_t
diffTs
=
this
->
maxPacketTs
-
packet
->
GetTimestamp
();
diffMs
=
diffTs
*
1000
/
this
->
params
.
clockRate
;
diffMs
=
diffTs
*
1000
/
this
->
params
.
clockRate
;
}
}
...
...
worker/src/RTC/SctpAssociation.cpp
浏览文件 @
3bdad193
...
@@ -11,12 +11,12 @@
...
@@ -11,12 +11,12 @@
#include <string>
#include <string>
// Free send buffer threshold (in bytes) upon which send_cb will be executed.
// Free send buffer threshold (in bytes) upon which send_cb will be executed.
static
uint32_t
SendBufferThreshold
{
256u
};
static
const
uint32_t
SendBufferThreshold
{
256u
};
/* SCTP events to which we are subscribing. */
/* SCTP events to which we are subscribing. */
/* clang-format off */
/* clang-format off */
uint16_t
EventTypes
[]
=
const
uint16_t
EventTypes
[]
=
{
{
SCTP_ADAPTATION_INDICATION
,
SCTP_ADAPTATION_INDICATION
,
SCTP_ASSOC_CHANGE
,
SCTP_ASSOC_CHANGE
,
...
@@ -59,7 +59,7 @@ inline static int onRecvSctpData(
...
@@ -59,7 +59,7 @@ inline static int onRecvSctpData(
else
else
{
{
const
uint16_t
streamId
=
rcv
.
rcv_sid
;
const
uint16_t
streamId
=
rcv
.
rcv_sid
;
uint32_t
ppid
=
ntohl
(
rcv
.
rcv_ppid
);
const
uint32_t
ppid
=
ntohl
(
rcv
.
rcv_ppid
);
const
uint16_t
ssn
=
rcv
.
rcv_ssn
;
const
uint16_t
ssn
=
rcv
.
rcv_ssn
;
MS_DEBUG_TAG
(
MS_DEBUG_TAG
(
...
...
worker/src/RTC/SenderBandwidthEstimator.cpp
浏览文件 @
3bdad193
...
@@ -95,7 +95,7 @@ namespace RTC
...
@@ -95,7 +95,7 @@ namespace RTC
if
(
!
result
.
received
)
if
(
!
result
.
received
)
continue
;
continue
;
uint16_t
wideSeq
=
result
.
sequenceNumber
;
const
uint16_t
wideSeq
=
result
.
sequenceNumber
;
auto
it
=
this
->
sentInfos
.
find
(
wideSeq
);
auto
it
=
this
->
sentInfos
.
find
(
wideSeq
);
if
(
it
==
this
->
sentInfos
.
end
())
if
(
it
==
this
->
sentInfos
.
end
())
...
...
worker/src/RTC/SeqManager.cpp
浏览文件 @
3bdad193
...
@@ -86,7 +86,7 @@ namespace RTC
...
@@ -86,7 +86,7 @@ namespace RTC
{
{
// Delete dropped inputs older than input - MaxValue/2.
// Delete dropped inputs older than input - MaxValue/2.
size_t
droppedCount
=
this
->
dropped
.
size
();
size_t
droppedCount
=
this
->
dropped
.
size
();
size_t
threshold
=
(
input
-
MaxValue
/
2
)
&
MaxValue
;
const
size_t
threshold
=
(
input
-
MaxValue
/
2
)
&
MaxValue
;
auto
it
=
this
->
dropped
.
lower_bound
(
threshold
);
auto
it
=
this
->
dropped
.
lower_bound
(
threshold
);
this
->
dropped
.
erase
(
this
->
dropped
.
begin
(),
it
);
this
->
dropped
.
erase
(
this
->
dropped
.
begin
(),
it
);
this
->
base
=
(
this
->
base
-
(
droppedCount
-
this
->
dropped
.
size
()))
&
MaxValue
;
this
->
base
=
(
this
->
base
-
(
droppedCount
-
this
->
dropped
.
size
()))
&
MaxValue
;
...
...
worker/src/RTC/SimulcastConsumer.cpp
浏览文件 @
3bdad193
...
@@ -309,7 +309,7 @@ namespace RTC
...
@@ -309,7 +309,7 @@ namespace RTC
MS_ASSERT
(
it
!=
this
->
mapMappedSsrcSpatialLayer
.
end
(),
"unknown mappedSsrc"
);
MS_ASSERT
(
it
!=
this
->
mapMappedSsrcSpatialLayer
.
end
(),
"unknown mappedSsrc"
);
int16_t
spatialLayer
=
it
->
second
;
const
int16_t
spatialLayer
=
it
->
second
;
this
->
producerRtpStreams
[
spatialLayer
]
=
rtpStream
;
this
->
producerRtpStreams
[
spatialLayer
]
=
rtpStream
;
}
}
...
@@ -322,7 +322,7 @@ namespace RTC
...
@@ -322,7 +322,7 @@ namespace RTC
MS_ASSERT
(
it
!=
this
->
mapMappedSsrcSpatialLayer
.
end
(),
"unknown mappedSsrc"
);
MS_ASSERT
(
it
!=
this
->
mapMappedSsrcSpatialLayer
.
end
(),
"unknown mappedSsrc"
);
int16_t
spatialLayer
=
it
->
second
;
const
int16_t
spatialLayer
=
it
->
second
;
this
->
producerRtpStreams
[
spatialLayer
]
=
rtpStream
;
this
->
producerRtpStreams
[
spatialLayer
]
=
rtpStream
;
...
@@ -750,7 +750,7 @@ namespace RTC
...
@@ -750,7 +750,7 @@ namespace RTC
else
else
diffMs
=
-
1
*
(
ntpMs1
-
ntpMs2
);
diffMs
=
-
1
*
(
ntpMs1
-
ntpMs2
);
int64_t
diffTs
=
diffMs
*
this
->
rtpStream
->
GetClockRate
()
/
1000
;
const
int64_t
diffTs
=
diffMs
*
this
->
rtpStream
->
GetClockRate
()
/
1000
;
const
uint32_t
newTs2
=
ts2
-
diffTs
;
const
uint32_t
newTs2
=
ts2
-
diffTs
;
// Apply offset. This is the difference that later must be removed from the
// Apply offset. This is the difference that later must be removed from the
...
@@ -778,7 +778,7 @@ namespace RTC
...
@@ -778,7 +778,7 @@ namespace RTC
// Apply an expected offset for a new frame in a 30fps stream.
// Apply an expected offset for a new frame in a 30fps stream.
static
const
uint8_t
MsOffset
{
33u
};
// (1 / 30 * 1000).
static
const
uint8_t
MsOffset
{
33u
};
// (1 / 30 * 1000).
int64_t
maxTsExtraOffset
=
MaxExtraOffsetMs
*
this
->
rtpStream
->
GetClockRate
()
/
1000
;
const
int64_t
maxTsExtraOffset
=
MaxExtraOffsetMs
*
this
->
rtpStream
->
GetClockRate
()
/
1000
;
uint32_t
tsExtraOffset
=
this
->
rtpStream
->
GetMaxPacketTs
()
-
packet
->
GetTimestamp
()
+
uint32_t
tsExtraOffset
=
this
->
rtpStream
->
GetMaxPacketTs
()
-
packet
->
GetTimestamp
()
+
tsOffset
+
MsOffset
*
this
->
rtpStream
->
GetClockRate
()
/
1000
;
tsOffset
+
MsOffset
*
this
->
rtpStream
->
GetClockRate
()
/
1000
;
...
...
worker/src/RTC/StunPacket.cpp
浏览文件 @
3bdad193
...
@@ -434,7 +434,7 @@ namespace RTC
...
@@ -434,7 +434,7 @@ namespace RTC
return
Authentication
::
BAD_REQUEST
;
return
Authentication
::
BAD_REQUEST
;
// Check that USERNAME attribute begins with our local username plus ":".
// Check that USERNAME attribute begins with our local username plus ":".
size_t
localUsernameLen
=
localUsername
.
length
();
const
size_t
localUsernameLen
=
localUsername
.
length
();
if
(
if
(
this
->
username
.
length
()
<=
localUsernameLen
||
this
->
username
.
at
(
localUsernameLen
)
!=
':'
||
this
->
username
.
length
()
<=
localUsernameLen
||
this
->
username
.
at
(
localUsernameLen
)
!=
':'
||
...
@@ -531,8 +531,9 @@ namespace RTC
...
@@ -531,8 +531,9 @@ namespace RTC
bool
addXorMappedAddress
=
bool
addXorMappedAddress
=
((
this
->
xorMappedAddress
!=
nullptr
)
&&
this
->
method
==
StunPacket
::
Method
::
BINDING
&&
((
this
->
xorMappedAddress
!=
nullptr
)
&&
this
->
method
==
StunPacket
::
Method
::
BINDING
&&
this
->
klass
==
Class
::
SUCCESS_RESPONSE
);
this
->
klass
==
Class
::
SUCCESS_RESPONSE
);
bool
addErrorCode
=
((
this
->
errorCode
!=
0u
)
&&
this
->
klass
==
Class
::
ERROR_RESPONSE
);
const
bool
addErrorCode
=
((
this
->
errorCode
!=
0u
)
&&
this
->
klass
==
Class
::
ERROR_RESPONSE
);
bool
addMessageIntegrity
=
(
this
->
klass
!=
Class
::
ERROR_RESPONSE
&&
!
this
->
password
.
empty
());
const
bool
addMessageIntegrity
=
(
this
->
klass
!=
Class
::
ERROR_RESPONSE
&&
!
this
->
password
.
empty
());
const
bool
addFingerprint
{
true
};
// Do always.
const
bool
addFingerprint
{
true
};
// Do always.
// Update data pointer.
// Update data pointer.
...
@@ -749,7 +750,7 @@ namespace RTC
...
@@ -749,7 +750,7 @@ namespace RTC
Utils
::
Byte
::
Set2Bytes
(
buffer
,
pos
+
2
,
4
);
Utils
::
Byte
::
Set2Bytes
(
buffer
,
pos
+
2
,
4
);
auto
codeClass
=
static_cast
<
uint8_t
>
(
this
->
errorCode
/
100
);
auto
codeClass
=
static_cast
<
uint8_t
>
(
this
->
errorCode
/
100
);
uint8_t
codeNumber
=
static_cast
<
uint8_t
>
(
this
->
errorCode
)
-
(
codeClass
*
100
);
const
uint8_t
codeNumber
=
static_cast
<
uint8_t
>
(
this
->
errorCode
)
-
(
codeClass
*
100
);
Utils
::
Byte
::
Set2Bytes
(
buffer
,
pos
+
4
,
0
);
Utils
::
Byte
::
Set2Bytes
(
buffer
,
pos
+
4
,
0
);
Utils
::
Byte
::
Set1Byte
(
buffer
,
pos
+
6
,
codeClass
);
Utils
::
Byte
::
Set1Byte
(
buffer
,
pos
+
6
,
codeClass
);
...
...
worker/src/RTC/Transport.cpp
浏览文件 @
3bdad193
...
@@ -25,8 +25,8 @@
...
@@ -25,8 +25,8 @@
namespace
RTC
namespace
RTC
{
{
static
size_t
DefaultSctpSendBufferSize
{
262144
};
// 2^18.
static
const
size_t
DefaultSctpSendBufferSize
{
262144
};
// 2^18.
static
size_t
MaxSctpSendBufferSize
{
268435456
};
// 2^28.
static
const
size_t
MaxSctpSendBufferSize
{
268435456
};
// 2^28.
/* Instance methods. */
/* Instance methods. */
...
@@ -622,7 +622,7 @@ namespace RTC
...
@@ -622,7 +622,7 @@ namespace RTC
MS_THROW_TYPE_ERROR
(
"missing bitrate"
);
MS_THROW_TYPE_ERROR
(
"missing bitrate"
);
}
}
uint32_t
bitrate
=
jsonBitrateIt
->
get
<
uint32_t
>
();
const
uint32_t
bitrate
=
jsonBitrateIt
->
get
<
uint32_t
>
();
if
(
bitrate
<
RTC
::
TransportCongestionControlMinOutgoingBitrate
)
if
(
bitrate
<
RTC
::
TransportCongestionControlMinOutgoingBitrate
)
{
{
...
@@ -1287,7 +1287,7 @@ namespace RTC
...
@@ -1287,7 +1287,7 @@ namespace RTC
if
(
!
type
.
is_string
())
if
(
!
type
.
is_string
())
MS_THROW_TYPE_ERROR
(
"wrong type (not a string)"
);
MS_THROW_TYPE_ERROR
(
"wrong type (not a string)"
);
std
::
string
typeStr
=
type
.
get
<
std
::
string
>
();
const
std
::
string
typeStr
=
type
.
get
<
std
::
string
>
();
if
(
typeStr
==
"probation"
)
if
(
typeStr
==
"probation"
)
newTraceEventTypes
.
probation
=
true
;
newTraceEventTypes
.
probation
=
true
;
...
@@ -2324,7 +2324,7 @@ namespace RTC
...
@@ -2324,7 +2324,7 @@ namespace RTC
for
(
uint8_t
i
{
1u
};
i
<=
(
baseAllocation
?
1u
:
priority
);
++
i
)
for
(
uint8_t
i
{
1u
};
i
<=
(
baseAllocation
?
1u
:
priority
);
++
i
)
{
{
uint32_t
usedBitrate
{
0u
};
uint32_t
usedBitrate
{
0u
};
bool
considerLoss
=
(
bweType
==
RTC
::
BweType
::
REMB
);
const
bool
considerLoss
=
(
bweType
==
RTC
::
BweType
::
REMB
);
usedBitrate
=
consumer
->
IncreaseLayer
(
availableBitrate
,
considerLoss
);
usedBitrate
=
consumer
->
IncreaseLayer
(
availableBitrate
,
considerLoss
);
...
@@ -2525,7 +2525,7 @@ namespace RTC
...
@@ -2525,7 +2525,7 @@ namespace RTC
// invoked *after* the WebRtcTransport has been closed (freed). To avoid
// invoked *after* the WebRtcTransport has been closed (freed). To avoid
// invalid memory access we need to use weak_ptr. Same applies in other
// invalid memory access we need to use weak_ptr. Same applies in other
// send callbacks.
// send callbacks.
std
::
weak_ptr
<
RTC
::
TransportCongestionControlClient
>
tccClientWeakPtr
(
this
->
tccClient
);
const
std
::
weak_ptr
<
RTC
::
TransportCongestionControlClient
>
tccClientWeakPtr
(
this
->
tccClient
);
#ifdef ENABLE_RTC_SENDER_BANDWIDTH_ESTIMATOR
#ifdef ENABLE_RTC_SENDER_BANDWIDTH_ESTIMATOR
std
::
weak_ptr
<
RTC
::
SenderBandwidthEstimator
>
senderBweWeakPtr
(
this
->
senderBwe
);
std
::
weak_ptr
<
RTC
::
SenderBandwidthEstimator
>
senderBweWeakPtr
(
this
->
senderBwe
);
...
@@ -2614,7 +2614,7 @@ namespace RTC
...
@@ -2614,7 +2614,7 @@ namespace RTC
// Indicate the pacer (and prober) that a packet is to be sent.
// Indicate the pacer (and prober) that a packet is to be sent.
this
->
tccClient
->
InsertPacket
(
packetInfo
);
this
->
tccClient
->
InsertPacket
(
packetInfo
);
std
::
weak_ptr
<
RTC
::
TransportCongestionControlClient
>
tccClientWeakPtr
(
this
->
tccClient
);
const
std
::
weak_ptr
<
RTC
::
TransportCongestionControlClient
>
tccClientWeakPtr
(
this
->
tccClient
);
#ifdef ENABLE_RTC_SENDER_BANDWIDTH_ESTIMATOR
#ifdef ENABLE_RTC_SENDER_BANDWIDTH_ESTIMATOR
std
::
weak_ptr
<
RTC
::
SenderBandwidthEstimator
>
senderBweWeakPtr
=
this
->
senderBwe
;
std
::
weak_ptr
<
RTC
::
SenderBandwidthEstimator
>
senderBweWeakPtr
=
this
->
senderBwe
;
...
@@ -2970,7 +2970,7 @@ namespace RTC
...
@@ -2970,7 +2970,7 @@ namespace RTC
// Indicate the pacer (and prober) that a packet is to be sent.
// Indicate the pacer (and prober) that a packet is to be sent.
this
->
tccClient
->
InsertPacket
(
packetInfo
);
this
->
tccClient
->
InsertPacket
(
packetInfo
);
std
::
weak_ptr
<
RTC
::
TransportCongestionControlClient
>
tccClientWeakPtr
(
this
->
tccClient
);
const
std
::
weak_ptr
<
RTC
::
TransportCongestionControlClient
>
tccClientWeakPtr
(
this
->
tccClient
);
#ifdef ENABLE_RTC_SENDER_BANDWIDTH_ESTIMATOR
#ifdef ENABLE_RTC_SENDER_BANDWIDTH_ESTIMATOR
std
::
weak_ptr
<
RTC
::
SenderBandwidthEstimator
>
senderBweWeakPtr
=
this
->
senderBwe
;
std
::
weak_ptr
<
RTC
::
SenderBandwidthEstimator
>
senderBweWeakPtr
=
this
->
senderBwe
;
...
...
worker/src/RTC/TransportCongestionControlServer.cpp
浏览文件 @
3bdad193
...
@@ -232,7 +232,7 @@ namespace RTC
...
@@ -232,7 +232,7 @@ namespace RTC
this
,
this
->
transportCcFeedbackPacket
.
get
());
this
,
this
->
transportCcFeedbackPacket
.
get
());
// Update packet loss history.
// Update packet loss history.
size_t
expected_packets
=
this
->
transportCcFeedbackPacket
->
GetPacketStatusCount
();
const
size_t
expected_packets
=
this
->
transportCcFeedbackPacket
->
GetPacketStatusCount
();
size_t
lost_packets
=
0
;
size_t
lost_packets
=
0
;
for
(
const
auto
&
result
:
this
->
transportCcFeedbackPacket
->
GetPacketResults
())
for
(
const
auto
&
result
:
this
->
transportCcFeedbackPacket
->
GetPacketResults
())
{
{
...
...
worker/src/RTC/TrendCalculator.cpp
浏览文件 @
3bdad193
...
@@ -34,7 +34,7 @@ namespace RTC
...
@@ -34,7 +34,7 @@ namespace RTC
// Otherwise decrease current value.
// Otherwise decrease current value.
else
else
{
{
uint64_t
elapsedMs
=
nowMs
-
this
->
highestValueUpdatedAtMs
;
const
uint64_t
elapsedMs
=
nowMs
-
this
->
highestValueUpdatedAtMs
;
auto
subtraction
=
auto
subtraction
=
static_cast
<
uint32_t
>
(
this
->
highestValue
*
this
->
decreaseFactor
*
(
elapsedMs
/
1000.0
));
static_cast
<
uint32_t
>
(
this
->
highestValue
*
this
->
decreaseFactor
*
(
elapsedMs
/
1000.0
));
...
...
worker/src/RTC/WebRtcServer.cpp
浏览文件 @
3bdad193
...
@@ -359,8 +359,8 @@ namespace RTC
...
@@ -359,8 +359,8 @@ namespace RTC
// local usernameFragment) which is the first value in the attribute value
// local usernameFragment) which is the first value in the attribute value
// before the ":" symbol.
// before the ":" symbol.
auto
&
username
=
packet
->
GetUsername
();
const
auto
&
username
=
packet
->
GetUsername
();
size_t
colonPos
=
username
.
find
(
':'
);
const
size_t
colonPos
=
username
.
find
(
':'
);
// If no colon is found just return the whole USERNAME attribute anyway.
// If no colon is found just return the whole USERNAME attribute anyway.
if
(
colonPos
==
std
::
string
::
npos
)
if
(
colonPos
==
std
::
string
::
npos
)
...
...
worker/src/RTC/WebRtcTransport.cpp
浏览文件 @
3bdad193
...
@@ -366,7 +366,7 @@ namespace RTC
...
@@ -366,7 +366,7 @@ namespace RTC
jsonIceCandidatesIt
->
emplace_back
(
json
::
value_t
::
object
);
jsonIceCandidatesIt
->
emplace_back
(
json
::
value_t
::
object
);
auto
&
jsonEntry
=
(
*
jsonIceCandidatesIt
)[
i
];
auto
&
jsonEntry
=
(
*
jsonIceCandidatesIt
)[
i
];
auto
&
iceCandidate
=
this
->
iceCandidates
[
i
];
const
auto
&
iceCandidate
=
this
->
iceCandidates
[
i
];
iceCandidate
.
FillJson
(
jsonEntry
);
iceCandidate
.
FillJson
(
jsonEntry
);
}
}
...
@@ -648,8 +648,8 @@ namespace RTC
...
@@ -648,8 +648,8 @@ namespace RTC
case
Channel
:
:
ChannelRequest
::
MethodId
::
TRANSPORT_RESTART_ICE
:
case
Channel
:
:
ChannelRequest
::
MethodId
::
TRANSPORT_RESTART_ICE
:
{
{
std
::
string
usernameFragment
=
Utils
::
Crypto
::
GetRandomString
(
32
);
const
std
::
string
usernameFragment
=
Utils
::
Crypto
::
GetRandomString
(
32
);
std
::
string
password
=
Utils
::
Crypto
::
GetRandomString
(
32
);
const
std
::
string
password
=
Utils
::
Crypto
::
GetRandomString
(
32
);
this
->
iceServer
->
RestartIce
(
usernameFragment
,
password
);
this
->
iceServer
->
RestartIce
(
usernameFragment
,
password
);
...
...
worker/src/Settings.cpp
浏览文件 @
3bdad193
...
@@ -328,7 +328,7 @@ void Settings::SetLogTags(const std::vector<std::string>& tags)
...
@@ -328,7 +328,7 @@ void Settings::SetLogTags(const std::vector<std::string>& tags)
// Reset logTags.
// Reset logTags.
struct
LogTags
newLogTags
;
struct
LogTags
newLogTags
;
for
(
auto
&
tag
:
tags
)
for
(
const
auto
&
tag
:
tags
)
{
{
if
(
tag
==
"info"
)
if
(
tag
==
"info"
)
newLogTags
.
info
=
true
;
newLogTags
.
info
=
true
;
...
...
worker/src/Worker.cpp
浏览文件 @
3bdad193
...
@@ -114,20 +114,20 @@ void Worker::FillJson(json& jsonObject) const
...
@@ -114,20 +114,20 @@ void Worker::FillJson(json& jsonObject) const
jsonObject
[
"webRtcServerIds"
]
=
json
::
array
();
jsonObject
[
"webRtcServerIds"
]
=
json
::
array
();
auto
jsonWebRtcServerIdsIt
=
jsonObject
.
find
(
"webRtcServerIds"
);
auto
jsonWebRtcServerIdsIt
=
jsonObject
.
find
(
"webRtcServerIds"
);
for
(
auto
&
kv
:
this
->
mapWebRtcServers
)
for
(
const
auto
&
kv
:
this
->
mapWebRtcServers
)
{
{
auto
&
W
ebRtcServerId
=
kv
.
first
;
const
auto
&
w
ebRtcServerId
=
kv
.
first
;
jsonWebRtcServerIdsIt
->
emplace_back
(
W
ebRtcServerId
);
jsonWebRtcServerIdsIt
->
emplace_back
(
w
ebRtcServerId
);
}
}
// Add routerIds.
// Add routerIds.
jsonObject
[
"routerIds"
]
=
json
::
array
();
jsonObject
[
"routerIds"
]
=
json
::
array
();
auto
jsonRouterIdsIt
=
jsonObject
.
find
(
"routerIds"
);
auto
jsonRouterIdsIt
=
jsonObject
.
find
(
"routerIds"
);
for
(
auto
&
kv
:
this
->
mapRouters
)
for
(
const
auto
&
kv
:
this
->
mapRouters
)
{
{
auto
&
routerId
=
kv
.
first
;
const
auto
&
routerId
=
kv
.
first
;
jsonRouterIdsIt
->
emplace_back
(
routerId
);
jsonRouterIdsIt
->
emplace_back
(
routerId
);
}
}
...
...
worker/src/handles/SignalsHandler.cpp
浏览文件 @
3bdad193
...
@@ -56,7 +56,7 @@ void SignalsHandler::AddSignal(int signum, const std::string& name)
...
@@ -56,7 +56,7 @@ void SignalsHandler::AddSignal(int signum, const std::string& name)
MS_THROW_ERROR
(
"closed"
);
MS_THROW_ERROR
(
"closed"
);
int
err
;
int
err
;
auto
uvHandle
=
new
uv_signal_t
;
auto
*
uvHandle
=
new
uv_signal_t
;
uvHandle
->
data
=
static_cast
<
void
*>
(
this
);
uvHandle
->
data
=
static_cast
<
void
*>
(
this
);
...
...
worker/src/handles/TcpConnectionHandler.cpp
浏览文件 @
3bdad193
...
@@ -103,7 +103,7 @@ void TcpConnectionHandler::Close()
...
@@ -103,7 +103,7 @@ void TcpConnectionHandler::Close()
{
{
// Use uv_shutdown() so pending data to be written will be sent to the peer
// Use uv_shutdown() so pending data to be written will be sent to the peer
// before closing.
// before closing.
auto
req
=
new
uv_shutdown_t
;
auto
*
req
=
new
uv_shutdown_t
;
req
->
data
=
static_cast
<
void
*>
(
this
);
req
->
data
=
static_cast
<
void
*>
(
this
);
err
=
uv_shutdown
(
err
=
uv_shutdown
(
req
,
reinterpret_cast
<
uv_stream_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_shutdown_cb
>
(
onShutdown
));
req
,
reinterpret_cast
<
uv_stream_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_shutdown_cb
>
(
onShutdown
));
...
...
worker/src/handles/UnixStreamSocket.cpp
浏览文件 @
3bdad193
...
@@ -146,7 +146,7 @@ void UnixStreamSocket::Close()
...
@@ -146,7 +146,7 @@ void UnixStreamSocket::Close()
if
(
this
->
role
==
UnixStreamSocket
::
Role
::
PRODUCER
&&
!
this
->
hasError
&&
!
this
->
isClosedByPeer
)
if
(
this
->
role
==
UnixStreamSocket
::
Role
::
PRODUCER
&&
!
this
->
hasError
&&
!
this
->
isClosedByPeer
)
{
{
// Use uv_shutdown() so pending data to be written will be sent to the peer before closing.
// Use uv_shutdown() so pending data to be written will be sent to the peer before closing.
auto
req
=
new
uv_shutdown_t
;
auto
*
req
=
new
uv_shutdown_t
;
req
->
data
=
static_cast
<
void
*>
(
this
);
req
->
data
=
static_cast
<
void
*>
(
this
);
err
=
uv_shutdown
(
err
=
uv_shutdown
(
req
,
reinterpret_cast
<
uv_stream_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_shutdown_cb
>
(
onShutdown
));
req
,
reinterpret_cast
<
uv_stream_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_shutdown_cb
>
(
onShutdown
));
...
...
worker/src/main.cpp
浏览文件 @
3bdad193
...
@@ -21,7 +21,7 @@ int main(int argc, char* argv[])
...
@@ -21,7 +21,7 @@ int main(int argc, char* argv[])
std
::
_Exit
(
EXIT_FAILURE
);
std
::
_Exit
(
EXIT_FAILURE
);
}
}
std
::
string
version
=
std
::
getenv
(
"MEDIASOUP_VERSION"
);
const
std
::
string
version
=
std
::
getenv
(
"MEDIASOUP_VERSION"
);
auto
statusCode
=
mediasoup_worker_run
(
auto
statusCode
=
mediasoup_worker_run
(
argc
,
argc
,
...
...
worker/test/src/RTC/TestRtpPacket.cpp
浏览文件 @
3bdad193
...
@@ -338,7 +338,7 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
...
@@ -338,7 +338,7 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
REQUIRE
(
packet
->
HasOneByteExtensions
()
==
false
);
REQUIRE
(
packet
->
HasOneByteExtensions
()
==
false
);
REQUIRE
(
packet
->
HasTwoBytesExtensions
());
REQUIRE
(
packet
->
HasTwoBytesExtensions
());
auto
rtxPacket
=
packet
->
Clone
();
auto
*
rtxPacket
=
packet
->
Clone
();
delete
packet
;
delete
packet
;
...
...
worker/test/src/RTC/TestRtpStreamSend.cpp
浏览文件 @
3bdad193
...
@@ -78,15 +78,15 @@ SCENARIO("NACK and RTP packets retransmission", "[rtp][rtcp][nack]")
...
@@ -78,15 +78,15 @@ SCENARIO("NACK and RTP packets retransmission", "[rtp][rtcp][nack]")
SECTION
(
"receive NACK and get retransmitted packets"
)
SECTION
(
"receive NACK and get retransmitted packets"
)
{
{
// packet1 [pt:123, seq:21006, timestamp:1533790901]
// packet1 [pt:123, seq:21006, timestamp:1533790901]
auto
packet1
=
CreateRtpPacket
(
rtpBuffer1
,
21006
,
1533790901
);
auto
*
packet1
=
CreateRtpPacket
(
rtpBuffer1
,
21006
,
1533790901
);
// packet2 [pt:123, seq:21007, timestamp:1533790901]
// packet2 [pt:123, seq:21007, timestamp:1533790901]
auto
packet2
=
CreateRtpPacket
(
rtpBuffer2
,
21007
,
1533790901
);
auto
*
packet2
=
CreateRtpPacket
(
rtpBuffer2
,
21007
,
1533790901
);
// packet3 [pt:123, seq:21008, timestamp:1533793871]
// packet3 [pt:123, seq:21008, timestamp:1533793871]
auto
packet3
=
CreateRtpPacket
(
rtpBuffer3
,
21008
,
1533793871
);
auto
*
packet3
=
CreateRtpPacket
(
rtpBuffer3
,
21008
,
1533793871
);
// packet4 [pt:123, seq:21009, timestamp:1533793871]
// packet4 [pt:123, seq:21009, timestamp:1533793871]
auto
packet4
=
CreateRtpPacket
(
rtpBuffer4
,
21009
,
1533793871
);
auto
*
packet4
=
CreateRtpPacket
(
rtpBuffer4
,
21009
,
1533793871
);
// packet5 [pt:123, seq:21010, timestamp:1533796931]
// packet5 [pt:123, seq:21010, timestamp:1533796931]
auto
packet5
=
CreateRtpPacket
(
rtpBuffer5
,
21010
,
1533796931
);
auto
*
packet5
=
CreateRtpPacket
(
rtpBuffer5
,
21010
,
1533796931
);
// Create a RtpStreamSend instance.
// Create a RtpStreamSend instance.
TestRtpStreamListener
testRtpStreamListener
;
TestRtpStreamListener
testRtpStreamListener
;
...
@@ -143,15 +143,15 @@ SCENARIO("NACK and RTP packets retransmission", "[rtp][rtcp][nack]")
...
@@ -143,15 +143,15 @@ SCENARIO("NACK and RTP packets retransmission", "[rtp][rtcp][nack]")
SECTION
(
"receive NACK and get zero retransmitted packets if useNack is not set"
)
SECTION
(
"receive NACK and get zero retransmitted packets if useNack is not set"
)
{
{
// packet1 [pt:123, seq:21006, timestamp:1533790901]
// packet1 [pt:123, seq:21006, timestamp:1533790901]
auto
packet1
=
CreateRtpPacket
(
rtpBuffer1
,
21006
,
1533790901
);
auto
*
packet1
=
CreateRtpPacket
(
rtpBuffer1
,
21006
,
1533790901
);
// packet2 [pt:123, seq:21007, timestamp:1533790901]
// packet2 [pt:123, seq:21007, timestamp:1533790901]
auto
packet2
=
CreateRtpPacket
(
rtpBuffer2
,
21007
,
1533790901
);
auto
*
packet2
=
CreateRtpPacket
(
rtpBuffer2
,
21007
,
1533790901
);
// packet3 [pt:123, seq:21008, timestamp:1533793871]
// packet3 [pt:123, seq:21008, timestamp:1533793871]
auto
packet3
=
CreateRtpPacket
(
rtpBuffer3
,
21008
,
1533793871
);
auto
*
packet3
=
CreateRtpPacket
(
rtpBuffer3
,
21008
,
1533793871
);
// packet4 [pt:123, seq:21009, timestamp:1533793871]
// packet4 [pt:123, seq:21009, timestamp:1533793871]
auto
packet4
=
CreateRtpPacket
(
rtpBuffer4
,
21009
,
1533793871
);
auto
*
packet4
=
CreateRtpPacket
(
rtpBuffer4
,
21009
,
1533793871
);
// packet5 [pt:123, seq:21010, timestamp:1533796931]
// packet5 [pt:123, seq:21010, timestamp:1533796931]
auto
packet5
=
CreateRtpPacket
(
rtpBuffer5
,
21010
,
1533796931
);
auto
*
packet5
=
CreateRtpPacket
(
rtpBuffer5
,
21010
,
1533796931
);
// Create a RtpStreamSend instance.
// Create a RtpStreamSend instance.
TestRtpStreamListener
testRtpStreamListener
;
TestRtpStreamListener
testRtpStreamListener
;
...
@@ -196,15 +196,15 @@ SCENARIO("NACK and RTP packets retransmission", "[rtp][rtcp][nack]")
...
@@ -196,15 +196,15 @@ SCENARIO("NACK and RTP packets retransmission", "[rtp][rtcp][nack]")
SECTION
(
"receive NACK and get zero retransmitted packets for audio"
)
SECTION
(
"receive NACK and get zero retransmitted packets for audio"
)
{
{
// packet1 [pt:123, seq:21006, timestamp:1533790901]
// packet1 [pt:123, seq:21006, timestamp:1533790901]
auto
packet1
=
CreateRtpPacket
(
rtpBuffer1
,
21006
,
1533790901
);
auto
*
packet1
=
CreateRtpPacket
(
rtpBuffer1
,
21006
,
1533790901
);
// packet2 [pt:123, seq:21007, timestamp:1533790901]
// packet2 [pt:123, seq:21007, timestamp:1533790901]
auto
packet2
=
CreateRtpPacket
(
rtpBuffer2
,
21007
,
1533790901
);
auto
*
packet2
=
CreateRtpPacket
(
rtpBuffer2
,
21007
,
1533790901
);
// packet3 [pt:123, seq:21008, timestamp:1533793871]
// packet3 [pt:123, seq:21008, timestamp:1533793871]
auto
packet3
=
CreateRtpPacket
(
rtpBuffer3
,
21008
,
1533793871
);
auto
*
packet3
=
CreateRtpPacket
(
rtpBuffer3
,
21008
,
1533793871
);
// packet4 [pt:123, seq:21009, timestamp:1533793871]
// packet4 [pt:123, seq:21009, timestamp:1533793871]
auto
packet4
=
CreateRtpPacket
(
rtpBuffer4
,
21009
,
1533793871
);
auto
*
packet4
=
CreateRtpPacket
(
rtpBuffer4
,
21009
,
1533793871
);
// packet5 [pt:123, seq:21010, timestamp:1533796931]
// packet5 [pt:123, seq:21010, timestamp:1533796931]
auto
packet5
=
CreateRtpPacket
(
rtpBuffer5
,
21010
,
1533796931
);
auto
*
packet5
=
CreateRtpPacket
(
rtpBuffer5
,
21010
,
1533796931
);
// Create a RtpStreamSend instance.
// Create a RtpStreamSend instance.
TestRtpStreamListener
testRtpStreamListener
;
TestRtpStreamListener
testRtpStreamListener
;
...
@@ -249,9 +249,9 @@ SCENARIO("NACK and RTP packets retransmission", "[rtp][rtcp][nack]")
...
@@ -249,9 +249,9 @@ SCENARIO("NACK and RTP packets retransmission", "[rtp][rtcp][nack]")
SECTION
(
"receive NACK in different RtpStreamSend instances and get retransmitted packets"
)
SECTION
(
"receive NACK in different RtpStreamSend instances and get retransmitted packets"
)
{
{
// packet1 [pt:123, seq:21006, timestamp:1533790901]
// packet1 [pt:123, seq:21006, timestamp:1533790901]
auto
packet1
=
CreateRtpPacket
(
rtpBuffer1
,
21006
,
1533790901
);
auto
*
packet1
=
CreateRtpPacket
(
rtpBuffer1
,
21006
,
1533790901
);
// packet2 [pt:123, seq:21007, timestamp:1533790901]
// packet2 [pt:123, seq:21007, timestamp:1533790901]
auto
packet2
=
CreateRtpPacket
(
rtpBuffer2
,
21007
,
1533790901
);
auto
*
packet2
=
CreateRtpPacket
(
rtpBuffer2
,
21007
,
1533790901
);
// Create two RtpStreamSend instances.
// Create two RtpStreamSend instances.
TestRtpStreamListener
testRtpStreamListener1
;
TestRtpStreamListener
testRtpStreamListener1
;
...
@@ -326,8 +326,8 @@ SCENARIO("NACK and RTP packets retransmission", "[rtp][rtcp][nack]")
...
@@ -326,8 +326,8 @@ SCENARIO("NACK and RTP packets retransmission", "[rtp][rtcp][nack]")
uint32_t
diffTs
=
RtpStreamSend
::
MaxRetransmissionDelay
*
clockRate
/
1000
;
uint32_t
diffTs
=
RtpStreamSend
::
MaxRetransmissionDelay
*
clockRate
/
1000
;
uint32_t
secondTs
=
firstTs
+
diffTs
;
uint32_t
secondTs
=
firstTs
+
diffTs
;
auto
packet1
=
CreateRtpPacket
(
rtpBuffer1
,
21006
,
firstTs
);
auto
*
packet1
=
CreateRtpPacket
(
rtpBuffer1
,
21006
,
firstTs
);
auto
packet2
=
CreateRtpPacket
(
rtpBuffer2
,
21007
,
secondTs
-
1
);
auto
*
packet2
=
CreateRtpPacket
(
rtpBuffer2
,
21007
,
secondTs
-
1
);
// Create a RtpStreamSend instance.
// Create a RtpStreamSend instance.
TestRtpStreamListener
testRtpStreamListener1
;
TestRtpStreamListener
testRtpStreamListener1
;
...
@@ -378,8 +378,8 @@ SCENARIO("NACK and RTP packets retransmission", "[rtp][rtcp][nack]")
...
@@ -378,8 +378,8 @@ SCENARIO("NACK and RTP packets retransmission", "[rtp][rtcp][nack]")
uint32_t
diffTs
=
RtpStreamSend
::
MaxRetransmissionDelay
*
clockRate
/
1000
;
uint32_t
diffTs
=
RtpStreamSend
::
MaxRetransmissionDelay
*
clockRate
/
1000
;
uint32_t
secondTs
=
firstTs
+
diffTs
;
uint32_t
secondTs
=
firstTs
+
diffTs
;
auto
packet1
=
CreateRtpPacket
(
rtpBuffer1
,
21006
,
firstTs
);
auto
*
packet1
=
CreateRtpPacket
(
rtpBuffer1
,
21006
,
firstTs
);
auto
packet2
=
CreateRtpPacket
(
rtpBuffer2
,
21007
,
secondTs
);
auto
*
packet2
=
CreateRtpPacket
(
rtpBuffer2
,
21007
,
secondTs
);
// Create a RtpStreamSend instance.
// Create a RtpStreamSend instance.
TestRtpStreamListener
testRtpStreamListener1
;
TestRtpStreamListener
testRtpStreamListener1
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论