Skip to content

Commit e28738f

Browse files
committed
Fix #160. Reset 'targetProfile' when the corresponding profile is removed
1 parent 97882cf commit e28738f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

worker/src/RTC/Consumer.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,18 @@ namespace RTC
319319
"profile removed [profile:%s]",
320320
RTC::RtpEncodingParameters::profile2String[profile].c_str());
321321

322+
// No profiles available.
322323
if (this->mapProfileRtpStream.empty())
323324
{
324325
SetEffectiveProfile(RtpEncodingParameters::Profile::NONE);
325326
RecalculateTargetProfile();
326327
}
327-
// If there is an ongoing probation for this profile, disable it.
328+
// Target profile removed. Recalculate.
329+
else if (this->targetProfile == profile)
330+
{
331+
RecalculateTargetProfile();
332+
}
333+
// There is an ongoing probation for this profile, disable it.
328334
else if (this->isProbing && this->probingProfile == profile)
329335
{
330336
// Disable probation flag.
@@ -337,8 +343,8 @@ namespace RTC
337343

338344
return;
339345
}
340-
// If it is the effective profile, try to downgrade, or upgrade it to the next higher profile if
341-
// the removed profile was lower than other existing ones.
346+
// Effective profile removed. Try to downgrade.
347+
// If there is no profile lower than the removed one then upgrade to the next higher profile.
342348
else if (this->effectiveProfile == profile)
343349
{
344350
SetEffectiveProfile(RtpEncodingParameters::Profile::NONE);

0 commit comments

Comments
 (0)