Add two locks for Track

This commit is contained in:
Alexey Khit
2022-11-18 09:12:48 +03:00
parent fdb316910f
commit 48635ae341
+4
View File
@@ -18,7 +18,9 @@ type Track struct {
func (t *Track) String() string {
s := t.Codec.String()
t.sinkMu.RLock()
s += fmt.Sprintf(", sinks=%d", len(t.sink))
t.sinkMu.RUnlock()
return s
}
@@ -55,7 +57,9 @@ func (t *Track) Unbind() {
}
func (t *Track) GetSink(from *Track) {
t.sinkMu.Lock()
t.sink = from.sink
t.sinkMu.Unlock()
}
func (t *Track) HasSink() bool {