Bolting on send side simulcast

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.
This commit is contained in:
boks1971
2022-02-22 15:20:27 +05:30
committed by David Zhao
parent e2b8d4c1d7
commit 37e16a3b15
8 changed files with 399 additions and 101 deletions

View File

@@ -1,6 +1,9 @@
package webrtc
import "github.com/pion/rtp"
import (
"github.com/pion/interceptor"
"github.com/pion/rtp"
)
// TrackLocalWriter is the Writer for outbound RTP Packets
type TrackLocalWriter interface {
@@ -14,10 +17,11 @@ type TrackLocalWriter interface {
// TrackLocalContext is the Context passed when a TrackLocal has been Binded/Unbinded from a PeerConnection, and used
// in Interceptors.
type TrackLocalContext struct {
id string
params RTPParameters
ssrc SSRC
writeStream TrackLocalWriter
id string
params RTPParameters
ssrc SSRC
writeStream TrackLocalWriter
rtcpInterceptor interceptor.RTCPReader
}
// CodecParameters returns the negotiated RTPCodecParameters. These are the codecs supported by both
@@ -49,6 +53,11 @@ func (t *TrackLocalContext) ID() string {
return t.id
}
// RTCPReader returns the RTCP interceptor for this TrackLocal. Used to read RTCP of this TrackLocal.
func (t *TrackLocalContext) RTCPReader() interceptor.RTCPReader {
return t.rtcpInterceptor
}
// TrackLocal is an interface that controls how the user can send media
// The user can provide their own TrackLocal implementations, or use
// the implementations in pkg/media