Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
f2939643
提交
f2939643
authored
4月 26, 2019
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SimulcastConsumer:
- Improve key frame request handling. - Be able to move to spatial layer -1 in more cases.
上级
87cebfe1
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
49 行增加
和
19 行删除
+49
-19
SimulcastConsumer.hpp
worker/include/RTC/SimulcastConsumer.hpp
+3
-1
SimulcastConsumer.cpp
worker/src/RTC/SimulcastConsumer.cpp
+46
-18
没有找到文件。
worker/include/RTC/SimulcastConsumer.hpp
浏览文件 @
f2939643
...
...
@@ -42,7 +42,9 @@ namespace RTC
void
UserOnPaused
()
override
;
void
UserOnResumed
()
override
;
void
CreateRtpStream
();
void
RequestKeyFrame
();
void
RequestKeyFrames
();
void
RequestKeyFrameForTargetSpatialLayer
();
void
RequestKeyFrameForCurrentSpatialLayer
();
void
MayChangeLayers
(
bool
force
=
false
);
bool
RecalculateTargetLayers
(
int16_t
&
newTargetSpatialLayer
,
int16_t
&
newTargetTemporalLayer
)
const
;
void
UpdateTargetLayers
(
int16_t
newTargetSpatialLayer
,
int16_t
newTargetTemporalLayer
);
...
...
worker/src/RTC/SimulcastConsumer.cpp
浏览文件 @
f2939643
...
...
@@ -167,7 +167,7 @@ namespace RTC
case
Channel
:
:
Request
::
MethodId
::
CONSUMER_REQUEST_KEY_FRAME
:
{
if
(
IsActive
())
RequestKeyFrame
();
RequestKeyFrame
s
();
request
->
Accept
();
...
...
@@ -276,20 +276,14 @@ namespace RTC
if
(
rtpStream
==
GetProducerCurrentRtpStream
())
EmitScore
();
// NOTE: Here it may happen that score is 0 and there is no other Producer stream
// with score > 0, so IsActive() will return false. We can live with that.
if
(
IsActive
())
if
(
RTC
::
Consumer
::
IsActive
())
{
// Just check target layers:
// - if our bitrate is not externally managed, or
// - if this is the target spatial layer and it has died or reborned.
// Just check target layers if the stream has died or reborned.
//
// clang-format off
if
(
!
this
->
externallyManagedBitrate
||
(
(
score
==
0
||
previousScore
==
0
)
&&
rtpStream
==
GetProducerTargetRtpStream
()
)
(
score
==
0
||
previousScore
==
0
)
)
// clang-format on
{
...
...
@@ -309,7 +303,7 @@ namespace RTC
{
MS_TRACE
();
if
(
!
IsActive
())
if
(
!
RTC
::
Consumer
::
IsActive
())
return
0
;
int16_t
prioritySpatialLayer
{
0
};
...
...
@@ -345,7 +339,7 @@ namespace RTC
MS_ASSERT
(
this
->
externallyManagedBitrate
==
true
,
"bitrate is not externally managed"
);
if
(
!
IsActive
())
if
(
!
RTC
::
Consumer
::
IsActive
())
return
0
;
// Calculate virtual available bitrate based on given bitrate and our
...
...
@@ -464,7 +458,7 @@ namespace RTC
MS_ASSERT
(
this
->
externallyManagedBitrate
==
true
,
"bitrate is not externally managed"
);
if
(
!
IsActive
())
if
(
!
RTC
::
Consumer
::
IsActive
())
return
0
;
// If no target spatial layer is selected, do nothing.
...
...
@@ -551,7 +545,7 @@ namespace RTC
MS_ASSERT
(
this
->
externallyManagedBitrate
==
true
,
"bitrate is not externally managed"
);
if
(
!
IsActive
())
if
(
!
RTC
::
Consumer
::
IsActive
())
return
;
// clang-format off
...
...
@@ -777,7 +771,7 @@ namespace RTC
this
->
rtpStream
->
ReceiveKeyFrameRequest
(
messageType
);
if
(
IsActive
())
RequestKeyFrame
();
RequestKeyFrame
ForCurrentSpatialLayer
();
}
void
SimulcastConsumer
::
ReceiveRtcpReceiverReport
(
RTC
::
RTCP
::
ReceiverReport
*
report
)
...
...
@@ -926,7 +920,7 @@ namespace RTC
this
->
encodingContext
.
reset
(
RTC
::
Codecs
::
GetEncodingContext
(
mediaCodec
->
mimeType
));
}
void
SimulcastConsumer
::
RequestKeyFrame
()
void
SimulcastConsumer
::
RequestKeyFrame
s
()
{
MS_TRACE
();
...
...
@@ -951,6 +945,40 @@ namespace RTC
}
}
void
SimulcastConsumer
::
RequestKeyFrameForTargetSpatialLayer
()
{
MS_TRACE
();
if
(
this
->
kind
!=
RTC
::
Media
::
Kind
::
VIDEO
)
return
;
auto
*
producerTargetRtpStream
=
GetProducerTargetRtpStream
();
if
(
!
producerTargetRtpStream
)
return
;
auto
mappedSsrc
=
this
->
consumableRtpEncodings
[
this
->
targetSpatialLayer
].
ssrc
;
this
->
listener
->
OnConsumerKeyFrameRequested
(
this
,
mappedSsrc
);
}
void
SimulcastConsumer
::
RequestKeyFrameForCurrentSpatialLayer
()
{
MS_TRACE
();
if
(
this
->
kind
!=
RTC
::
Media
::
Kind
::
VIDEO
)
return
;
auto
*
producerCurrentRtpStream
=
GetProducerCurrentRtpStream
();
if
(
!
producerCurrentRtpStream
)
return
;
auto
mappedSsrc
=
this
->
consumableRtpEncodings
[
this
->
currentSpatialLayer
].
ssrc
;
this
->
listener
->
OnConsumerKeyFrameRequested
(
this
,
mappedSsrc
);
}
void
SimulcastConsumer
::
MayChangeLayers
(
bool
force
)
{
MS_TRACE
();
...
...
@@ -1079,7 +1107,7 @@ namespace RTC
// If the target spatial layer is different than the current one, request
// a key frame.
if
(
this
->
targetSpatialLayer
!=
this
->
currentSpatialLayer
)
RequestKeyFrame
();
RequestKeyFrame
ForTargetSpatialLayer
();
}
void
SimulcastConsumer
::
UpdateCurrentLayers
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论