Handle UpdateLocalAudioTrack and UpdateLocalVideoTrack. (#2684)
* Handle UpdateLocalAudioTrack and UpdateLocalVideoTrack. - Update the TrackInfo - NOTE: populating Stereo and DisableDtx fields although there are features now. - The audio features in UpdateLocalAudioTrack is applied as is, i. e. the update has the latest set of features. - Emits a track update which will broadcast a participant update. TODO: ----- - Telemetry event with track update? * update deps
This commit is contained in:
@@ -254,6 +254,36 @@ func (u *UpTrackManager) UpdateVideoLayers(updateVideoLayers *livekit.UpdateVide
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *UpTrackManager) UpdateAudioTrack(update *livekit.UpdateLocalAudioTrack) error {
|
||||
track := u.GetPublishedTrack(livekit.TrackID(update.TrackSid))
|
||||
if track == nil {
|
||||
u.params.Logger.Warnw("could not find track", nil, "trackID", livekit.TrackID(update.TrackSid))
|
||||
return errors.New("could not find published track")
|
||||
}
|
||||
|
||||
track.UpdateAudioTrack(update)
|
||||
if u.onTrackUpdated != nil {
|
||||
u.onTrackUpdated(track)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *UpTrackManager) UpdateVideoTrack(update *livekit.UpdateLocalVideoTrack) error {
|
||||
track := u.GetPublishedTrack(livekit.TrackID(update.TrackSid))
|
||||
if track == nil {
|
||||
u.params.Logger.Warnw("could not find track", nil, "trackID", livekit.TrackID(update.TrackSid))
|
||||
return errors.New("could not find published track")
|
||||
}
|
||||
|
||||
track.UpdateVideoTrack(update)
|
||||
if u.onTrackUpdated != nil {
|
||||
u.onTrackUpdated(track)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *UpTrackManager) AddPublishedTrack(track types.MediaTrack) {
|
||||
u.lock.Lock()
|
||||
if _, ok := u.publishedTracks[track.ID()]; !ok {
|
||||
|
||||
Reference in New Issue
Block a user