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

Fix profile bugs

上级 454b41da
......@@ -231,7 +231,7 @@ namespace RTC
profile != RTC::RtpEncodingParameters::Profile::DEFAULT,
"invalid profile");
MS_ASSERT(this->profiles.find(profile) != this->profiles.end(), "profile already exists");
MS_ASSERT(this->profiles.find(profile) == this->profiles.end(), "profile already exists");
// Insert profile.
this->profiles.insert(profile);
......@@ -250,7 +250,7 @@ namespace RTC
profile != RTC::RtpEncodingParameters::Profile::DEFAULT,
"invalid profile");
MS_ASSERT(this->profiles.find(profile) == this->profiles.end(), "profile not found");
MS_ASSERT(this->profiles.find(profile) != this->profiles.end(), "profile not found");
// Remove profile.
this->profiles.erase(profile);
......
......@@ -152,6 +152,24 @@ namespace RTC
this->rtpParameters = rtpParameters;
// Notify about all profiles being disabled.
for (auto& kv : this->profiles)
{
auto& profiles = kv.second;
for (auto profile : profiles)
{
// Don't announce default profile, but just those for simulcast/SVC.
if (profile == RTC::RtpEncodingParameters::Profile::DEFAULT)
break;
for (auto& listener : this->listeners)
{
listener->OnProducerProfileDisabled(this, profile);
}
}
}
// Clear previous RtpStreamRecv instances.
ClearRtpStreams();
......
......@@ -5,6 +5,7 @@
#include "MediaSoupError.hpp"
#include "RTC/RtpDictionaries.hpp"
#include <unordered_set>
#include <set>
namespace RTC
{
......@@ -297,5 +298,17 @@ namespace RTC
MS_THROW_ERROR("unknown encoding.codecPayloadType");
}
}
// Iterate all the encodings and ensure that profile is not repeated.
std::set<RTC::RtpEncodingParameters::Profile> profiles;
for (auto& encoding : this->encodings)
{
auto profile = encoding.profile;
auto pair = profiles.insert(profile);
if (!pair.second)
MS_THROW_ERROR("duplicated encoding.profile");
}
}
} // namespace RTC
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论