From 09ce8b370705a1ce2412401e01cae977cc3f0e47 Mon Sep 17 00:00:00 2001 From: Aleksandr Alekseev Date: Thu, 18 Apr 2024 20:36:32 +0300 Subject: [PATCH] Fix receiveForRtx usage for simulcast --- rtpreceiver.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/rtpreceiver.go b/rtpreceiver.go index 2457ba080a8..ea8848d5841 100644 --- a/rtpreceiver.go +++ b/rtpreceiver.go @@ -433,6 +433,19 @@ func (r *RTPReceiver) receiveForRtx(ssrc SSRC, rsid string, streamInfo *intercep track.repairRtcpInterceptor = rtcpInterceptor track.repairStreamChannel = make(chan rtxPacketWithAttributes) + // If this function is called to read simulcast layer, do not apply rtx logic + if ssrc == 0 { + go func() { + b := make([]byte, r.api.settingEngine.getReceiveMTU()) + for { + if _, _, readErr := track.repairInterceptor.Read(b, nil); readErr != nil { + return + } + } + }() + return nil + } + go func() { for { b := r.rtxPool.Get().([]byte) // nolint:forcetypeassert