直播:后台 JWT 推流、前台画中画;WebRTC 服务与 Nginx WebSocket 代理
Made-with: Cursor
This commit is contained in:
44
server/vendor/github.com/pion/sdp/v3/unmarshal_cache.go
generated
vendored
Normal file
44
server/vendor/github.com/pion/sdp/v3/unmarshal_cache.go
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package sdp
|
||||
|
||||
type unmarshalCache struct {
|
||||
sessionAttributes []Attribute
|
||||
mediaAttributes []Attribute
|
||||
}
|
||||
|
||||
func (c *unmarshalCache) reset() {
|
||||
c.sessionAttributes = c.sessionAttributes[:0]
|
||||
c.mediaAttributes = c.mediaAttributes[:0]
|
||||
}
|
||||
|
||||
func (c *unmarshalCache) getSessionAttribute() *Attribute {
|
||||
c.sessionAttributes = append(c.sessionAttributes, Attribute{})
|
||||
return &c.sessionAttributes[len(c.sessionAttributes)-1]
|
||||
}
|
||||
|
||||
func (c *unmarshalCache) cloneSessionAttributes() []Attribute {
|
||||
if len(c.sessionAttributes) == 0 {
|
||||
return nil
|
||||
}
|
||||
s := make([]Attribute, len(c.sessionAttributes))
|
||||
copy(s, c.sessionAttributes)
|
||||
c.sessionAttributes = c.sessionAttributes[:0]
|
||||
return s
|
||||
}
|
||||
|
||||
func (c *unmarshalCache) getMediaAttribute() *Attribute {
|
||||
c.mediaAttributes = append(c.mediaAttributes, Attribute{})
|
||||
return &c.mediaAttributes[len(c.mediaAttributes)-1]
|
||||
}
|
||||
|
||||
func (c *unmarshalCache) cloneMediaAttributes() []Attribute {
|
||||
if len(c.mediaAttributes) == 0 {
|
||||
return nil
|
||||
}
|
||||
s := make([]Attribute, len(c.mediaAttributes))
|
||||
copy(s, c.mediaAttributes)
|
||||
c.mediaAttributes = c.mediaAttributes[:0]
|
||||
return s
|
||||
}
|
||||
Reference in New Issue
Block a user