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
...
@@ -42,7 +42,9 @@ namespace RTC
void
UserOnPaused
()
override
;
void
UserOnPaused
()
override
;
void
UserOnResumed
()
override
;
void
UserOnResumed
()
override
;
void
CreateRtpStream
();
void
CreateRtpStream
();
void
RequestKeyFrame
();
void
RequestKeyFrames
();
void
RequestKeyFrameForTargetSpatialLayer
();
void
RequestKeyFrameForCurrentSpatialLayer
();
void
MayChangeLayers
(
bool
force
=
false
);
void
MayChangeLayers
(
bool
force
=
false
);
bool
RecalculateTargetLayers
(
int16_t
&
newTargetSpatialLayer
,
int16_t
&
newTargetTemporalLayer
)
const
;
bool
RecalculateTargetLayers
(
int16_t
&
newTargetSpatialLayer
,
int16_t
&
newTargetTemporalLayer
)
const
;
void
UpdateTargetLayers
(
int16_t
newTargetSpatialLayer
,
int16_t
newTargetTemporalLayer
);
void
UpdateTargetLayers
(
int16_t
newTargetSpatialLayer
,
int16_t
newTargetTemporalLayer
);
...
...
worker/src/RTC/SimulcastConsumer.cpp
浏览文件 @
f2939643
...
@@ -167,7 +167,7 @@ namespace RTC
...
@@ -167,7 +167,7 @@ namespace RTC
case
Channel
:
:
Request
::
MethodId
::
CONSUMER_REQUEST_KEY_FRAME
:
case
Channel
:
:
Request
::
MethodId
::
CONSUMER_REQUEST_KEY_FRAME
:
{
{
if
(
IsActive
())
if
(
IsActive
())
RequestKeyFrame
();
RequestKeyFrame
s
();
request
->
Accept
();
request
->
Accept
();
...
@@ -276,20 +276,14 @@ namespace RTC
...
@@ -276,20 +276,14 @@ namespace RTC
if
(
rtpStream
==
GetProducerCurrentRtpStream
())
if
(
rtpStream
==
GetProducerCurrentRtpStream
())
EmitScore
();
EmitScore
();
// NOTE: Here it may happen that score is 0 and there is no other Producer stream
if
(
RTC
::
Consumer
::
IsActive
())
// with score > 0, so IsActive() will return false. We can live with that.
if
(
IsActive
())
{
{
// Just check target layers:
// Just check target layers if the stream has died or reborned.
// - if our bitrate is not externally managed, or
//
// - if this is the target spatial layer and it has died or reborned.
// clang-format off
// clang-format off
if
(
if
(
!
this
->
externallyManagedBitrate
||
!
this
->
externallyManagedBitrate
||
(
(
score
==
0
||
previousScore
==
0
)
(
score
==
0
||
previousScore
==
0
)
&&
rtpStream
==
GetProducerTargetRtpStream
()
)
)
)
// clang-format on
// clang-format on
{
{
...
@@ -309,7 +303,7 @@ namespace RTC
...
@@ -309,7 +303,7 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
if
(
!
IsActive
())
if
(
!
RTC
::
Consumer
::
IsActive
())
return
0
;
return
0
;
int16_t
prioritySpatialLayer
{
0
};
int16_t
prioritySpatialLayer
{
0
};
...
@@ -345,7 +339,7 @@ namespace RTC
...
@@ -345,7 +339,7 @@ namespace RTC
MS_ASSERT
(
this
->
externallyManagedBitrate
==
true
,
"bitrate is not externally managed"
);
MS_ASSERT
(
this
->
externallyManagedBitrate
==
true
,
"bitrate is not externally managed"
);
if
(
!
IsActive
())
if
(
!
RTC
::
Consumer
::
IsActive
())
return
0
;
return
0
;
// Calculate virtual available bitrate based on given bitrate and our
// Calculate virtual available bitrate based on given bitrate and our
...
@@ -464,7 +458,7 @@ namespace RTC
...
@@ -464,7 +458,7 @@ namespace RTC
MS_ASSERT
(
this
->
externallyManagedBitrate
==
true
,
"bitrate is not externally managed"
);
MS_ASSERT
(
this
->
externallyManagedBitrate
==
true
,
"bitrate is not externally managed"
);
if
(
!
IsActive
())
if
(
!
RTC
::
Consumer
::
IsActive
())
return
0
;
return
0
;
// If no target spatial layer is selected, do nothing.
// If no target spatial layer is selected, do nothing.
...
@@ -551,7 +545,7 @@ namespace RTC
...
@@ -551,7 +545,7 @@ namespace RTC
MS_ASSERT
(
this
->
externallyManagedBitrate
==
true
,
"bitrate is not externally managed"
);
MS_ASSERT
(
this
->
externallyManagedBitrate
==
true
,
"bitrate is not externally managed"
);
if
(
!
IsActive
())
if
(
!
RTC
::
Consumer
::
IsActive
())
return
;
return
;
// clang-format off
// clang-format off
...
@@ -777,7 +771,7 @@ namespace RTC
...
@@ -777,7 +771,7 @@ namespace RTC
this
->
rtpStream
->
ReceiveKeyFrameRequest
(
messageType
);
this
->
rtpStream
->
ReceiveKeyFrameRequest
(
messageType
);
if
(
IsActive
())
if
(
IsActive
())
RequestKeyFrame
();
RequestKeyFrame
ForCurrentSpatialLayer
();
}
}
void
SimulcastConsumer
::
ReceiveRtcpReceiverReport
(
RTC
::
RTCP
::
ReceiverReport
*
report
)
void
SimulcastConsumer
::
ReceiveRtcpReceiverReport
(
RTC
::
RTCP
::
ReceiverReport
*
report
)
...
@@ -926,7 +920,7 @@ namespace RTC
...
@@ -926,7 +920,7 @@ namespace RTC
this
->
encodingContext
.
reset
(
RTC
::
Codecs
::
GetEncodingContext
(
mediaCodec
->
mimeType
));
this
->
encodingContext
.
reset
(
RTC
::
Codecs
::
GetEncodingContext
(
mediaCodec
->
mimeType
));
}
}
void
SimulcastConsumer
::
RequestKeyFrame
()
void
SimulcastConsumer
::
RequestKeyFrame
s
()
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -951,6 +945,40 @@ namespace RTC
...
@@ -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
)
void
SimulcastConsumer
::
MayChangeLayers
(
bool
force
)
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -1079,7 +1107,7 @@ namespace RTC
...
@@ -1079,7 +1107,7 @@ namespace RTC
// If the target spatial layer is different than the current one, request
// If the target spatial layer is different than the current one, request
// a key frame.
// a key frame.
if
(
this
->
targetSpatialLayer
!=
this
->
currentSpatialLayer
)
if
(
this
->
targetSpatialLayer
!=
this
->
currentSpatialLayer
)
RequestKeyFrame
();
RequestKeyFrame
ForTargetSpatialLayer
();
}
}
void
SimulcastConsumer
::
UpdateCurrentLayers
()
void
SimulcastConsumer
::
UpdateCurrentLayers
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论