Commit b4240c45 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Don't reuse API between peer connections.

This turns out to be incorrect when a MediaEngine is attached.
parent 6054ae6c
...@@ -64,7 +64,6 @@ const ( ...@@ -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 { ...@@ -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) { ...@@ -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) { ...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment