mirror of
https://github.com/jech/galene.git
synced 2024-11-22 16:45:58 +01:00
Avoid reallocating the list of local tracks at each packet.
This commit is contained in:
parent
87f70c4345
commit
d9a7f3d6c0
1 changed files with 8 additions and 1 deletions
|
@ -288,7 +288,15 @@ func addUpConn(c *client, id string) (*upConnection, error) {
|
||||||
go func() {
|
go func() {
|
||||||
buf := make([]byte, 1500)
|
buf := make([]byte, 1500)
|
||||||
var packet rtp.Packet
|
var packet rtp.Packet
|
||||||
|
var local []*downTrack
|
||||||
|
var localTime time.Time
|
||||||
for {
|
for {
|
||||||
|
now := time.Now()
|
||||||
|
if now.Sub(localTime) > time.Second/2 {
|
||||||
|
local = track.getLocal()
|
||||||
|
localTime = now
|
||||||
|
}
|
||||||
|
|
||||||
i, err := remote.Read(buf)
|
i, err := remote.Read(buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err != io.EOF {
|
if err != io.EOF {
|
||||||
|
@ -303,7 +311,6 @@ func addUpConn(c *client, id string) (*upConnection, error) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
local := track.getLocal()
|
|
||||||
for _, l := range local {
|
for _, l := range local {
|
||||||
if l.muted() {
|
if l.muted() {
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue