New Track API

The Pion WebRTC API has been dramatically redesigned. The design docs
are located here [0]

You can also read the release notes [1] on how to migrate your
application.

[0] https://github.com/pion/webrtc-v3-design
[1] https://github.com/pion/webrtc/wiki/Release-WebRTC@v3.0.0
This commit is contained in:
Sean DuBois
2020-11-11 12:03:08 -08:00
parent 159ba5aca3
commit 7edfb701e0
46 changed files with 1750 additions and 2059 deletions

View File

@@ -7,7 +7,6 @@ import (
"github.com/pion/ice/v2"
"github.com/pion/logging"
"github.com/pion/sdp/v3"
"github.com/pion/transport/vnet"
"golang.org/x/net/proxy"
)
@@ -49,7 +48,6 @@ type SettingEngine struct {
SRTCP *uint
}
sdpMediaLevelFingerprints bool
sdpExtensions map[SDPSectionType][]sdp.ExtMap
answeringDTLSRole DTLSRole
disableCertificateFingerprintVerification bool
disableSRTPReplayProtection bool
@@ -250,68 +248,6 @@ func (e *SettingEngine) SetICETCPMux(tcpMux ice.TCPMux) {
e.iceTCPMux = tcpMux
}
// AddSDPExtensions adds available and offered extensions for media type.
//
// Ext IDs are optional and generated if you do not provide them
// SDP answers will only include extensions supported by both sides
func (e *SettingEngine) AddSDPExtensions(mediaType SDPSectionType, exts []sdp.ExtMap) {
if e.sdpExtensions == nil {
e.sdpExtensions = make(map[SDPSectionType][]sdp.ExtMap)
}
if _, ok := e.sdpExtensions[mediaType]; !ok {
e.sdpExtensions[mediaType] = []sdp.ExtMap{}
}
e.sdpExtensions[mediaType] = append(e.sdpExtensions[mediaType], exts...)
}
func (e *SettingEngine) getSDPExtensions() map[SDPSectionType][]sdp.ExtMap {
var lastID int
idMap := map[string]int{}
// Build provided ext id map
for _, extList := range e.sdpExtensions {
for _, ext := range extList {
if ext.Value != 0 {
idMap[ext.URI.String()] = ext.Value
}
}
}
// Find next available ID
nextID := func() {
var done bool
for !done {
lastID++
var found bool
for _, v := range idMap {
if lastID == v {
found = true
break
}
}
if !found {
done = true
}
}
}
// Assign missing IDs across all media types based on URI
for mType, extList := range e.sdpExtensions {
for i, ext := range extList {
if ext.Value == 0 {
if id, ok := idMap[ext.URI.String()]; ok {
e.sdpExtensions[mType][i].Value = id
} else {
nextID()
e.sdpExtensions[mType][i].Value = lastID
idMap[ext.URI.String()] = lastID
}
}
}
}
return e.sdpExtensions
}
// SetICEProxyDialer sets the proxy dialer interface based on golang.org/x/net/proxy.
func (e *SettingEngine) SetICEProxyDialer(d proxy.Dialer) {
e.iceProxyDialer = d