Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
780b2aaa
提交
780b2aaa
authored
9月 15, 2017
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- Improve key frame request logs
- Rename Transport::timer to Transport::rtcpTimer
上级
ca67ef70
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
51 行增加
和
39 行删除
+51
-39
Transport.hpp
worker/include/RTC/Transport.hpp
+1
-1
Consumer.cpp
worker/src/RTC/Consumer.cpp
+2
-5
Producer.cpp
worker/src/RTC/Producer.cpp
+4
-2
RtpStreamRecv.cpp
worker/src/RTC/RtpStreamRecv.cpp
+2
-0
Transport.cpp
worker/src/RTC/Transport.cpp
+42
-31
没有找到文件。
worker/include/RTC/Transport.hpp
浏览文件 @
780b2aaa
...
@@ -198,7 +198,7 @@ namespace RTC
...
@@ -198,7 +198,7 @@ namespace RTC
RTC
::
SrtpSession
*
srtpRecvSession
{
nullptr
};
RTC
::
SrtpSession
*
srtpRecvSession
{
nullptr
};
RTC
::
SrtpSession
*
srtpSendSession
{
nullptr
};
RTC
::
SrtpSession
*
srtpSendSession
{
nullptr
};
// Others.
// Others.
Timer
*
t
imer
{
nullptr
};
Timer
*
rtcpT
imer
{
nullptr
};
bool
allocated
{
false
};
bool
allocated
{
false
};
// Others (Producers and Consumers).
// Others (Producers and Consumers).
std
::
unordered_set
<
RTC
::
Producer
*>
producers
;
std
::
unordered_set
<
RTC
::
Producer
*>
producers
;
...
...
worker/src/RTC/Consumer.cpp
浏览文件 @
780b2aaa
...
@@ -385,9 +385,7 @@ namespace RTC
...
@@ -385,9 +385,7 @@ namespace RTC
this
->
syncRequired
=
false
;
this
->
syncRequired
=
false
;
MS_DEBUG_TAG
(
MS_DEBUG_TAG
(
rtp
,
"re-syncing Consumer stream [seqNum:%"
PRIu16
"]"
,
this
->
seqNum
);
rtp
,
"re-syncing Consumer stream [seqNum:%"
PRIu16
"]"
,
this
->
seqNum
);
}
}
else
else
{
{
...
@@ -397,8 +395,7 @@ namespace RTC
...
@@ -397,8 +395,7 @@ namespace RTC
this
->
rtpTimestamp
=
this
->
rtpTimestamp
=
(
packet
->
GetTimestamp
()
-
this
->
rtpTimestampBase
)
+
this
->
rtpTimestampPreviousBase
+
1
;
(
packet
->
GetTimestamp
()
-
this
->
rtpTimestampBase
)
+
this
->
rtpTimestampPreviousBase
+
1
;
this
->
seqNum
=
this
->
seqNum
=
(
packet
->
GetSequenceNumber
()
-
this
->
seqNumBase
)
+
this
->
seqNumPreviousBase
+
1
;
(
packet
->
GetSequenceNumber
()
-
this
->
seqNumBase
)
+
this
->
seqNumPreviousBase
+
1
;
// Save the received SSRC.
// Save the received SSRC.
this
->
lastReceivedSsrc
=
packet
->
GetSsrc
();
this
->
lastReceivedSsrc
=
packet
->
GetSsrc
();
...
...
worker/src/RTC/Producer.cpp
浏览文件 @
780b2aaa
...
@@ -199,6 +199,8 @@ namespace RTC
...
@@ -199,6 +199,8 @@ namespace RTC
listener
->
OnProducerResumed
(
this
);
listener
->
OnProducerResumed
(
this
);
}
}
MS_DEBUG_TAG
(
rtcp
,
"requesting full frame after resumed"
);
RequestKeyFrame
(
true
);
RequestKeyFrame
(
true
);
}
}
...
@@ -419,7 +421,7 @@ namespace RTC
...
@@ -419,7 +421,7 @@ namespace RTC
}
}
else
if
(
this
->
keyFrameRequestBlockTimer
->
IsActive
())
else
if
(
this
->
keyFrameRequestBlockTimer
->
IsActive
())
{
{
MS_DEBUG_TAG
(
rtcp
,
"blocking key frame
request until timer expires
"
);
MS_DEBUG_TAG
(
rtcp
,
"blocking key frame
due to flood protection
"
);
// Set flag.
// Set flag.
this
->
isKeyFrameRequested
=
true
;
this
->
isKeyFrameRequested
=
true
;
...
@@ -863,7 +865,7 @@ namespace RTC
...
@@ -863,7 +865,7 @@ namespace RTC
if
(
!
this
->
isKeyFrameRequested
)
if
(
!
this
->
isKeyFrameRequested
)
return
;
return
;
MS_DEBUG_TAG
(
rtcp
,
"
requesting key frame after timer expires
"
);
MS_DEBUG_TAG
(
rtcp
,
"
key frame requested during flood protection, requesting it now
"
);
RequestKeyFrame
();
RequestKeyFrame
();
}
}
...
...
worker/src/RTC/RtpStreamRecv.cpp
浏览文件 @
780b2aaa
...
@@ -245,6 +245,8 @@ namespace RTC
...
@@ -245,6 +245,8 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
MS_DEBUG_TAG
(
rtx
,
"requesting key frame [ssrc:%"
PRIu32
"]"
,
this
->
params
.
ssrc
);
RequestKeyFrame
();
RequestKeyFrame
();
}
}
...
...
worker/src/RTC/Transport.cpp
浏览文件 @
780b2aaa
...
@@ -175,10 +175,10 @@ namespace RTC
...
@@ -175,10 +175,10 @@ namespace RTC
this
->
dtlsTransport
=
new
RTC
::
DtlsTransport
(
this
);
this
->
dtlsTransport
=
new
RTC
::
DtlsTransport
(
this
);
// Create the RTCP timer.
// Create the RTCP timer.
this
->
t
imer
=
new
Timer
(
this
);
this
->
rtcpT
imer
=
new
Timer
(
this
);
// Start the RTCP timer.
// Start the RTCP timer.
this
->
t
imer
->
Start
(
static_cast
<
uint64_t
>
(
RTC
::
RTCP
::
MaxVideoIntervalMs
/
2
));
this
->
rtcpT
imer
->
Start
(
static_cast
<
uint64_t
>
(
RTC
::
RTCP
::
MaxVideoIntervalMs
/
2
));
// Hack to avoid that Destroy() above attempts to delete this.
// Hack to avoid that Destroy() above attempts to delete this.
this
->
allocated
=
true
;
this
->
allocated
=
true
;
...
@@ -189,7 +189,7 @@ namespace RTC
...
@@ -189,7 +189,7 @@ namespace RTC
MS_TRACE
();
MS_TRACE
();
// Destroy the RTCP timer.
// Destroy the RTCP timer.
this
->
t
imer
->
Destroy
();
this
->
rtcpT
imer
->
Destroy
();
}
}
void
Transport
::
Destroy
()
void
Transport
::
Destroy
()
...
@@ -736,6 +736,14 @@ namespace RTC
...
@@ -736,6 +736,14 @@ namespace RTC
break
;
break
;
}
}
MS_DEBUG_TAG
(
rtcp
,
"%s received, requesting key frame for Consumer "
"[sender ssrc:%"
PRIu32
", media ssrc:%"
PRIu32
"]"
,
RTCP
::
FeedbackPsPacket
::
MessageType2String
(
feedback
->
GetMessageType
()).
c_str
(),
feedback
->
GetMediaSsrc
(),
feedback
->
GetMediaSsrc
());
consumer
->
RequestKeyFrame
();
consumer
->
RequestKeyFrame
();
break
;
break
;
...
@@ -1559,7 +1567,7 @@ namespace RTC
...
@@ -1559,7 +1567,7 @@ namespace RTC
static_cast
<
double
>
(
effectiveBitrate
)
/
static_cast
<
double
>
(
this
->
effectiveMaxBitrate
)
<
static_cast
<
double
>
(
effectiveBitrate
)
/
static_cast
<
double
>
(
this
->
effectiveMaxBitrate
)
<
EffectiveMaxBitrateThresholdBeforeKeyFrame
)
EffectiveMaxBitrateThresholdBeforeKeyFrame
)
{
{
MS_WARN_TAG
(
rbe
,
"uplink effective max bitrate abruptly decrease, requesting key frames"
);
MS_WARN_TAG
(
rbe
,
"uplink effective max bitrate abruptly decrease
d
, requesting key frames"
);
// Request key frame for all the Producers.
// Request key frame for all the Producers.
for
(
auto
*
producer
:
this
->
producers
)
for
(
auto
*
producer
:
this
->
producers
)
...
@@ -1636,39 +1644,42 @@ namespace RTC
...
@@ -1636,39 +1644,42 @@ namespace RTC
// Do nothing.
// Do nothing.
}
}
void
Transport
::
OnTimer
(
Timer
*
/*timer*/
)
void
Transport
::
OnTimer
(
Timer
*
timer
)
{
{
uint64_t
interval
=
RTC
::
RTCP
::
MaxVideoIntervalMs
;
if
(
timer
==
this
->
rtcpTimer
)
uint32_t
now
=
DepLibUV
::
GetTime
();
SendRtcp
(
now
);
// Recalculate next RTCP interval.
if
(
!
this
->
consumers
.
empty
())
{
{
// Transmission rate in kbps.
uint64_t
interval
=
RTC
::
RTCP
::
MaxVideoIntervalMs
;
uint32_t
rate
=
0
;
uint32_t
now
=
DepLibUV
::
GetTime
();
SendRtcp
(
now
);
//
Get the RTP sending rate
.
//
Recalculate next RTCP interval
.
for
(
auto
&
consumer
:
this
->
consumers
)
if
(
!
this
->
consumers
.
empty
()
)
{
{
rate
+=
consumer
->
GetTransmissionRate
(
now
)
/
1000
;
// Transmission rate in kbps.
}
uint32_t
rate
=
0
;
// Calculate bandwidth: 360 / transmission bandwidth in kbit/s
// Get the RTP sending rate.
if
(
rate
!=
0u
)
for
(
auto
&
consumer
:
this
->
consumers
)
interval
=
360000
/
rate
;
{
rate
+=
consumer
->
GetTransmissionRate
(
now
)
/
1000
;
}
if
(
interval
>
RTC
::
RTCP
::
MaxVideoIntervalMs
)
// Calculate bandwidth: 360 / transmission bandwidth in kbit/s
i
nterval
=
RTC
::
RTCP
::
MaxVideoIntervalMs
;
i
f
(
rate
!=
0u
)
}
interval
=
360000
/
rate
;
/*
if
(
interval
>
RTC
::
RTCP
::
MaxVideoIntervalMs
)
* The interval between RTCP packets is varied randomly over the range
interval
=
RTC
::
RTCP
::
MaxVideoIntervalMs
;
* [0.5,1.5] times the calculated interval to avoid unintended synchronization
}
* of all participants.
*/
/*
interval
*=
static_cast
<
float
>
(
Utils
::
Crypto
::
GetRandomUInt
(
5
,
15
))
/
10
;
* The interval between RTCP packets is varied randomly over the range
this
->
timer
->
Start
(
interval
);
* [0.5,1.5] times the calculated interval to avoid unintended synchronization
* of all participants.
*/
interval
*=
static_cast
<
float
>
(
Utils
::
Crypto
::
GetRandomUInt
(
5
,
15
))
/
10
;
this
->
rtcpTimer
->
Start
(
interval
);
}
}
}
}
// namespace RTC
}
// namespace RTC
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论