提交 b5692d1b authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Consumer: set effectiveProfile to none if it matches a removed one.

上级 a3963a8c
...@@ -253,6 +253,10 @@ namespace RTC ...@@ -253,6 +253,10 @@ namespace RTC
// Remove profile. // Remove profile.
this->profiles.erase(profile); this->profiles.erase(profile);
// If it was our effective profile, set it to none.
if (this->effectiveProfile == profile)
SetEffectiveProfile(RtpEncodingParameters::Profile::NONE);
MS_DEBUG_TAG( MS_DEBUG_TAG(
rtp, rtp,
"profile removed [profile:%s]", "profile removed [profile:%s]",
...@@ -662,31 +666,34 @@ namespace RTC ...@@ -662,31 +666,34 @@ namespace RTC
{ {
MS_TRACE(); MS_TRACE();
RTC::RtpEncodingParameters::Profile newProfile; RTC::RtpEncodingParameters::Profile newEffectiveProfile;
// 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->profiles.empty())
{ {
if (this->effectiveProfile != RtpEncodingParameters::Profile::DEFAULT) MS_ASSERT(
newProfile = RtpEncodingParameters::Profile::NONE; this->effectiveProfile == RtpEncodingParameters::Profile::NONE ||
else this->effectiveProfile == RtpEncodingParameters::Profile::DEFAULT,
newProfile = RtpEncodingParameters::Profile::DEFAULT; "no profiles, but effective profile is not none nor default");
SetEffectiveProfile(RtpEncodingParameters::Profile::NONE); if (this->effectiveProfile == RtpEncodingParameters::Profile::NONE)
newEffectiveProfile = RtpEncodingParameters::Profile::NONE;
else
newEffectiveProfile = RtpEncodingParameters::Profile::DEFAULT;
} }
// If there is no preferred profile, take the best one available. // If there is no preferred profile, take the best one available.
else if (this->preferredProfile == RTC::RtpEncodingParameters::Profile::DEFAULT) else if (this->preferredProfile == RTC::RtpEncodingParameters::Profile::DEFAULT)
{ {
auto it = this->profiles.crbegin(); auto it = this->profiles.crbegin();
newProfile = *it; newEffectiveProfile = *it;
} }
// Otherwise take the highest available profile equal or lower than the preferred. // Otherwise take the highest available profile equal or lower than the preferred.
else else
{ {
std::set<RtpEncodingParameters::Profile>::reverse_iterator it; std::set<RtpEncodingParameters::Profile>::reverse_iterator it;
newProfile = RtpEncodingParameters::Profile::NONE; newEffectiveProfile = RtpEncodingParameters::Profile::NONE;
for (it = this->profiles.rbegin(); it != this->profiles.rend(); ++it) for (it = this->profiles.rbegin(); it != this->profiles.rend(); ++it)
{ {
...@@ -694,13 +701,13 @@ namespace RTC ...@@ -694,13 +701,13 @@ namespace RTC
if (profile <= this->preferredProfile) if (profile <= this->preferredProfile)
{ {
newProfile = *it; newEffectiveProfile = *it;
break; break;
} }
} }
} }
this->targetProfile = newProfile; this->targetProfile = newEffectiveProfile;
if (this->targetProfile == this->effectiveProfile) if (this->targetProfile == this->effectiveProfile)
return; return;
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论