-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
The current interface uses the channels RTCTrack.Samples chan<- media.RTCSample
and RTCTrack.RawRTP chan<- *rtp.Packet
to send data over the connection.
If the connection is closed, these channels are closed. Sending to a closed channel will cause the code to panic. I've also seen a lot of packet drops because the buffered channel (size 15) is not large enough to handle surges.
I would love to change the API such that you call WriteSample
or WritePacket
instead of interfacing with channels. I also don't think this should be part of the RTPTrack
, but instead the RTCRtpSender
returned by AddTrack
.
This should also be a blocking call which would remove a goroutine and some context switching. It would go a long way for my project which creates thousands of peer connections.