Skip to content

Commit

Permalink
remove track id cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohan Totting committed Apr 19, 2024
1 parent 1c3462a commit ad7b889
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
1 change: 1 addition & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ func NewClient(s *SFU, id string, name string, peerConnectionConfig webrtc.Confi

defer glog.Info("client: ", client.ID(), " new track ", remoteTrackID, " Kind:", remoteTrack.Kind(), " Codec: ", remoteTrack.Codec().MimeType, " RID: ", remoteTrack.RID(), " Direction: ", receiver.RTPTransceiver().Direction())

// make sure the remote track ID is not empty
if remoteTrackID == "" {
glog.Error("client: error remote track id is empty")
return
Expand Down
21 changes: 6 additions & 15 deletions track.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package sfu
import (
"context"
"errors"
"strings"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -78,15 +77,11 @@ type Track struct {
func newTrack(ctx context.Context, client *Client, trackRemote IRemoteTrack, minWait, maxWait, pliInterval time.Duration, onPLI func(), stats stats.Getter, onStatsUpdated func(*stats.Stats)) ITrack {
ctList := newClientTrackList()

remoteTrackID := strings.ReplaceAll(strings.ReplaceAll(trackRemote.ID(), "{", ""), "}", "")
streamID := strings.ReplaceAll(strings.ReplaceAll(trackRemote.StreamID(), "{", ""), "}", "")
msid := strings.ReplaceAll(strings.ReplaceAll(trackRemote.Msid(), "{", ""), "}", "")

baseTrack := &baseTrack{
id: remoteTrackID,
id: trackRemote.ID(),
isScreen: &atomic.Bool{},
msid: msid,
streamid: streamID,
msid: trackRemote.Msid(),
streamid: trackRemote.StreamID(),
client: client,
kind: trackRemote.Kind(),
codec: trackRemote.Codec(),
Expand Down Expand Up @@ -363,17 +358,13 @@ type SimulcastTrack struct {
}

func newSimulcastTrack(client *Client, track IRemoteTrack, minWait, maxWait, pliInterval time.Duration, onPLI func(), stats stats.Getter, onStatsUpdated func(*stats.Stats)) ITrack {
remoteTrackID := strings.ReplaceAll(strings.ReplaceAll(track.ID(), "{", ""), "}", "")
streamID := strings.ReplaceAll(strings.ReplaceAll(track.StreamID(), "{", ""), "}", "")
msid := strings.ReplaceAll(strings.ReplaceAll(track.Msid(), "{", ""), "}", "")

t := &SimulcastTrack{
mu: sync.RWMutex{},
base: &baseTrack{
id: remoteTrackID,
id: track.ID(),
isScreen: &atomic.Bool{},
msid: msid,
streamid: streamID,
msid: track.Msid(),
streamid: track.StreamID(),
client: client,
kind: track.Kind(),
codec: track.Codec(),
Expand Down

0 comments on commit ad7b889

Please sign in to comment.