Open stazio opened 3 years ago
I see the issue, I think your idea makes sense. However, I'd like to still allow tracks to run without a handler so forwardMedia
should still independently handle the track dispatching.
The API change will mostly consists in moving setRtcpHandler()
to PeerConnection
, right? If so, please do.
I don't think it's unreasonable to have a default RtcpHandler that is the one that's built in. My biggest complaint is this needlessly complicated double matching parts of a packet thing going on. If you want to be able to support your own non-standard RTCP payload types it's impossible without modifying the library itself.
Sure, what I meant is that I would still want to be able to run without RTCP handler, in case the user handles RTCP themselves.
Ohhh I understand. I totally misread what you said originally.
Hmm, so I need to be able to call RtcpHandler::outgoing
somehow from within the track. If it is owned by PeerConnection
now, how should I get access to it?
I think the easiest way would be to make SrtpTransport
have a weak reference on RtcpHandler
and call RtcpHandler::outgoing()
on send.
So I would struggle quite hard to do this refactor, especially with this new codebase. I really need to add RTX streams so I made stazio:media_distributor to do so. It's using the old codebase so it would need a refactor to work with the new stuff. I don't know if I like it having be done that way -- seems silly to have a track and peer connection handler at the same time.
Hum indeed, I don't really get the point of introducing a new MediaDistributor
(which doesn't actually seem to maintain any particular state), wasn't the original idea about registering the existing RtcpHandler
/MediaHandler
into PeerConnection
?
Yeah,... I need a very quick fix and it seems like a much bigger undertaking than I originally realized.
So I've been noodling on this for a bit and I realized that
RtcpHandler
doesn't really cut it when it comes to processing the state of the whole transport. I don't know much about TWCC, but by the sound of the title "transport-wide", I think this would be a good example of whereRtcpHandler
sort-of fails. Additionally, there's a lot of code duplication on my end because essentially the code that runs inforwardMedia
, runs again in each instance of my implementation ofRtcpHandler
to actually process the packets. I think it would be a good idea to makeRtcpHandler
take the role offorwardMedia
and expose a bunch of functions such asprocessNack
orprocessUnknownPacketType
.The biggest downside of this is that this would be a breaking API change, which is also why I am bringing it up now as it would be better to deal with it now, before too many people start using that.