Introduces AddEncoding method in RTP sender to add simulcast encodings.
Added UTs for AddEncoding.
Also modified the Simulcast send test to use the new API.
In RtpSender, if Read has been called and wait for srtpReady,
then if we call Close() immediately after
rtpSender.trasport.srtpReady, that means srtpWriterFuture's Close
may be called when it's init method is executing.
In Read -> init, goroutine may run at:
rtpWriteStream, err := srtpSession.OpenWriteStream()
if err != nil {
return err
}
s.rtcpReadStream.Store(rtcpReadStream)
s.rtpWriteStream.Store(rtpWriteStream)
In Close, goroutine may run at
if value := s.rtcpReadStream.Load(); value != nil {
return value.(*srtp.ReadStreamSRTCP).Close()
}
return nil
s.rtcpReadStream could be nil in the check at Close, so it
will not be closed.
And in Read method, the init method initiates the stream and
return. Then read at the stream's buffer, and blocked infinite
because the buffer is not closed. And it will not be closed
if you call RtpSender's close method because it is already
closed.
ReadDeadline is supported by RTPReceiver but not RTPSender. This
commit attempts to provide similar method for RTPSender.
If SetReadDeadine is called with:
- an empty time.Time: it will clear all previous set deadline.
- a non-empty time.Time: it will abort all pending "ReadRTCP" calls if
the specified time is up.
A Track shouldn't block until a PeerConnection is connected. It should
only send to PeerConnections that are fully established. v3 Track API
changed this behavior by mistake.
Related to pion/transport#116
* Return error to user when remote doesn't support codecs
* Assert that bindings are properly incremented/decremented
* Assert that a added track doesn't error even when disconnected
Relates to #1526