Skip to content

Commit

Permalink
fix mosaics when swithcing layers
Browse files Browse the repository at this point in the history
  • Loading branch information
penguinol committed May 27, 2020
1 parent 87039fd commit de2ed3f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion worker/include/RTC/SeqManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace RTC
SeqManager() = default;

public:
void Sync(T input);
void Sync(T input, bool skip = false);
void Drop(T input);
void Offset(T offset);
bool Input(const T input, T& output);
Expand Down
1 change: 1 addition & 0 deletions worker/include/RTC/SimulcastConsumer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ namespace RTC
std::vector<RTC::RtpStreamSend*> rtpStreams;
std::vector<RTC::RtpStream*> producerRtpStreams; // Indexed by spatial layer.
bool syncRequired{ false };
bool lastSentPacketHasMarker{ false };
RTC::SeqManager<uint16_t> rtpSeqManager;
int16_t preferredSpatialLayer{ -1 };
int16_t preferredTemporalLayer{ -1 };
Expand Down
5 changes: 4 additions & 1 deletion worker/src/RTC/SeqManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@ namespace RTC
}

template<typename T>
void SeqManager<T>::Sync(T input)
void SeqManager<T>::Sync(T input, bool skip)
{
// Update base.
this->base = this->maxOutput - input;

if (skip)
this->base += 1;

// Update maxInput.
this->maxInput = input;

Expand Down
4 changes: 3 additions & 1 deletion worker/src/RTC/SimulcastConsumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ namespace RTC
this->tsOffset = tsOffset;

// Sync our RTP stream's sequence number.
this->rtpSeqManager.Sync(packet->GetSequenceNumber() - 1);
this->rtpSeqManager.Sync(packet->GetSequenceNumber() - 1, !this->lastSentPacketHasMarker);

this->encodingContext->SyncRequired();

Expand Down Expand Up @@ -869,6 +869,8 @@ namespace RTC
// Process the packet.
if (this->rtpStream->ReceivePacket(packet))
{
this->lastSentPacketHasMarker = packet->HasMarker();

// Send the packet.
this->listener->OnConsumerSendRtpPacket(this, packet);

Expand Down

0 comments on commit de2ed3f

Please sign in to comment.