1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-26 10:35:59 +01:00

Don't reuse API between peer connections.

This turns out to be incorrect when a MediaEngine is attached.
This commit is contained in:
Juliusz Chroboczek 2021-02-04 21:03:17 +01:00
parent 6054ae6cc6
commit b4240c4505

View file

@ -64,7 +64,6 @@ const (
type Group struct { type Group struct {
name string name string
api *webrtc.API
mu sync.Mutex mu sync.Mutex
description *description description *description
@ -122,7 +121,11 @@ var groups struct {
} }
func (g *Group) API() *webrtc.API { func (g *Group) API() *webrtc.API {
return g.api g.mu.Lock()
codecs := g.description.Codecs
g.mu.Unlock()
return APIFromNames(codecs)
} }
func codecFromName(name string) (webrtc.RTPCodecCapability, error) { func codecFromName(name string) (webrtc.RTPCodecCapability, error) {
@ -291,7 +294,6 @@ func Add(name string, desc *description) (*Group, error) {
description: desc, description: desc,
clients: make(map[string]Client), clients: make(map[string]Client),
timestamp: time.Now(), timestamp: time.Now(),
api: APIFromNames(desc.Codecs),
} }
autoLockKick(g, g.getClientsUnlocked(nil)) autoLockKick(g, g.getClientsUnlocked(nil))
groups.groups[name] = g groups.groups[name] = g
@ -319,7 +321,6 @@ func Add(name string, desc *description) (*Group, error) {
return nil, err return nil, err
} }
g.description = desc g.description = desc
g.api = APIFromNames(desc.Codecs)
autoLockKick(g, g.getClientsUnlocked(nil)) autoLockKick(g, g.getClientsUnlocked(nil))
return g, nil return g, nil