Unverified 提交 e2160d53 authored 作者: Dmitry Dolzhenko's avatar Dmitry Dolzhenko 提交者: GitHub

Fix a race condition in SimulcastConsumer #824 (#825)

上级 833f36ee
......@@ -102,6 +102,7 @@ namespace RTC
std::vector<RTC::RtpStreamSend*> rtpStreams;
std::vector<RTC::RtpStream*> producerRtpStreams; // Indexed by spatial layer.
bool syncRequired{ false };
int16_t spatialLayerToSync{ -1 };
bool lastSentPacketHasMarker{ false };
RTC::SeqManager<uint16_t> rtpSeqManager;
int16_t preferredSpatialLayer{ -1 };
......
......@@ -674,7 +674,8 @@ namespace RTC
shouldSwitchCurrentSpatialLayer = true;
// Need to resync the stream.
this->syncRequired = true;
this->syncRequired = true;
this->spatialLayerToSync = spatialLayer;
}
// If the packet belongs to different spatial layer than the one being sent,
// drop it.
......@@ -691,7 +692,7 @@ namespace RTC
bool isSyncPacket = this->syncRequired;
// Sync sequence number and timestamp if required.
if (isSyncPacket)
if (isSyncPacket && (this->spatialLayerToSync == -1 || this->spatialLayerToSync == spatialLayer))
{
if (packet->IsKeyFrame())
MS_DEBUG_TAG(rtp, "sync key frame received");
......@@ -818,6 +819,7 @@ namespace RTC
this->encodingContext->SyncRequired();
this->syncRequired = false;
this->spatialLayerToSync = -1;
this->keyFrameForTsOffsetRequested = false;
}
......@@ -1054,6 +1056,7 @@ namespace RTC
MS_TRACE();
this->syncRequired = true;
this->spatialLayerToSync = -1;
this->keyFrameForTsOffsetRequested = false;
if (IsActive())
......@@ -1090,6 +1093,7 @@ namespace RTC
MS_TRACE();
this->syncRequired = true;
this->spatialLayerToSync = -1;
this->keyFrameForTsOffsetRequested = false;
if (IsActive())
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论