NACK Generator logic

Hi guys! You have this class https://github.com/versatica/mediasoup/blob/v3/worker/src/RTC/NackGenerator.cpp, It is not obvious, when mediasoup receives an RTX for such a NACK request, how it results in consumer?

  1. You are storing such packets in RTX buffer and wait if someone will request NACK for it.
  2. You are forwarding those packets as a regular stream.

Hi Eugene!

mediasoup independently handles received RTX and sent RTX. If a RTX packet is received, the Producer side in mediasoup checks whether it’s really a lost packet and, if so, RTX decodes it and forwards it to the Router who will forward it to all its Consumers.

1 Like

Hi Iñaki! Thanks! Let me rephrase so you can confirm that I understood you correctly. When mediasoup send NACK via NACK Generator, RTX packets that mediasoup requested are received on RTX ssrc turns into regular packets downstream on the road to consumers, and consumers will receive them over a regular ssrc, but when consumer requests NACK packets they are transmitted over the RTX ssrc of consumer, right? If I understood correctly this implies that when consumer sends NACK, it can only receive packet from mediasoup RTX buffer, and such NACK never forwarded to producer?

1 Like

Yes to everything plus RTX is only used if negotiated when creating the consumer (usually it is).

2 Likes

Thanks a lot for your time!