提交 187670b2 authored 作者: José Luis Millán's avatar José Luis Millán

Fix #168. Improve target profile selection in Consumer

上级 bca1a269
...@@ -986,18 +986,23 @@ namespace RTC ...@@ -986,18 +986,23 @@ namespace RTC
// Try with the closest profile to the preferred one. // Try with the closest profile to the preferred one.
else else
{ {
auto it = this->mapProfileRtpStream.crbegin(); auto it = this->mapProfileRtpStream.lower_bound(this->preferredProfile);
newTargetProfile = it->first;
for (; it != this->mapProfileRtpStream.crend(); ++it) // Preferred profile is actually present.
if (it->first == this->preferredProfile)
{ {
auto profile = it->first; newTargetProfile = it->first;
}
if (profile <= GetPreferredProfile()) // The lowest profile is already higher than the preferred. Use it.
else if (it == this->mapProfileRtpStream.begin())
{ {
newTargetProfile = profile; newTargetProfile = it->first;
break;
} }
// There is a lower profile available. Prefer it over any higher one.
else
{
newTargetProfile = (--it)->first;
} }
} }
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论