mirror of
https://github.com/pion/webrtc.git
synced 2025-10-01 05:22:14 +08:00
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:
@@ -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
|
||||
|
Reference in New Issue
Block a user