1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-12-22 23:35:46 +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 {
name string
api *webrtc.API
mu sync.Mutex
description *description
@ -122,7 +121,11 @@ var groups struct {
}
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) {
@ -291,7 +294,6 @@ func Add(name string, desc *description) (*Group, error) {
description: desc,
clients: make(map[string]Client),
timestamp: time.Now(),
api: APIFromNames(desc.Codecs),
}
autoLockKick(g, g.getClientsUnlocked(nil))
groups.groups[name] = g
@ -319,7 +321,6 @@ func Add(name string, desc *description) (*Group, error) {
return nil, err
}
g.description = desc
g.api = APIFromNames(desc.Codecs)
autoLockKick(g, g.getClientsUnlocked(nil))
return g, nil