Skip to content

Commit 6508861

Browse files
committed
#196. Fix crash in Consumer::getStats()
Scenario: `Consumer::RemoveProfile()` is called with the profile pointed by `targetProfile`. The corresponding entry is erased from `mapProfileRtpStream` container. `targetProfile` is not being cleared, and here resides the bug. Few RTP packets later a packet with the profile pointed by `targetProfile` comes in `SendRtpPacket()`. We were waiting for it, so we make such profile the `effectiveProfile`. At this point `effectiveProfile` points to a profile which is not present in `mapProfileRtpStream` and this crash will happen on the next call to `GetStats()`.
1 parent d0e7aa0 commit 6508861

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

worker/src/RTC/Consumer.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,10 @@ namespace RTC
334334
{
335335
SetEffectiveProfile(RtpEncodingParameters::Profile::NONE);
336336
}
337+
else if (this->targetProfile == profile)
338+
{
339+
this->targetProfile = this->effectiveProfile;
340+
}
337341

338342
RecalculateTargetProfile();
339343
}

0 commit comments

Comments
 (0)