-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Set RTP extensions on sending transport side #1107
Comments
|
Well, we have to encrypt payload before sending, and currently libsrtp don't support read header and payload from different buffer. |
We can also do this when sending rtx packet. |
@penguinol I will come to this a few weeks later after some priority work and after vacations. Same for other pending PRs written by you. |
In webrtc, they use a |
I'm very interested on this. Regarding "these extensions must be reseted" maybe it is a good time to reconsider the approach taken in mediasoup of modifying and reverting the convent of the packets. My reasoning:
|
This also happens within each Are you proposing that when the |
Exactly that. Basically doing the memcpy at the beginning instead of at the end (SrtpSession::EncryptRtp). Or the Consumer can clone it the first time it needs to modify it, that's almost the same thing but more optimal for the SimulcastConsumer case where many packets are discarded. |
Right now we store in memory each RtpPacket coming from the remote Producer, and use that same memory for all Consumers. If we did as it's being suggested here we would store in memory the same-ish RtpPacket number-of-consumers times. |
Yes, but it would also simplify our life a lot. What about if each |
Don't we do the same before encryption? It is just doing the same thing but a bit earlier in the consumer path imo. |
RtpPacket::Clone() already creates an internal a buffer to hold the content so there is no need for any other buffer. If each Consumer clones each RtpPacket then its own buffer can be used for SRTP encryption as it would not be reused.
The difference is that we now use the same buffer (per thread) to encrypt every packet, so we do a memcpy before encrypting. In essence we would loose the memory savings we have now by sharing the original RtpPacket received from the Producer and would have one clone of the RtpPacket for each Consumer, that would need to remain in memory for retransmission purposes. I don't think this is a blocker for the main issue described here. |
Indeed, the proposed solution in the description of this story avoid cloning each packet in every Consumer. Of course it requires some shift and memcopy operations in the packet within every Consumer, but that's way better than having to clone the whole packet per Consumer, right? The proposal in this story covers all our needs IMHO. And as Jose said, it doesn't make sense that we developed an optimized way to just store a packet ONCE (for retransmission purposes) and now clone the packet for each Consumer. It's indeed a non sense. |
Agree, I'm just suggesting that you take advantage of this feature to change that mediasoup behaviour if you think it makes sense. |
Isn't that an implementation detail? Cloning a packet could take an existing buffer from a pool. Also when I said "cloning the packet" I didn't mean it needs to be the existing RtpPacket::Clone(), maybe there is a more efficient way to do it. I meant just "making a copy" somehow. For retransmission purposes you can still store the original packet, right?
I agree. I just think that the solution to this kind of requirements could be much simpler by not having to reset anything, without any/much perf impact, but it is your call obviously :) |
Cloning a RtpPacket means creating a different RtpPacket instance with copied memory. That's what clone() does and there is no way to make it more efficient. It does exactly what it must be done.
Yes, but we just store the original packet received by the Producer and we store it just once.
"much simpler" means cloning the packet, with the performance penalty it involves. Resetting changes in the packet after processing it in each Consumer is the best option we have assuming it is done right. |
Related to #1079.
Overview
We are gonna save lot of bandwidth by just adding into each RTP packet RTP extensions supported by the receiver, and we are gonna make the MID RTP extension has dynamic value instead of being always 8 bytes (value + required zeroed padding).
Current Approach in v3
Currently we set all the RTP extensions in
Producer::MangleRtpPacket()
and later we rewrite their values when sending the RTP packet to each consumer. This comes with pros and cons:Pros:
Producer.cpp
.Const:
New Proposal
packet->SetExtensions()
inProducer::MangleRtpPacket()
.packet->SetExtensions()
it in the sendingTransport
with a customized vector of RTP extensions (those supported by the receiver).Transport
MUST NOT override the set of extensions in those probation packets, but must only rewrite them (absSendTime
,transportWideCc01
, etc).Pros:
Const:
The text was updated successfully, but these errors were encountered: