Send telemetry events on track feature updates. (#2723)
* Send telemetry events on track feature updates. * Do not process no change
This commit is contained in:
@@ -673,20 +673,29 @@ func (t *MediaTrackReceiver) UpdateAudioTrack(update *livekit.UpdateLocalAudioTr
|
|||||||
}
|
}
|
||||||
|
|
||||||
t.lock.Lock()
|
t.lock.Lock()
|
||||||
t.trackInfo.AudioFeatures = update.Features
|
clonedInfo := proto.Clone(t.trackInfo).(*livekit.TrackInfo)
|
||||||
t.trackInfo.Stereo = false
|
clonedInfo.AudioFeatures = update.Features
|
||||||
t.trackInfo.DisableDtx = false
|
clonedInfo.Stereo = false
|
||||||
|
clonedInfo.DisableDtx = false
|
||||||
for _, feature := range update.Features {
|
for _, feature := range update.Features {
|
||||||
switch feature {
|
switch feature {
|
||||||
case livekit.AudioTrackFeature_TF_STEREO:
|
case livekit.AudioTrackFeature_TF_STEREO:
|
||||||
t.trackInfo.Stereo = true
|
clonedInfo.Stereo = true
|
||||||
case livekit.AudioTrackFeature_TF_NO_DTX:
|
case livekit.AudioTrackFeature_TF_NO_DTX:
|
||||||
t.trackInfo.DisableDtx = true
|
clonedInfo.DisableDtx = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if proto.Equal(t.trackInfo, clonedInfo) {
|
||||||
|
t.lock.Unlock()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
t.trackInfo = clonedInfo
|
||||||
t.lock.Unlock()
|
t.lock.Unlock()
|
||||||
|
|
||||||
t.updateTrackInfoOfReceivers()
|
t.updateTrackInfoOfReceivers()
|
||||||
|
|
||||||
|
t.params.Telemetry.TrackPublishedUpdate(context.Background(), t.PublisherID(), clonedInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *MediaTrackReceiver) UpdateVideoTrack(update *livekit.UpdateLocalVideoTrack) {
|
func (t *MediaTrackReceiver) UpdateVideoTrack(update *livekit.UpdateLocalVideoTrack) {
|
||||||
@@ -695,11 +704,20 @@ func (t *MediaTrackReceiver) UpdateVideoTrack(update *livekit.UpdateLocalVideoTr
|
|||||||
}
|
}
|
||||||
|
|
||||||
t.lock.Lock()
|
t.lock.Lock()
|
||||||
t.trackInfo.Width = update.Width
|
clonedInfo := proto.Clone(t.trackInfo).(*livekit.TrackInfo)
|
||||||
t.trackInfo.Height = update.Height
|
clonedInfo.Width = update.Width
|
||||||
|
clonedInfo.Height = update.Height
|
||||||
|
if proto.Equal(t.trackInfo, clonedInfo) {
|
||||||
|
t.lock.Unlock()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
t.trackInfo = clonedInfo
|
||||||
t.lock.Unlock()
|
t.lock.Unlock()
|
||||||
|
|
||||||
t.updateTrackInfoOfReceivers()
|
t.updateTrackInfoOfReceivers()
|
||||||
|
|
||||||
|
t.params.Telemetry.TrackPublishedUpdate(context.Background(), t.PublisherID(), clonedInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *MediaTrackReceiver) TrackInfo() *livekit.TrackInfo {
|
func (t *MediaTrackReceiver) TrackInfo() *livekit.TrackInfo {
|
||||||
@@ -709,11 +727,15 @@ func (t *MediaTrackReceiver) TrackInfo() *livekit.TrackInfo {
|
|||||||
return t.trackInfo
|
return t.trackInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *MediaTrackReceiver) trackInfoCloneLocked() *livekit.TrackInfo {
|
||||||
|
return proto.Clone(t.trackInfo).(*livekit.TrackInfo)
|
||||||
|
}
|
||||||
|
|
||||||
func (t *MediaTrackReceiver) TrackInfoClone() *livekit.TrackInfo {
|
func (t *MediaTrackReceiver) TrackInfoClone() *livekit.TrackInfo {
|
||||||
t.lock.RLock()
|
t.lock.RLock()
|
||||||
defer t.lock.RUnlock()
|
defer t.lock.RUnlock()
|
||||||
|
|
||||||
return proto.Clone(t.trackInfo).(*livekit.TrackInfo)
|
return t.trackInfoCloneLocked()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *MediaTrackReceiver) NotifyMaxLayerChange(maxLayer int32) {
|
func (t *MediaTrackReceiver) NotifyMaxLayerChange(maxLayer int32) {
|
||||||
|
|||||||
Reference in New Issue
Block a user