Commit d9a7f3d6 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Avoid reallocating the list of local tracks at each packet.

parent 87f70c43
......@@ -288,7 +288,15 @@ func addUpConn(c *client, id string) (*upConnection, error) {
go func() {
buf := make([]byte, 1500)
var packet rtp.Packet
var local []*downTrack
var localTime time.Time
for {
now := time.Now()
if now.Sub(localTime) > time.Second/2 {
local = track.getLocal()
localTime = now
}
i, err := remote.Read(buf)
if err != nil {
if err != io.EOF {
......@@ -303,7 +311,6 @@ func addUpConn(c *client, id string) (*upConnection, error) {
continue
}
local := track.getLocal()
for _, l := range local {
if l.muted() {
continue
......
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