TrackInfo may not be available in Bind. (#918)
This commit is contained in:
@@ -99,6 +99,7 @@ func (d *DummyReceiver) Upgrade(receiver sfu.TrackReceiver) {
|
||||
d.downtrackLock.Lock()
|
||||
for _, t := range d.downtracks {
|
||||
receiver.AddDownTrack(t)
|
||||
t.TrackInfoAvailable()
|
||||
}
|
||||
d.downtracks = make(map[livekit.ParticipantID]sfu.TrackSender)
|
||||
d.downtrackLock.Unlock()
|
||||
|
||||
@@ -33,6 +33,7 @@ type TrackSender interface {
|
||||
// ID is the globally unique identifier for this Track.
|
||||
ID() string
|
||||
SubscriberID() livekit.ParticipantID
|
||||
TrackInfoAvailable()
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -298,7 +299,6 @@ func (d *DownTrack) Bind(t webrtc.TrackLocalContext) (webrtc.RTPCodecParameters,
|
||||
d.bound.Store(true)
|
||||
d.bindLock.Unlock()
|
||||
|
||||
d.connectionStats.Start(d.receiver.TrackInfo())
|
||||
d.logger.Debugw("downtrack bound")
|
||||
|
||||
return codec, nil
|
||||
@@ -311,6 +311,10 @@ func (d *DownTrack) Unbind(_ webrtc.TrackLocalContext) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *DownTrack) TrackInfoAvailable() {
|
||||
d.connectionStats.Start(d.receiver.TrackInfo())
|
||||
}
|
||||
|
||||
// ID is the unique identifier for this Track. This should be unique for the
|
||||
// stream, but doesn't have to globally unique. A common example would be 'audio' or 'video'
|
||||
// and StreamID would be 'desktop' or 'webcam'
|
||||
|
||||
Reference in New Issue
Block a user