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