Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
dfb224ef
提交
dfb224ef
authored
4月 26, 2019
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix GetRtcp in PipeConsumer (avoid assert)
上级
feb7fd40
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
74 行增加
和
37 行删除
+74
-37
Consumer.hpp
worker/include/RTC/Consumer.hpp
+5
-2
PipeConsumer.hpp
worker/include/RTC/PipeConsumer.hpp
+11
-1
SimpleConsumer.hpp
worker/include/RTC/SimpleConsumer.hpp
+7
-1
SimulcastConsumer.hpp
worker/include/RTC/SimulcastConsumer.hpp
+7
-1
PipeConsumer.cpp
worker/src/RTC/PipeConsumer.cpp
+15
-13
SimpleConsumer.cpp
worker/src/RTC/SimpleConsumer.cpp
+4
-1
SimulcastConsumer.cpp
worker/src/RTC/SimulcastConsumer.cpp
+11
-6
Transport.cpp
worker/src/RTC/Transport.cpp
+14
-12
没有找到文件。
worker/include/RTC/Consumer.hpp
浏览文件 @
dfb224ef
...
...
@@ -12,6 +12,7 @@
#include "RTC/RtpHeaderExtensionIds.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/RtpStream.hpp"
#include "RTC/RtpStreamSend.hpp"
#include <string>
#include <unordered_set>
#include <vector>
...
...
@@ -66,8 +67,10 @@ namespace RTC
virtual
uint32_t
UseAvailableBitrate
(
uint32_t
bitrate
);
virtual
uint32_t
IncreaseLayer
(
uint32_t
bitrate
);
virtual
void
ApplyLayers
();
virtual
void
SendRtpPacket
(
RTC
::
RtpPacket
*
packet
)
=
0
;
virtual
void
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
uint64_t
now
)
=
0
;
virtual
void
SendRtpPacket
(
RTC
::
RtpPacket
*
packet
)
=
0
;
virtual
std
::
vector
<
RTC
::
RtpStreamSend
*>
GetRtpStreams
()
=
0
;
virtual
void
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
RTC
::
RtpStreamSend
*
rtpStream
,
uint64_t
now
)
=
0
;
virtual
void
NeedWorstRemoteFractionLost
(
uint32_t
mappedSsrc
,
uint8_t
&
worstRemoteFractionLost
)
=
0
;
virtual
void
ReceiveNack
(
RTC
::
RTCP
::
FeedbackRtpNackPacket
*
nackPacket
)
=
0
;
virtual
void
ReceiveKeyFrameRequest
(
RTC
::
RTCP
::
FeedbackPs
::
MessageType
messageType
)
=
0
;
...
...
worker/include/RTC/PipeConsumer.hpp
浏览文件 @
dfb224ef
...
...
@@ -21,7 +21,8 @@ namespace RTC
void
ProducerNewRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
mappedSsrc
)
override
;
void
ProducerRtpStreamScore
(
RTC
::
RtpStream
*
rtpStream
,
uint8_t
score
,
uint8_t
previousScore
)
override
;
void
SendRtpPacket
(
RTC
::
RtpPacket
*
packet
)
override
;
void
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
uint64_t
now
)
override
;
void
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
RTC
::
RtpStreamSend
*
rtpStream
,
uint64_t
now
)
override
;
std
::
vector
<
RTC
::
RtpStreamSend
*>
GetRtpStreams
()
override
;
void
NeedWorstRemoteFractionLost
(
uint32_t
mappedSsrc
,
uint8_t
&
worstRemoteFractionLost
)
override
;
void
ReceiveNack
(
RTC
::
RTCP
::
FeedbackRtpNackPacket
*
nackPacket
)
override
;
void
ReceiveKeyFrameRequest
(
RTC
::
RTCP
::
FeedbackPs
::
MessageType
messageType
)
override
;
...
...
@@ -44,7 +45,16 @@ namespace RTC
private
:
// Allocated by this.
std
::
unordered_map
<
uint32_t
,
RTC
::
RtpStreamSend
*>
mapMappedSsrcRtpStream
;
// Others.
std
::
vector
<
RTC
::
RtpStreamSend
*>
rtpStreams
;
};
// Inline methods.
inline
std
::
vector
<
RTC
::
RtpStreamSend
*>
PipeConsumer
::
GetRtpStreams
()
{
return
this
->
rtpStreams
;
}
}
// namespace RTC
#endif
worker/include/RTC/SimpleConsumer.hpp
浏览文件 @
dfb224ef
...
...
@@ -23,7 +23,8 @@ namespace RTC
void
ProducerNewRtpStream
(
RTC
::
RtpStream
*
rtpStream
,
uint32_t
mappedSsrc
)
override
;
void
ProducerRtpStreamScore
(
RTC
::
RtpStream
*
rtpStream
,
uint8_t
score
,
uint8_t
previousScore
)
override
;
void
SendRtpPacket
(
RTC
::
RtpPacket
*
packet
)
override
;
void
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
uint64_t
now
)
override
;
std
::
vector
<
RTC
::
RtpStreamSend
*>
GetRtpStreams
()
override
;
void
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
RTC
::
RtpStreamSend
*
rtpStream
,
uint64_t
now
)
override
;
void
NeedWorstRemoteFractionLost
(
uint32_t
mappedSsrc
,
uint8_t
&
worstRemoteFractionLost
)
override
;
void
ReceiveNack
(
RTC
::
RTCP
::
FeedbackRtpNackPacket
*
nackPacket
)
override
;
void
ReceiveKeyFrameRequest
(
RTC
::
RTCP
::
FeedbackPs
::
MessageType
messageType
)
override
;
...
...
@@ -61,6 +62,11 @@ namespace RTC
{
return
(
RTC
::
Consumer
::
IsActive
()
&&
this
->
producerRtpStream
);
}
inline
std
::
vector
<
RTC
::
RtpStreamSend
*>
SimpleConsumer
::
GetRtpStreams
()
{
return
std
::
vector
<
RTC
::
RtpStreamSend
*>
{
this
->
rtpStream
};
}
}
// namespace RTC
#endif
worker/include/RTC/SimulcastConsumer.hpp
浏览文件 @
dfb224ef
...
...
@@ -29,7 +29,8 @@ namespace RTC
uint32_t
IncreaseLayer
(
uint32_t
bitrate
)
override
;
void
ApplyLayers
()
override
;
void
SendRtpPacket
(
RTC
::
RtpPacket
*
packet
)
override
;
void
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
uint64_t
now
)
override
;
void
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
RTC
::
RtpStreamSend
*
rtpStream
,
uint64_t
now
)
override
;
std
::
vector
<
RTC
::
RtpStreamSend
*>
GetRtpStreams
()
override
;
void
NeedWorstRemoteFractionLost
(
uint32_t
mappedSsrc
,
uint8_t
&
worstRemoteFractionLost
)
override
;
void
ReceiveNack
(
RTC
::
RTCP
::
FeedbackRtpNackPacket
*
nackPacket
)
override
;
void
ReceiveKeyFrameRequest
(
RTC
::
RTCP
::
FeedbackPs
::
MessageType
messageType
)
override
;
...
...
@@ -99,6 +100,11 @@ namespace RTC
);
// clang-format on
}
inline
std
::
vector
<
RTC
::
RtpStreamSend
*>
SimulcastConsumer
::
GetRtpStreams
()
{
return
std
::
vector
<
RTC
::
RtpStreamSend
*>
{
this
->
rtpStream
};
}
}
// namespace RTC
#endif
worker/src/RTC/PipeConsumer.cpp
浏览文件 @
dfb224ef
...
...
@@ -128,30 +128,31 @@ namespace RTC
}
}
void
PipeConsumer
::
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
uint64_t
now
)
void
PipeConsumer
::
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
RTC
::
RtpStreamSend
*
rtpStream
,
uint64_t
now
)
{
MS_TRACE
();
MS_ASSERT
(
std
::
find
(
this
->
rtpStreams
.
begin
(),
this
->
rtpStreams
.
end
(),
rtpStream
)
!=
this
->
rtpStreams
.
end
(),
"RTP stream does exist"
);
if
(
static_cast
<
float
>
((
now
-
this
->
lastRtcpSentTime
)
*
1.15
)
<
this
->
maxRtcpInterval
)
return
;
for
(
auto
&
kv
:
this
->
mapMappedSsrcRtpStream
)
{
auto
&
rtpStream
=
kv
.
second
;
auto
*
report
=
rtpStream
->
GetRtcpSenderReport
(
now
);
auto
*
report
=
rtpStream
->
GetRtcpSenderReport
(
now
);
if
(
!
report
)
continue
;
if
(
!
report
)
return
;
packet
->
AddSenderReport
(
report
);
packet
->
AddSenderReport
(
report
);
// Build SDES chunk for this sender.
auto
*
sdesChunk
=
rtpStream
->
GetRtcpSdesChunk
();
// Build SDES chunk for this sender.
auto
*
sdesChunk
=
rtpStream
->
GetRtcpSdesChunk
();
packet
->
AddSdesChunk
(
sdesChunk
);
packet
->
AddSdesChunk
(
sdesChunk
);
this
->
lastRtcpSentTime
=
now
;
}
this
->
lastRtcpSentTime
=
now
;
}
void
PipeConsumer
::
NeedWorstRemoteFractionLost
(
uint32_t
/*mappedSsrc*/
,
uint8_t
&
worstRemoteFractionLost
)
...
...
@@ -363,6 +364,7 @@ namespace RTC
rtpStream
->
SetRtx
(
rtxCodec
->
payloadType
,
encoding
.
rtx
.
ssrc
);
this
->
mapMappedSsrcRtpStream
[
encoding
.
ssrc
]
=
rtpStream
;
this
->
rtpStreams
.
push_back
(
rtpStream
);
}
}
...
...
worker/src/RTC/SimpleConsumer.cpp
浏览文件 @
dfb224ef
...
...
@@ -233,10 +233,13 @@ namespace RTC
packet
->
SetTimestamp
(
origTimestamp
);
}
void
SimpleConsumer
::
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
uint64_t
now
)
void
SimpleConsumer
::
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
RTC
::
RtpStreamSend
*
rtpStream
,
uint64_t
now
)
{
MS_TRACE
();
MS_ASSERT
(
rtpStream
==
this
->
rtpStream
,
"RTP stream does not match"
);
if
(
static_cast
<
float
>
((
now
-
this
->
lastRtcpSentTime
)
*
1.15
)
<
this
->
maxRtcpInterval
)
return
;
...
...
worker/src/RTC/SimulcastConsumer.cpp
浏览文件 @
dfb224ef
...
...
@@ -587,10 +587,12 @@ namespace RTC
if
(
this
->
keyFrameSupported
&&
!
packet
->
IsKeyFrame
())
return
;
MS_ERROR
(
"calling UpdateCurrentLayer [currentSpatialLayer:%"
PRIu16
", targetSpatialLayer:%"
PRIu16
", isKeyFrame:%s]"
,
this
->
currentSpatialLayer
,
this
->
targetSpatialLayer
,
packet
->
IsKeyFrame
()
?
"true"
:
"false"
);
MS_ERROR
(
"calling UpdateCurrentLayer [currentSpatialLayer:%"
PRIu16
", targetSpatialLayer:%"
PRIu16
", isKeyFrame:%s]"
,
this
->
currentSpatialLayer
,
this
->
targetSpatialLayer
,
packet
->
IsKeyFrame
()
?
"true"
:
"false"
);
// Update current spatial and temporal layers.
UpdateCurrentLayers
();
...
...
@@ -717,10 +719,13 @@ namespace RTC
packet
->
RestorePayload
();
}
void
SimulcastConsumer
::
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
uint64_t
now
)
void
SimulcastConsumer
::
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
RTC
::
RtpStreamSend
*
rtpStream
,
uint64_t
now
)
{
MS_TRACE
();
MS_ASSERT
(
rtpStream
==
this
->
rtpStream
,
"RTP stream does not match"
);
if
(
static_cast
<
float
>
((
now
-
this
->
lastRtcpSentTime
)
*
1.15
)
<
this
->
maxRtcpInterval
)
return
;
...
...
@@ -952,7 +957,7 @@ namespace RTC
if
(
this
->
kind
!=
RTC
::
Media
::
Kind
::
VIDEO
)
return
;
auto
*
producerTargetRtpStream
=
GetProducerTargetRtpStream
();
auto
*
producerTargetRtpStream
=
GetProducerTargetRtpStream
();
if
(
!
producerTargetRtpStream
)
return
;
...
...
worker/src/RTC/Transport.cpp
浏览文件 @
dfb224ef
...
...
@@ -760,29 +760,31 @@ namespace RTC
{
MS_TRACE
();
// - Create a CompoundPacket.
// - Request every Consumer and Producer their RTCP data.
// - Send the CompoundPacket.
std
::
unique_ptr
<
RTC
::
RTCP
::
CompoundPacket
>
packet
(
new
RTC
::
RTCP
::
CompoundPacket
());
std
::
unique_ptr
<
RTC
::
RTCP
::
CompoundPacket
>
packet
{
nullptr
};
for
(
auto
&
kv
:
this
->
mapConsumers
)
{
auto
*
consumer
=
kv
.
second
;
consumer
->
GetRtcp
(
packet
.
get
(),
now
);
// Send the RTCP compound packet if there is a sender report.
if
(
packet
->
HasSenderReport
())
for
(
auto
&
rtpStream
:
consumer
->
GetRtpStreams
())
{
packet
->
Serialize
(
RTC
::
RTCP
::
Buffer
);
SendRtcpCompoundPacket
(
packet
.
get
());
// Reset the Compound packet.
packet
.
reset
(
new
RTC
::
RTCP
::
CompoundPacket
());
consumer
->
GetRtcp
(
packet
.
get
(),
rtpStream
,
now
);
// Send the RTCP compound packet if there is a sender report.
if
(
packet
->
HasSenderReport
())
{
packet
->
Serialize
(
RTC
::
RTCP
::
Buffer
);
SendRtcpCompoundPacket
(
packet
.
get
());
}
}
}
// Reset the Compound packet.
packet
.
reset
(
new
RTC
::
RTCP
::
CompoundPacket
());
for
(
auto
&
kv
:
this
->
mapProducers
)
{
auto
*
producer
=
kv
.
second
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论