Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NACK responder always responding with most recent packet #84

Closed
davidzhao opened this issue Dec 14, 2021 · 3 comments · Fixed by #92
Closed

NACK responder always responding with most recent packet #84

davidzhao opened this issue Dec 14, 2021 · 3 comments · Fixed by #92

Comments

@davidzhao
Copy link
Member

In the NACK responder, it tries to cache sent packets in order to respond to NACKs. However, it's storing a pointer to the rtp.Packet struct, which may be re-used by the sender process without the knowledge of NackResponder.

Adam from the community has observed symptoms where retransmitted packets contained payload that did not match the sequence number that was requested. (but a later sequence number that overrode the earlier one).

We need to be storing a copy of the packet to ensure that nack responder has full ownership over its data.

@Sean-Der
Copy link
Member

👍 We can also add an option to the interceptor to DisableCopy maybe? If people really need the old behavior.

@davidzhao
Copy link
Member Author

Do you think people actually want the old behavior? Since it's not actually doing what it's claiming to do. Any network with reasonable latency will probably see NACKs responding to wrong packets.

I do think it'd be great to avoid the copy though.

@mengelbart
Copy link
Contributor

I agree that it would be nice to avoid the copy, but on the other hand, I think it is the best we can do. Since RTPWriter, RTPReader, RTCPWriter and RTCPReader are very similar to io.Reader/io.Writer, I would expect them to behave in the same way. The doc for io.Reader and io.Writer says that implementations must not retain the buffer and I think that makes sense for interceptors, too. It could actually be even worse when users use the payload buffer for something else than the next packet. In that case, the interceptors would not only send the most recent packet but whatever the user decided to store in the buffer next.

The same goes for rtp.Header (#85 is an issue where the extension header of an rtp.Header, which is a byte slice, is overwritten by newer packets) and possibly also interceptor.Attributes?

Maybe we should also carefully check the other interceptors for similar issues.

davidzhao added a commit that referenced this issue Jan 6, 2022
Keeps a copy of packet in responder_interceptor, fixes #84
pionbot pushed a commit that referenced this issue Jan 6, 2022
Keeps a copy of packet in responder_interceptor, fixes #84
davidzhao added a commit that referenced this issue Jan 6, 2022
Keeps a copy of packet in responder_interceptor, fixes #84
pionbot pushed a commit that referenced this issue Jan 6, 2022
Keeps a copy of packet in responder_interceptor, fixes #84
davidzhao added a commit that referenced this issue Jan 6, 2022
Keeps a copy of packet in responder_interceptor, fixes #84
pionbot pushed a commit that referenced this issue Jan 6, 2022
Keeps a copy of packet in responder_interceptor, fixes #84
davidzhao added a commit that referenced this issue Jan 6, 2022
Keeps a copy of packet in responder_interceptor, fixes #84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants