Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
d751c208
提交
d751c208
authored
11月 13, 2017
作者:
José Luis Millán
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Consumer: Remove redundant profile container
上级
9fb392b0
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
24 行增加
和
27 行删除
+24
-27
Consumer.hpp
worker/include/RTC/Consumer.hpp
+0
-1
Consumer.cpp
worker/src/RTC/Consumer.cpp
+24
-26
没有找到文件。
worker/include/RTC/Consumer.hpp
浏览文件 @
d751c208
...
@@ -107,7 +107,6 @@ namespace RTC
...
@@ -107,7 +107,6 @@ namespace RTC
// RTP payload descriptor encoding.
// RTP payload descriptor encoding.
std
::
unique_ptr
<
RTC
::
Codecs
::
EncodingContext
>
encodingContext
;
std
::
unique_ptr
<
RTC
::
Codecs
::
EncodingContext
>
encodingContext
;
// RTP profiles.
// RTP profiles.
std
::
set
<
RTC
::
RtpEncodingParameters
::
Profile
>
profiles
;
std
::
map
<
RTC
::
RtpEncodingParameters
::
Profile
,
const
RTC
::
RtpStream
*>
mapProfileRtpStream
;
std
::
map
<
RTC
::
RtpEncodingParameters
::
Profile
,
const
RTC
::
RtpStream
*>
mapProfileRtpStream
;
RTC
::
RtpEncodingParameters
::
Profile
preferredProfile
{
RTC
::
RtpEncodingParameters
::
Profile
::
DEFAULT
};
RTC
::
RtpEncodingParameters
::
Profile
preferredProfile
{
RTC
::
RtpEncodingParameters
::
Profile
::
DEFAULT
};
RTC
::
RtpEncodingParameters
::
Profile
sourcePreferredProfile
{
RTC
::
RtpEncodingParameters
::
Profile
sourcePreferredProfile
{
...
...
worker/src/RTC/Consumer.cpp
浏览文件 @
d751c208
...
@@ -280,15 +280,14 @@ namespace RTC
...
@@ -280,15 +280,14 @@ namespace RTC
{
{
MS_ASSERT
(
profile
!=
RTC
::
RtpEncodingParameters
::
Profile
::
NONE
,
"invalid profile"
);
MS_ASSERT
(
profile
!=
RTC
::
RtpEncodingParameters
::
Profile
::
NONE
,
"invalid profile"
);
MS_ASSERT
(
this
->
profiles
.
find
(
profile
)
==
this
->
profiles
.
end
(),
"profile already exists"
);
MS_ASSERT
(
this
->
mapProfileRtpStream
.
find
(
profile
)
==
this
->
mapProfileRtpStream
.
end
(),
"profile already exists"
);
MS_ASSERT
(
MS_ASSERT
(
!
(
profile
==
RTC
::
RtpEncodingParameters
::
Profile
::
DEFAULT
&&
!
this
->
profiles
.
empty
()),
!
(
profile
==
RTC
::
RtpEncodingParameters
::
Profile
::
DEFAULT
&&
!
this
->
mapProfileRtpStream
.
empty
()),
"default profile cannot coexist with others"
);
"default profile cannot coexist with others"
);
// Insert the new profile.
// Insert the new profile.
this
->
mapProfileRtpStream
[
profile
]
=
rtpStream
;
this
->
mapProfileRtpStream
[
profile
]
=
rtpStream
;
this
->
profiles
.
insert
(
profile
);
MS_DEBUG_TAG
(
MS_DEBUG_TAG
(
rtp
,
"profile added [profile:%s]"
,
RTC
::
RtpEncodingParameters
::
profile2String
[
profile
].
c_str
());
rtp
,
"profile added [profile:%s]"
,
RTC
::
RtpEncodingParameters
::
profile2String
[
profile
].
c_str
());
...
@@ -301,22 +300,21 @@ namespace RTC
...
@@ -301,22 +300,21 @@ namespace RTC
{
{
MS_ASSERT
(
profile
!=
RTC
::
RtpEncodingParameters
::
Profile
::
NONE
,
"invalid profile"
);
MS_ASSERT
(
profile
!=
RTC
::
RtpEncodingParameters
::
Profile
::
NONE
,
"invalid profile"
);
MS_ASSERT
(
this
->
profiles
.
find
(
profile
)
!=
this
->
profiles
.
end
(),
"profile not found"
);
MS_ASSERT
(
this
->
mapProfileRtpStream
.
find
(
profile
)
!=
this
->
mapProfileRtpStream
.
end
(),
"profile not found"
);
MS_ASSERT
(
MS_ASSERT
(
!
(
profile
==
RTC
::
RtpEncodingParameters
::
Profile
::
DEFAULT
&&
this
->
profiles
.
size
()
!=
1
),
!
(
profile
==
RTC
::
RtpEncodingParameters
::
Profile
::
DEFAULT
&&
this
->
mapProfileRtpStream
.
size
()
!=
1
),
"default profile cannot coexist with others"
);
"default profile cannot coexist with others"
);
// Remove the profile.
// Remove the profile.
this
->
mapProfileRtpStream
.
erase
(
profile
);
this
->
mapProfileRtpStream
.
erase
(
profile
);
this
->
profiles
.
erase
(
profile
);
MS_DEBUG_TAG
(
MS_DEBUG_TAG
(
rtp
,
rtp
,
"profile removed [profile:%s]"
,
"profile removed [profile:%s]"
,
RTC
::
RtpEncodingParameters
::
profile2String
[
profile
].
c_str
());
RTC
::
RtpEncodingParameters
::
profile2String
[
profile
].
c_str
());
if
(
this
->
profiles
.
empty
())
if
(
this
->
mapProfileRtpStream
.
empty
())
{
{
SetEffectiveProfile
(
RtpEncodingParameters
::
Profile
::
NONE
);
SetEffectiveProfile
(
RtpEncodingParameters
::
Profile
::
NONE
);
RecalculateTargetProfile
();
RecalculateTargetProfile
();
...
@@ -340,12 +338,12 @@ namespace RTC
...
@@ -340,12 +338,12 @@ namespace RTC
{
{
SetEffectiveProfile
(
RtpEncodingParameters
::
Profile
::
NONE
);
SetEffectiveProfile
(
RtpEncodingParameters
::
Profile
::
NONE
);
auto
it
=
this
->
profiles
.
begin
();
auto
it
=
this
->
mapProfileRtpStream
.
begin
();
auto
newTargetProfile
=
*
i
t
;
auto
newTargetProfile
=
it
->
firs
t
;
while
(
++
it
!=
this
->
profiles
.
end
())
while
(
++
it
!=
this
->
mapProfileRtpStream
.
end
())
{
{
auto
candidateTargetProfile
=
*
i
t
;
auto
candidateTargetProfile
=
it
->
firs
t
;
if
(
candidateTargetProfile
<
profile
)
if
(
candidateTargetProfile
<
profile
)
newTargetProfile
=
candidateTargetProfile
;
newTargetProfile
=
candidateTargetProfile
;
...
@@ -818,14 +816,14 @@ namespace RTC
...
@@ -818,14 +816,14 @@ namespace RTC
if
(
this
->
effectiveProfile
==
RtpEncodingParameters
::
Profile
::
DEFAULT
)
if
(
this
->
effectiveProfile
==
RtpEncodingParameters
::
Profile
::
DEFAULT
)
return
;
return
;
auto
it
=
this
->
profiles
.
find
(
this
->
effectiveProfile
);
auto
it
=
this
->
mapProfileRtpStream
.
find
(
this
->
effectiveProfile
);
// This is already the lowest profile.
// This is already the lowest profile.
if
(
it
==
this
->
profiles
.
begin
())
if
(
it
==
this
->
mapProfileRtpStream
.
begin
())
return
;
return
;
// Downgrade the target profile.
// Downgrade the target profile.
this
->
targetProfile
=
*
(
std
::
prev
(
it
))
;
this
->
targetProfile
=
(
std
::
prev
(
it
))
->
first
;
if
(
IsEnabled
()
&&
!
IsPaused
())
if
(
IsEnabled
()
&&
!
IsPaused
())
RequestKeyFrame
();
RequestKeyFrame
();
...
@@ -843,7 +841,7 @@ namespace RTC
...
@@ -843,7 +841,7 @@ namespace RTC
void
Consumer
::
MayRunProbation
()
void
Consumer
::
MayRunProbation
()
{
{
// No simulcast or SVC.
// No simulcast or SVC.
if
(
this
->
profiles
.
empty
())
if
(
this
->
mapProfileRtpStream
.
empty
())
return
;
return
;
// There is an ongoing profile upgrade. Do not interfere.
// There is an ongoing profile upgrade. Do not interfere.
...
@@ -972,7 +970,7 @@ namespace RTC
...
@@ -972,7 +970,7 @@ namespace RTC
// If there are no profiles, select none or default, depending on whether this
// If there are no profiles, select none or default, depending on whether this
// is single stream or simulcast/SVC.
// is single stream or simulcast/SVC.
if
(
this
->
profiles
.
empty
())
if
(
this
->
mapProfileRtpStream
.
empty
())
{
{
MS_ASSERT
(
MS_ASSERT
(
this
->
effectiveProfile
==
RtpEncodingParameters
::
Profile
::
NONE
||
this
->
effectiveProfile
==
RtpEncodingParameters
::
Profile
::
NONE
||
...
@@ -988,20 +986,20 @@ namespace RTC
...
@@ -988,20 +986,20 @@ namespace RTC
else
if
(
GetPreferredProfile
()
==
RTC
::
RtpEncodingParameters
::
Profile
::
DEFAULT
)
else
if
(
GetPreferredProfile
()
==
RTC
::
RtpEncodingParameters
::
Profile
::
DEFAULT
)
{
{
newTargetProfile
=
this
->
effectiveProfile
;
newTargetProfile
=
this
->
effectiveProfile
;
auto
it
=
this
->
profiles
.
upper_bound
(
this
->
effectiveProfile
);
auto
it
=
this
->
mapProfileRtpStream
.
upper_bound
(
this
->
effectiveProfile
);
if
(
it
!=
this
->
profiles
.
end
())
if
(
it
!=
this
->
mapProfileRtpStream
.
end
())
newTargetProfile
=
*
i
t
;
newTargetProfile
=
it
->
firs
t
;
}
}
// If the preferred profile is forced, try with the closest profile to it.
// If the preferred profile is forced, try with the closest profile to it.
else
if
(
forcePreferred
)
else
if
(
forcePreferred
)
{
{
auto
it
=
this
->
profiles
.
crbegin
();
auto
it
=
this
->
mapProfileRtpStream
.
crbegin
();
newTargetProfile
=
*
i
t
;
newTargetProfile
=
it
->
firs
t
;
for
(;
it
!=
this
->
profiles
.
crend
();
++
it
)
for
(;
it
!=
this
->
mapProfileRtpStream
.
crend
();
++
it
)
{
{
auto
profile
=
*
i
t
;
auto
profile
=
it
->
firs
t
;
if
(
profile
<=
GetPreferredProfile
())
if
(
profile
<=
GetPreferredProfile
())
{
{
...
@@ -1014,10 +1012,10 @@ namespace RTC
...
@@ -1014,10 +1012,10 @@ namespace RTC
else
else
{
{
newTargetProfile
=
this
->
effectiveProfile
;
newTargetProfile
=
this
->
effectiveProfile
;
auto
it
=
this
->
profiles
.
upper_bound
(
this
->
effectiveProfile
);
auto
it
=
this
->
mapProfileRtpStream
.
upper_bound
(
this
->
effectiveProfile
);
if
(
it
!=
this
->
profiles
.
end
()
&&
*
i
t
<=
GetPreferredProfile
())
if
(
it
!=
this
->
mapProfileRtpStream
.
end
()
&&
it
->
firs
t
<=
GetPreferredProfile
())
newTargetProfile
=
*
i
t
;
newTargetProfile
=
it
->
firs
t
;
}
}
// Not enabled. Make this the target profile.
// Not enabled. Make this the target profile.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论