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