Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
ead33e5c
提交
ead33e5c
authored
6月 17, 2020
作者:
José Luis Millán
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
const correctness
上级
1d0734ff
显示空白字符变更
内嵌
并排
正在显示
19 个修改的文件
包含
70 行增加
和
79 行删除
+70
-79
CHANGELOG.md
CHANGELOG.md
+1
-0
DataProducer.hpp
worker/include/RTC/DataProducer.hpp
+1
-1
RtpStreamSend.hpp
worker/include/RTC/RtpStreamSend.hpp
+0
-1
Consumer.cpp
worker/src/RTC/Consumer.cpp
+1
-1
DataProducer.cpp
worker/src/RTC/DataProducer.cpp
+1
-1
PipeConsumer.cpp
worker/src/RTC/PipeConsumer.cpp
+4
-4
PortManager.cpp
worker/src/RTC/PortManager.cpp
+2
-2
Producer.cpp
worker/src/RTC/Producer.cpp
+9
-9
Router.cpp
worker/src/RTC/Router.cpp
+2
-2
RtpPacket.cpp
worker/src/RTC/RtpPacket.cpp
+4
-4
RtpStream.cpp
worker/src/RTC/RtpStream.cpp
+1
-1
RtpStreamRecv.cpp
worker/src/RTC/RtpStreamRecv.cpp
+4
-8
RtpStreamSend.cpp
worker/src/RTC/RtpStreamSend.cpp
+17
-17
RtxStream.cpp
worker/src/RTC/RtxStream.cpp
+1
-1
SctpListener.cpp
worker/src/RTC/SctpListener.cpp
+1
-1
SimpleConsumer.cpp
worker/src/RTC/SimpleConsumer.cpp
+1
-1
StunPacket.cpp
worker/src/RTC/StunPacket.cpp
+1
-1
Transport.cpp
worker/src/RTC/Transport.cpp
+18
-18
WebRtcTransport.cpp
worker/src/RTC/WebRtcTransport.cpp
+1
-6
没有找到文件。
CHANGELOG.md
浏览文件 @
ead33e5c
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
### 3.6.8 (WIP)
### 3.6.8 (WIP)
*
Update
`nlohmann::json`
C++ dep to 3.8.0.
*
Update
`nlohmann::json`
C++ dep to 3.8.0.
*
Enhance const correctness.
### 3.6.7
### 3.6.7
...
...
worker/include/RTC/DataProducer.hpp
浏览文件 @
ead33e5c
...
@@ -33,7 +33,7 @@ namespace RTC
...
@@ -33,7 +33,7 @@ namespace RTC
public
:
public
:
void
FillJson
(
json
&
jsonObject
)
const
;
void
FillJson
(
json
&
jsonObject
)
const
;
void
FillJsonStats
(
json
&
jsonArray
)
const
;
void
FillJsonStats
(
json
&
jsonArray
)
const
;
void
HandleRequest
(
Channel
::
Request
*
request
);
void
HandleRequest
(
Channel
::
Request
*
request
)
const
;
Type
GetType
()
const
Type
GetType
()
const
{
{
return
this
->
type
;
return
this
->
type
;
...
...
worker/include/RTC/RtpStreamSend.hpp
浏览文件 @
ead33e5c
...
@@ -58,7 +58,6 @@ namespace RTC
...
@@ -58,7 +58,6 @@ namespace RTC
private
:
private
:
void
StorePacket
(
RTC
::
RtpPacket
*
packet
);
void
StorePacket
(
RTC
::
RtpPacket
*
packet
);
void
ClearBuffer
();
void
ClearBuffer
();
void
ResetStorageItem
(
StorageItem
*
storageItem
);
void
UpdateBufferStartIdx
();
void
UpdateBufferStartIdx
();
void
FillRetransmissionContainer
(
uint16_t
seq
,
uint16_t
bitmask
);
void
FillRetransmissionContainer
(
uint16_t
seq
,
uint16_t
bitmask
);
void
UpdateScore
(
RTC
::
RTCP
::
ReceiverReport
*
report
);
void
UpdateScore
(
RTC
::
RTCP
::
ReceiverReport
*
report
);
...
...
worker/src/RTC/Consumer.cpp
浏览文件 @
ead33e5c
...
@@ -186,7 +186,7 @@ namespace RTC
...
@@ -186,7 +186,7 @@ namespace RTC
jsonConsumableRtpEncodingsIt
->
emplace_back
(
json
::
value_t
::
object
);
jsonConsumableRtpEncodingsIt
->
emplace_back
(
json
::
value_t
::
object
);
auto
&
jsonEntry
=
(
*
jsonConsumableRtpEncodingsIt
)[
i
];
auto
&
jsonEntry
=
(
*
jsonConsumableRtpEncodingsIt
)[
i
];
auto
&
encoding
=
this
->
consumableRtpEncodings
[
i
];
const
auto
&
encoding
=
this
->
consumableRtpEncodings
[
i
];
encoding
.
FillJson
(
jsonEntry
);
encoding
.
FillJson
(
jsonEntry
);
}
}
...
...
worker/src/RTC/DataProducer.cpp
浏览文件 @
ead33e5c
...
@@ -110,7 +110,7 @@ namespace RTC
...
@@ -110,7 +110,7 @@ namespace RTC
jsonObject
[
"bytesReceived"
]
=
this
->
bytesReceived
;
jsonObject
[
"bytesReceived"
]
=
this
->
bytesReceived
;
}
}
void
DataProducer
::
HandleRequest
(
Channel
::
Request
*
request
)
void
DataProducer
::
HandleRequest
(
Channel
::
Request
*
request
)
const
{
{
MS_TRACE
();
MS_TRACE
();
...
...
worker/src/RTC/PipeConsumer.cpp
浏览文件 @
ead33e5c
...
@@ -481,7 +481,7 @@ namespace RTC
...
@@ -481,7 +481,7 @@ namespace RTC
for
(
size_t
idx
{
0u
};
idx
<
this
->
rtpParameters
.
encodings
.
size
();
++
idx
)
for
(
size_t
idx
{
0u
};
idx
<
this
->
rtpParameters
.
encodings
.
size
();
++
idx
)
{
{
auto
&
encoding
=
this
->
rtpParameters
.
encodings
[
idx
];
auto
&
encoding
=
this
->
rtpParameters
.
encodings
[
idx
];
auto
*
mediaCodec
=
this
->
rtpParameters
.
GetCodecForEncoding
(
encoding
);
const
auto
*
mediaCodec
=
this
->
rtpParameters
.
GetCodecForEncoding
(
encoding
);
MS_DEBUG_TAG
(
MS_DEBUG_TAG
(
rtp
,
"[ssrc:%"
PRIu32
", payloadType:%"
PRIu8
"]"
,
encoding
.
ssrc
,
mediaCodec
->
payloadType
);
rtp
,
"[ssrc:%"
PRIu32
", payloadType:%"
PRIu8
"]"
,
encoding
.
ssrc
,
mediaCodec
->
payloadType
);
...
@@ -522,9 +522,9 @@ namespace RTC
...
@@ -522,9 +522,9 @@ namespace RTC
params
.
useDtx
=
true
;
params
.
useDtx
=
true
;
}
}
for
(
auto
&
fb
:
mediaCodec
->
rtcpFeedback
)
for
(
const
auto
&
fb
:
mediaCodec
->
rtcpFeedback
)
{
{
if
(
!
params
.
useNack
&&
fb
.
type
==
"nack"
&&
fb
.
parameter
==
""
)
if
(
!
params
.
useNack
&&
fb
.
type
==
"nack"
&&
fb
.
parameter
.
empty
()
)
{
{
MS_DEBUG_2TAGS
(
rtp
,
rtcp
,
"NACK supported"
);
MS_DEBUG_2TAGS
(
rtp
,
rtcp
,
"NACK supported"
);
...
@@ -552,7 +552,7 @@ namespace RTC
...
@@ -552,7 +552,7 @@ namespace RTC
if
(
IsPaused
()
||
IsProducerPaused
())
if
(
IsPaused
()
||
IsProducerPaused
())
rtpStream
->
Pause
();
rtpStream
->
Pause
();
auto
*
rtxCodec
=
this
->
rtpParameters
.
GetRtxCodecForEncoding
(
encoding
);
const
auto
*
rtxCodec
=
this
->
rtpParameters
.
GetRtxCodecForEncoding
(
encoding
);
if
(
rtxCodec
&&
encoding
.
hasRtx
)
if
(
rtxCodec
&&
encoding
.
hasRtx
)
rtpStream
->
SetRtx
(
rtxCodec
->
payloadType
,
encoding
.
rtx
.
ssrc
);
rtpStream
->
SetRtx
(
rtxCodec
->
payloadType
,
encoding
.
rtx
.
ssrc
);
...
...
worker/src/RTC/PortManager.cpp
浏览文件 @
ead33e5c
...
@@ -438,7 +438,7 @@ namespace RTC
...
@@ -438,7 +438,7 @@ namespace RTC
for
(
auto
&
kv
:
PortManager
::
mapUdpIpPorts
)
for
(
auto
&
kv
:
PortManager
::
mapUdpIpPorts
)
{
{
auto
&
ip
=
kv
.
first
;
const
auto
&
ip
=
kv
.
first
;
auto
&
ports
=
kv
.
second
;
auto
&
ports
=
kv
.
second
;
(
*
jsonUdpIt
)[
ip
]
=
json
::
array
();
(
*
jsonUdpIt
)[
ip
]
=
json
::
array
();
...
@@ -461,7 +461,7 @@ namespace RTC
...
@@ -461,7 +461,7 @@ namespace RTC
for
(
auto
&
kv
:
PortManager
::
mapTcpIpPorts
)
for
(
auto
&
kv
:
PortManager
::
mapTcpIpPorts
)
{
{
auto
&
ip
=
kv
.
first
;
const
auto
&
ip
=
kv
.
first
;
auto
&
ports
=
kv
.
second
;
auto
&
ports
=
kv
.
second
;
(
*
jsonTcpIt
)[
ip
]
=
json
::
array
();
(
*
jsonTcpIt
)[
ip
]
=
json
::
array
();
...
...
worker/src/RTC/Producer.cpp
浏览文件 @
ead33e5c
...
@@ -355,7 +355,7 @@ namespace RTC
...
@@ -355,7 +355,7 @@ namespace RTC
jsonEncodingsIt
->
emplace_back
(
json
::
value_t
::
object
);
jsonEncodingsIt
->
emplace_back
(
json
::
value_t
::
object
);
auto
&
jsonEntry
=
(
*
jsonEncodingsIt
)[
i
];
auto
&
jsonEntry
=
(
*
jsonEncodingsIt
)[
i
];
auto
&
encodingMapping
=
this
->
rtpMapping
.
encodings
[
i
];
const
auto
&
encodingMapping
=
this
->
rtpMapping
.
encodings
[
i
];
if
(
!
encodingMapping
.
rid
.
empty
())
if
(
!
encodingMapping
.
rid
.
empty
())
jsonEntry
[
"rid"
]
=
encodingMapping
.
rid
;
jsonEntry
[
"rid"
]
=
encodingMapping
.
rid
;
...
@@ -841,8 +841,8 @@ namespace RTC
...
@@ -841,8 +841,8 @@ namespace RTC
for
(
size_t
i
{
0
};
i
<
this
->
rtpParameters
.
encodings
.
size
();
++
i
)
for
(
size_t
i
{
0
};
i
<
this
->
rtpParameters
.
encodings
.
size
();
++
i
)
{
{
auto
&
encoding
=
this
->
rtpParameters
.
encodings
[
i
];
auto
&
encoding
=
this
->
rtpParameters
.
encodings
[
i
];
auto
*
mediaCodec
=
this
->
rtpParameters
.
GetCodecForEncoding
(
encoding
);
const
auto
*
mediaCodec
=
this
->
rtpParameters
.
GetCodecForEncoding
(
encoding
);
auto
*
rtxCodec
=
this
->
rtpParameters
.
GetRtxCodecForEncoding
(
encoding
);
const
auto
*
rtxCodec
=
this
->
rtpParameters
.
GetRtxCodecForEncoding
(
encoding
);
bool
isMediaPacket
=
(
mediaCodec
->
payloadType
==
payloadType
);
bool
isMediaPacket
=
(
mediaCodec
->
payloadType
==
payloadType
);
bool
isRtxPacket
=
(
rtxCodec
&&
rtxCodec
->
payloadType
==
payloadType
);
bool
isRtxPacket
=
(
rtxCodec
&&
rtxCodec
->
payloadType
==
payloadType
);
...
@@ -896,8 +896,8 @@ namespace RTC
...
@@ -896,8 +896,8 @@ namespace RTC
if
(
encoding
.
rid
!=
rid
)
if
(
encoding
.
rid
!=
rid
)
continue
;
continue
;
auto
*
mediaCodec
=
this
->
rtpParameters
.
GetCodecForEncoding
(
encoding
);
const
auto
*
mediaCodec
=
this
->
rtpParameters
.
GetCodecForEncoding
(
encoding
);
auto
*
rtxCodec
=
this
->
rtpParameters
.
GetRtxCodecForEncoding
(
encoding
);
const
auto
*
rtxCodec
=
this
->
rtpParameters
.
GetRtxCodecForEncoding
(
encoding
);
bool
isMediaPacket
=
(
mediaCodec
->
payloadType
==
payloadType
);
bool
isMediaPacket
=
(
mediaCodec
->
payloadType
==
payloadType
);
bool
isRtxPacket
=
(
rtxCodec
&&
rtxCodec
->
payloadType
==
payloadType
);
bool
isRtxPacket
=
(
rtxCodec
&&
rtxCodec
->
payloadType
==
payloadType
);
...
@@ -971,8 +971,8 @@ namespace RTC
...
@@ -971,8 +971,8 @@ namespace RTC
// clang-format on
// clang-format on
{
{
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
);
auto
*
rtxCodec
=
this
->
rtpParameters
.
GetRtxCodecForEncoding
(
encoding
);
const
auto
*
rtxCodec
=
this
->
rtpParameters
.
GetRtxCodecForEncoding
(
encoding
);
bool
isMediaPacket
=
(
mediaCodec
->
payloadType
==
payloadType
);
bool
isMediaPacket
=
(
mediaCodec
->
payloadType
==
payloadType
);
bool
isRtxPacket
=
(
rtxCodec
&&
rtxCodec
->
payloadType
==
payloadType
);
bool
isRtxPacket
=
(
rtxCodec
&&
rtxCodec
->
payloadType
==
payloadType
);
...
@@ -1090,9 +1090,9 @@ namespace RTC
...
@@ -1090,9 +1090,9 @@ namespace RTC
params
.
useDtx
=
true
;
params
.
useDtx
=
true
;
}
}
for
(
auto
&
fb
:
mediaCodec
.
rtcpFeedback
)
for
(
const
auto
&
fb
:
mediaCodec
.
rtcpFeedback
)
{
{
if
(
!
params
.
useNack
&&
fb
.
type
==
"nack"
&&
fb
.
parameter
==
""
)
if
(
!
params
.
useNack
&&
fb
.
type
==
"nack"
&&
fb
.
parameter
.
empty
()
)
{
{
MS_DEBUG_2TAGS
(
rtp
,
rtcp
,
"NACK supported"
);
MS_DEBUG_2TAGS
(
rtp
,
rtcp
,
"NACK supported"
);
...
...
worker/src/RTC/Router.cpp
浏览文件 @
ead33e5c
...
@@ -668,7 +668,7 @@ namespace RTC
...
@@ -668,7 +668,7 @@ namespace RTC
for
(
auto
*
consumer
:
consumers
)
for
(
auto
*
consumer
:
consumers
)
{
{
// Update MID RTP extension value.
// Update MID RTP extension value.
auto
&
mid
=
consumer
->
GetRtpParameters
().
mid
;
const
auto
&
mid
=
consumer
->
GetRtpParameters
().
mid
;
if
(
!
mid
.
empty
())
if
(
!
mid
.
empty
())
packet
->
UpdateMid
(
mid
);
packet
->
UpdateMid
(
mid
);
...
@@ -736,7 +736,7 @@ namespace RTC
...
@@ -736,7 +736,7 @@ namespace RTC
this
->
mapConsumerProducer
[
consumer
]
=
producer
;
this
->
mapConsumerProducer
[
consumer
]
=
producer
;
// Get all streams in the Producer and provide the Consumer with them.
// Get all streams in the Producer and provide the Consumer with them.
for
(
auto
&
kv
:
producer
->
GetRtpStreams
())
for
(
const
auto
&
kv
:
producer
->
GetRtpStreams
())
{
{
auto
*
rtpStream
=
kv
.
first
;
auto
*
rtpStream
=
kv
.
first
;
uint32_t
mappedSsrc
=
kv
.
second
;
uint32_t
mappedSsrc
=
kv
.
second
;
...
...
worker/src/RTC/RtpPacket.cpp
浏览文件 @
ead33e5c
...
@@ -179,7 +179,7 @@ namespace RTC
...
@@ -179,7 +179,7 @@ namespace RTC
{
{
extIds
.
reserve
(
this
->
mapOneByteExtensions
.
size
());
extIds
.
reserve
(
this
->
mapOneByteExtensions
.
size
());
for
(
auto
&
kv
:
this
->
mapOneByteExtensions
)
for
(
const
auto
&
kv
:
this
->
mapOneByteExtensions
)
{
{
extIds
.
push_back
(
std
::
to_string
(
kv
.
first
));
extIds
.
push_back
(
std
::
to_string
(
kv
.
first
));
}
}
...
@@ -188,7 +188,7 @@ namespace RTC
...
@@ -188,7 +188,7 @@ namespace RTC
{
{
extIds
.
reserve
(
this
->
mapTwoBytesExtensions
.
size
());
extIds
.
reserve
(
this
->
mapTwoBytesExtensions
.
size
());
for
(
auto
&
kv
:
this
->
mapTwoBytesExtensions
)
for
(
const
auto
&
kv
:
this
->
mapTwoBytesExtensions
)
{
{
extIds
.
push_back
(
std
::
to_string
(
kv
.
first
));
extIds
.
push_back
(
std
::
to_string
(
kv
.
first
));
}
}
...
@@ -407,7 +407,7 @@ namespace RTC
...
@@ -407,7 +407,7 @@ namespace RTC
// Calculate total size required for all extensions (with padding if needed).
// Calculate total size required for all extensions (with padding if needed).
size_t
extensionsTotalSize
{
0
};
size_t
extensionsTotalSize
{
0
};
for
(
auto
&
extension
:
extensions
)
for
(
const
auto
&
extension
:
extensions
)
{
{
if
(
type
==
1u
)
if
(
type
==
1u
)
{
{
...
@@ -484,7 +484,7 @@ namespace RTC
...
@@ -484,7 +484,7 @@ namespace RTC
// Write the new extensions into the header extension value.
// Write the new extensions into the header extension value.
uint8_t
*
ptr
=
this
->
headerExtension
->
value
;
uint8_t
*
ptr
=
this
->
headerExtension
->
value
;
for
(
auto
&
extension
:
extensions
)
for
(
const
auto
&
extension
:
extensions
)
{
{
if
(
type
==
1u
)
if
(
type
==
1u
)
{
{
...
...
worker/src/RTC/RtpStream.cpp
浏览文件 @
ead33e5c
...
@@ -274,7 +274,7 @@ namespace RTC
...
@@ -274,7 +274,7 @@ namespace RTC
// clang-tidy "thinks" that this can lead to division by zero but we are
// clang-tidy "thinks" that this can lead to division by zero but we are
// smarter.
// smarter.
// NOLINTNEXTLINE(clang-analyzer-core.DivideZero)
// NOLINTNEXTLINE(clang-analyzer-core.DivideZero)
this
->
score
=
static_cast
<
uint8_t
>
(
std
::
round
(
static_cast
<
float
>
(
totalScore
)
/
samples
));
this
->
score
=
static_cast
<
uint8_t
>
(
std
::
round
(
static_cast
<
double
>
(
totalScore
)
/
samples
));
// Call the listener if the global score has changed.
// Call the listener if the global score has changed.
if
(
this
->
score
!=
previousScore
)
if
(
this
->
score
!=
previousScore
)
...
...
worker/src/RTC/RtpStreamRecv.cpp
浏览文件 @
ead33e5c
...
@@ -448,7 +448,7 @@ namespace RTC
...
@@ -448,7 +448,7 @@ namespace RTC
if
(
expectedInterval
==
0
||
lostInterval
<=
0
)
if
(
expectedInterval
==
0
||
lostInterval
<=
0
)
this
->
fractionLost
=
0
;
this
->
fractionLost
=
0
;
else
else
this
->
fractionLost
=
std
::
round
(((
lostInterval
<<
8
)
/
expectedInterval
));
this
->
fractionLost
=
std
::
round
((
static_cast
<
double
>
(
lostInterval
<<
8
)
/
expectedInterval
));
// Worst remote fraction lost is not worse than local one.
// Worst remote fraction lost is not worse than local one.
if
(
worstRemoteFractionLost
<=
this
->
fractionLost
)
if
(
worstRemoteFractionLost
<=
this
->
fractionLost
)
...
@@ -557,15 +557,11 @@ namespace RTC
...
@@ -557,15 +557,11 @@ namespace RTC
// If no Receiver Extended Report was received by the remote endpoint yet,
// If no Receiver Extended Report was received by the remote endpoint yet,
// ignore lastRr and dlrr values in the Sender Extended Report.
// ignore lastRr and dlrr values in the Sender Extended Report.
if
(
!
lastRr
||
!
dlrr
)
if
(
lastRr
&&
dlrr
&&
(
compactNtp
>
dlrr
+
lastRr
))
rtt
=
0
;
else
if
(
compactNtp
>
dlrr
+
lastRr
)
rtt
=
compactNtp
-
dlrr
-
lastRr
;
rtt
=
compactNtp
-
dlrr
-
lastRr
;
else
rtt
=
0
;
// RTT in milliseconds.
// RTT in milliseconds.
this
->
rtt
=
(
rtt
>>
16
)
*
1000
;
this
->
rtt
=
static_cast
<
float
>
(
rtt
>>
16
)
*
1000
;
this
->
rtt
+=
(
static_cast
<
float
>
(
rtt
&
0x0000FFFF
)
/
65536
)
*
1000
;
this
->
rtt
+=
(
static_cast
<
float
>
(
rtt
&
0x0000FFFF
)
/
65536
)
*
1000
;
if
(
this
->
rtt
>
0.0
f
)
if
(
this
->
rtt
>
0.0
f
)
...
@@ -740,7 +736,7 @@ namespace RTC
...
@@ -740,7 +736,7 @@ namespace RTC
MS_ASSERT
(
retransmitted
>=
repaired
,
"repaired packets cannot be more than retransmitted ones"
);
MS_ASSERT
(
retransmitted
>=
repaired
,
"repaired packets cannot be more than retransmitted ones"
);
if
(
retransmitted
>
0
)
if
(
retransmitted
>
0
)
repairedWeight
*=
repaired
/
retransmitted
;
repairedWeight
*=
static_cast
<
float
>
(
repaired
)
/
retransmitted
;
lost
-=
repaired
*
repairedWeight
;
lost
-=
repaired
*
repairedWeight
;
...
...
worker/src/RTC/RtpStreamSend.cpp
浏览文件 @
ead33e5c
...
@@ -17,6 +17,20 @@ namespace RTC
...
@@ -17,6 +17,20 @@ namespace RTC
static
constexpr
uint32_t
MaxRetransmissionDelay
{
2000
};
static
constexpr
uint32_t
MaxRetransmissionDelay
{
2000
};
static
constexpr
uint32_t
DefaultRtt
{
100
};
static
constexpr
uint32_t
DefaultRtt
{
100
};
static
void
resetStorageItem
(
RTC
::
RtpStreamSend
::
StorageItem
*
storageItem
)
{
MS_TRACE
();
MS_ASSERT
(
storageItem
,
"storageItem cannot be nullptr"
);
delete
storageItem
->
packet
;
storageItem
->
packet
=
nullptr
;
storageItem
->
resentAtMs
=
0
;
storageItem
->
sentTimes
=
0
;
storageItem
->
rtxEncoded
=
false
;
}
/* Instance methods. */
/* Instance methods. */
RtpStreamSend
::
RtpStreamSend
(
RtpStreamSend
::
RtpStreamSend
(
...
@@ -288,7 +302,7 @@ namespace RTC
...
@@ -288,7 +302,7 @@ namespace RTC
return
;
return
;
// Reset the storage item.
// Reset the storage item.
R
esetStorageItem
(
storageItem
);
r
esetStorageItem
(
storageItem
);
// If this was the item referenced by the buffer start index, move it to
// If this was the item referenced by the buffer start index, move it to
// the next one.
// the next one.
...
@@ -311,7 +325,7 @@ namespace RTC
...
@@ -311,7 +325,7 @@ namespace RTC
auto
*
firstStorageItem
=
this
->
buffer
[
this
->
bufferStartIdx
];
auto
*
firstStorageItem
=
this
->
buffer
[
this
->
bufferStartIdx
];
// Reset the first storage item.
// Reset the first storage item.
R
esetStorageItem
(
firstStorageItem
);
r
esetStorageItem
(
firstStorageItem
);
// Unfill the buffer start item.
// Unfill the buffer start item.
this
->
buffer
[
this
->
bufferStartIdx
]
=
nullptr
;
this
->
buffer
[
this
->
bufferStartIdx
]
=
nullptr
;
...
@@ -347,7 +361,7 @@ namespace RTC
...
@@ -347,7 +361,7 @@ namespace RTC
}
}
// Reset (free RTP packet) the storage item.
// Reset (free RTP packet) the storage item.
R
esetStorageItem
(
storageItem
);
r
esetStorageItem
(
storageItem
);
// Unfill the buffer item.
// Unfill the buffer item.
this
->
buffer
[
idx
]
=
nullptr
;
this
->
buffer
[
idx
]
=
nullptr
;
...
@@ -358,20 +372,6 @@ namespace RTC
...
@@ -358,20 +372,6 @@ namespace RTC
this
->
bufferSize
=
0
;
this
->
bufferSize
=
0
;
}
}
inline
void
RtpStreamSend
::
ResetStorageItem
(
StorageItem
*
storageItem
)
{
MS_TRACE
();
MS_ASSERT
(
storageItem
,
"storageItem cannot be nullptr"
);
delete
storageItem
->
packet
;
storageItem
->
packet
=
nullptr
;
storageItem
->
resentAtMs
=
0
;
storageItem
->
sentTimes
=
0
;
storageItem
->
rtxEncoded
=
false
;
}
/**
/**
* Iterates the buffer starting from the current start idx + 1 until next
* Iterates the buffer starting from the current start idx + 1 until next
* used one. It takes into account that the buffer is circular.
* used one. It takes into account that the buffer is circular.
...
...
worker/src/RTC/RtxStream.cpp
浏览文件 @
ead33e5c
...
@@ -110,7 +110,7 @@ namespace RTC
...
@@ -110,7 +110,7 @@ namespace RTC
if
(
expectedInterval
==
0
||
lostInterval
<=
0
)
if
(
expectedInterval
==
0
||
lostInterval
<=
0
)
this
->
fractionLost
=
0
;
this
->
fractionLost
=
0
;
else
else
this
->
fractionLost
=
std
::
round
(((
lostInterval
<<
8
)
/
expectedInterval
));
this
->
fractionLost
=
std
::
round
((
static_cast
<
double
>
(
lostInterval
<<
8
)
/
expectedInterval
));
this
->
reportedPacketLost
+=
(
this
->
packetsLost
-
prevPacketsLost
);
this
->
reportedPacketLost
+=
(
this
->
packetsLost
-
prevPacketsLost
);
...
...
worker/src/RTC/SctpListener.cpp
浏览文件 @
ead33e5c
...
@@ -19,7 +19,7 @@ namespace RTC
...
@@ -19,7 +19,7 @@ namespace RTC
auto
jsonStreamIdTableIt
=
jsonObject
.
find
(
"streamIdTable"
);
auto
jsonStreamIdTableIt
=
jsonObject
.
find
(
"streamIdTable"
);
// Add streamIdTable.
// Add streamIdTable.
for
(
auto
&
kv
:
this
->
streamIdTable
)
for
(
const
auto
&
kv
:
this
->
streamIdTable
)
{
{
auto
streamId
=
kv
.
first
;
auto
streamId
=
kv
.
first
;
auto
*
dataProducer
=
kv
.
second
;
auto
*
dataProducer
=
kv
.
second
;
...
...
worker/src/RTC/SimpleConsumer.cpp
浏览文件 @
ead33e5c
...
@@ -463,7 +463,7 @@ namespace RTC
...
@@ -463,7 +463,7 @@ namespace RTC
MS_TRACE
();
MS_TRACE
();
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
);
MS_DEBUG_TAG
(
MS_DEBUG_TAG
(
rtp
,
"[ssrc:%"
PRIu32
", payloadType:%"
PRIu8
"]"
,
encoding
.
ssrc
,
mediaCodec
->
payloadType
);
rtp
,
"[ssrc:%"
PRIu32
", payloadType:%"
PRIu8
"]"
,
encoding
.
ssrc
,
mediaCodec
->
payloadType
);
...
...
worker/src/RTC/StunPacket.cpp
浏览文件 @
ead33e5c
...
@@ -481,7 +481,7 @@ namespace RTC
...
@@ -481,7 +481,7 @@ namespace RTC
this
->
klass
==
Class
::
REQUEST
,
this
->
klass
==
Class
::
REQUEST
,
"attempt to create an error response for a non Request STUN packet"
);
"attempt to create an error response for a non Request STUN packet"
);
auto
response
=
auto
*
response
=
new
StunPacket
(
Class
::
ERROR_RESPONSE
,
this
->
method
,
this
->
transactionId
,
nullptr
,
0
);
new
StunPacket
(
Class
::
ERROR_RESPONSE
,
this
->
method
,
this
->
transactionId
,
nullptr
,
0
);
response
->
SetErrorCode
(
errorCode
);
response
->
SetErrorCode
(
errorCode
);
...
...
worker/src/RTC/Transport.cpp
浏览文件 @
ead33e5c
...
@@ -295,9 +295,9 @@ namespace RTC
...
@@ -295,9 +295,9 @@ namespace RTC
jsonObject
[
"producerIds"
]
=
json
::
array
();
jsonObject
[
"producerIds"
]
=
json
::
array
();
auto
jsonProducerIdsIt
=
jsonObject
.
find
(
"producerIds"
);
auto
jsonProducerIdsIt
=
jsonObject
.
find
(
"producerIds"
);
for
(
auto
&
kv
:
this
->
mapProducers
)
for
(
const
auto
&
kv
:
this
->
mapProducers
)
{
{
auto
&
producerId
=
kv
.
first
;
const
auto
&
producerId
=
kv
.
first
;
jsonProducerIdsIt
->
emplace_back
(
producerId
);
jsonProducerIdsIt
->
emplace_back
(
producerId
);
}
}
...
@@ -306,9 +306,9 @@ namespace RTC
...
@@ -306,9 +306,9 @@ namespace RTC
jsonObject
[
"consumerIds"
]
=
json
::
array
();
jsonObject
[
"consumerIds"
]
=
json
::
array
();
auto
jsonConsumerIdsIt
=
jsonObject
.
find
(
"consumerIds"
);
auto
jsonConsumerIdsIt
=
jsonObject
.
find
(
"consumerIds"
);
for
(
auto
&
kv
:
this
->
mapConsumers
)
for
(
const
auto
&
kv
:
this
->
mapConsumers
)
{
{
auto
&
consumerId
=
kv
.
first
;
const
auto
&
consumerId
=
kv
.
first
;
jsonConsumerIdsIt
->
emplace_back
(
consumerId
);
jsonConsumerIdsIt
->
emplace_back
(
consumerId
);
}
}
...
@@ -317,7 +317,7 @@ namespace RTC
...
@@ -317,7 +317,7 @@ namespace RTC
jsonObject
[
"mapSsrcConsumerId"
]
=
json
::
object
();
jsonObject
[
"mapSsrcConsumerId"
]
=
json
::
object
();
auto
jsonMapSsrcConsumerId
=
jsonObject
.
find
(
"mapSsrcConsumerId"
);
auto
jsonMapSsrcConsumerId
=
jsonObject
.
find
(
"mapSsrcConsumerId"
);
for
(
auto
&
kv
:
this
->
mapSsrcConsumer
)
for
(
const
auto
&
kv
:
this
->
mapSsrcConsumer
)
{
{
auto
ssrc
=
kv
.
first
;
auto
ssrc
=
kv
.
first
;
auto
*
consumer
=
kv
.
second
;
auto
*
consumer
=
kv
.
second
;
...
@@ -329,7 +329,7 @@ namespace RTC
...
@@ -329,7 +329,7 @@ namespace RTC
jsonObject
[
"mapRtxSsrcConsumerId"
]
=
json
::
object
();
jsonObject
[
"mapRtxSsrcConsumerId"
]
=
json
::
object
();
auto
jsonMapRtxSsrcConsumerId
=
jsonObject
.
find
(
"mapRtxSsrcConsumerId"
);
auto
jsonMapRtxSsrcConsumerId
=
jsonObject
.
find
(
"mapRtxSsrcConsumerId"
);
for
(
auto
&
kv
:
this
->
mapRtxSsrcConsumer
)
for
(
const
auto
&
kv
:
this
->
mapRtxSsrcConsumer
)
{
{
auto
ssrc
=
kv
.
first
;
auto
ssrc
=
kv
.
first
;
auto
*
consumer
=
kv
.
second
;
auto
*
consumer
=
kv
.
second
;
...
@@ -341,9 +341,9 @@ namespace RTC
...
@@ -341,9 +341,9 @@ namespace RTC
jsonObject
[
"dataProducerIds"
]
=
json
::
array
();
jsonObject
[
"dataProducerIds"
]
=
json
::
array
();
auto
jsonDataProducerIdsIt
=
jsonObject
.
find
(
"dataProducerIds"
);
auto
jsonDataProducerIdsIt
=
jsonObject
.
find
(
"dataProducerIds"
);
for
(
auto
&
kv
:
this
->
mapDataProducers
)
for
(
const
auto
&
kv
:
this
->
mapDataProducers
)
{
{
auto
&
dataProducerId
=
kv
.
first
;
const
auto
&
dataProducerId
=
kv
.
first
;
jsonDataProducerIdsIt
->
emplace_back
(
dataProducerId
);
jsonDataProducerIdsIt
->
emplace_back
(
dataProducerId
);
}
}
...
@@ -352,9 +352,9 @@ namespace RTC
...
@@ -352,9 +352,9 @@ namespace RTC
jsonObject
[
"dataConsumerIds"
]
=
json
::
array
();
jsonObject
[
"dataConsumerIds"
]
=
json
::
array
();
auto
jsonDataConsumerIdsIt
=
jsonObject
.
find
(
"dataConsumerIds"
);
auto
jsonDataConsumerIdsIt
=
jsonObject
.
find
(
"dataConsumerIds"
);
for
(
auto
&
kv
:
this
->
mapDataConsumers
)
for
(
const
auto
&
kv
:
this
->
mapDataConsumers
)
{
{
auto
&
dataConsumerId
=
kv
.
first
;
const
auto
&
dataConsumerId
=
kv
.
first
;
jsonDataConsumerIdsIt
->
emplace_back
(
dataConsumerId
);
jsonDataConsumerIdsIt
->
emplace_back
(
dataConsumerId
);
}
}
...
@@ -629,7 +629,7 @@ namespace RTC
...
@@ -629,7 +629,7 @@ namespace RTC
// add them to the Transport.
// add them to the Transport.
// NOTE: Producer::GetRtpHeaderExtensionIds() returns the original
// NOTE: Producer::GetRtpHeaderExtensionIds() returns the original
// header extension ids of the Producer (and not their mapped values).
// header extension ids of the Producer (and not their mapped values).
auto
&
producerRtpHeaderExtensionIds
=
producer
->
GetRtpHeaderExtensionIds
();
const
auto
&
producerRtpHeaderExtensionIds
=
producer
->
GetRtpHeaderExtensionIds
();
if
(
producerRtpHeaderExtensionIds
.
mid
!=
0u
)
if
(
producerRtpHeaderExtensionIds
.
mid
!=
0u
)
this
->
recvRtpHeaderExtensionIds
.
mid
=
producerRtpHeaderExtensionIds
.
mid
;
this
->
recvRtpHeaderExtensionIds
.
mid
=
producerRtpHeaderExtensionIds
.
mid
;
...
@@ -656,8 +656,8 @@ namespace RTC
...
@@ -656,8 +656,8 @@ namespace RTC
// Check if TransportCongestionControlServer or REMB server must be
// Check if TransportCongestionControlServer or REMB server must be
// created.
// created.
auto
&
rtpHeaderExtensionIds
=
producer
->
GetRtpHeaderExtensionIds
();
const
auto
&
rtpHeaderExtensionIds
=
producer
->
GetRtpHeaderExtensionIds
();
auto
&
codecs
=
producer
->
GetRtpParameters
().
codecs
;
const
auto
&
codecs
=
producer
->
GetRtpParameters
().
codecs
;
// Set TransportCongestionControlServer.
// Set TransportCongestionControlServer.
if
(
!
this
->
tccServer
)
if
(
!
this
->
tccServer
)
...
@@ -844,7 +844,7 @@ namespace RTC
...
@@ -844,7 +844,7 @@ namespace RTC
// Check if Transport Congestion Control client must be created.
// Check if Transport Congestion Control client must be created.
const
auto
&
rtpHeaderExtensionIds
=
consumer
->
GetRtpHeaderExtensionIds
();
const
auto
&
rtpHeaderExtensionIds
=
consumer
->
GetRtpHeaderExtensionIds
();
auto
&
codecs
=
consumer
->
GetRtpParameters
().
codecs
;
const
auto
&
codecs
=
consumer
->
GetRtpParameters
().
codecs
;
// Set TransportCongestionControlClient.
// Set TransportCongestionControlClient.
if
(
!
this
->
tccClient
)
if
(
!
this
->
tccClient
)
...
@@ -1412,8 +1412,8 @@ namespace RTC
...
@@ -1412,8 +1412,8 @@ namespace RTC
}
}
auto
ppid
=
jsonPpidIt
->
get
<
uint32_t
>
();
auto
ppid
=
jsonPpidIt
->
get
<
uint32_t
>
();
auto
*
msg
=
notification
->
payload
;
auto
len
=
notification
->
payloadLen
;
auto
len
=
notification
->
payloadLen
;
const
auto
*
msg
=
notification
->
payload
;
if
(
len
>
this
->
maxMessageSize
)
if
(
len
>
this
->
maxMessageSize
)
{
{
...
@@ -2441,7 +2441,7 @@ namespace RTC
...
@@ -2441,7 +2441,7 @@ namespace RTC
SendRtpPacket
(
packet
,
cb
);
SendRtpPacket
(
packet
,
cb
);
#else
#else
auto
*
cb
=
new
onSendCallback
([
tccClient
,
&
packetInfo
](
bool
sent
)
{
const
auto
*
cb
=
new
onSendCallback
([
tccClient
,
&
packetInfo
](
bool
sent
)
{
if
(
sent
)
if
(
sent
)
tccClient
->
PacketSent
(
packetInfo
,
DepLibUV
::
GetTimeMsInt64
());
tccClient
->
PacketSent
(
packetInfo
,
DepLibUV
::
GetTimeMsInt64
());
});
});
...
@@ -2509,7 +2509,7 @@ namespace RTC
...
@@ -2509,7 +2509,7 @@ namespace RTC
SendRtpPacket
(
packet
,
cb
);
SendRtpPacket
(
packet
,
cb
);
#else
#else
auto
*
cb
=
new
onSendCallback
([
tccClient
,
&
packetInfo
](
bool
sent
)
{
const
auto
*
cb
=
new
onSendCallback
([
tccClient
,
&
packetInfo
](
bool
sent
)
{
if
(
sent
)
if
(
sent
)
tccClient
->
PacketSent
(
packetInfo
,
DepLibUV
::
GetTimeMsInt64
());
tccClient
->
PacketSent
(
packetInfo
,
DepLibUV
::
GetTimeMsInt64
());
});
});
...
@@ -2840,7 +2840,7 @@ namespace RTC
...
@@ -2840,7 +2840,7 @@ namespace RTC
SendRtpPacket
(
packet
,
cb
);
SendRtpPacket
(
packet
,
cb
);
#else
#else
auto
*
cb
=
new
onSendCallback
([
tccClient
,
&
packetInfo
](
bool
sent
)
{
const
auto
*
cb
=
new
onSendCallback
([
tccClient
,
&
packetInfo
](
bool
sent
)
{
if
(
sent
)
if
(
sent
)
tccClient
->
PacketSent
(
packetInfo
,
DepLibUV
::
GetTimeMsInt64
());
tccClient
->
PacketSent
(
packetInfo
,
DepLibUV
::
GetTimeMsInt64
());
});
});
...
...
worker/src/RTC/WebRtcTransport.cpp
浏览文件 @
ead33e5c
...
@@ -508,13 +508,8 @@ namespace RTC
...
@@ -508,13 +508,8 @@ namespace RTC
break
;
break
;
}
}
case
RTC
:
:
DtlsTransport
::
Role
::
SERVER
:
{
this
->
dtlsRole
=
RTC
::
DtlsTransport
::
Role
::
CLIENT
;
break
;
}
// If the peer has role "auto" we become "client" since we are ICE controlled.
// If the peer has role "auto" we become "client" since we are ICE controlled.
case
RTC
:
:
DtlsTransport
::
Role
::
SERVER
:
case
RTC
:
:
DtlsTransport
::
Role
::
AUTO
:
case
RTC
:
:
DtlsTransport
::
Role
::
AUTO
:
{
{
this
->
dtlsRole
=
RTC
::
DtlsTransport
::
Role
::
CLIENT
;
this
->
dtlsRole
=
RTC
::
DtlsTransport
::
Role
::
CLIENT
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论