mirror of
https://github.com/livekit/livekit.git
synced 2026-03-31 00:15:38 +00:00
Use type-specific track prefixes. (#586)
* Use type-specific track prefixes. Making it easier to identify track type from its ID * also include track source
This commit is contained in:
@@ -1238,10 +1238,27 @@ func (p *ParticipantImpl) addPendingTrack(req *livekit.AddTrackRequest) *livekit
|
||||
return nil
|
||||
}
|
||||
|
||||
trackPrefix := utils.TrackPrefix
|
||||
if req.Type == livekit.TrackType_VIDEO {
|
||||
trackPrefix += "V"
|
||||
} else if req.Type == livekit.TrackType_AUDIO {
|
||||
trackPrefix += "A"
|
||||
}
|
||||
switch req.Source {
|
||||
case livekit.TrackSource_CAMERA:
|
||||
trackPrefix += "C"
|
||||
case livekit.TrackSource_MICROPHONE:
|
||||
trackPrefix += "M"
|
||||
case livekit.TrackSource_SCREEN_SHARE:
|
||||
trackPrefix += "S"
|
||||
case livekit.TrackSource_SCREEN_SHARE_AUDIO:
|
||||
trackPrefix += "s"
|
||||
}
|
||||
|
||||
ti := &livekit.TrackInfo{
|
||||
Type: req.Type,
|
||||
Name: req.Name,
|
||||
Sid: utils.NewGuid(utils.TrackPrefix),
|
||||
Sid: utils.NewGuid(trackPrefix),
|
||||
Width: req.Width,
|
||||
Height: req.Height,
|
||||
Muted: req.Muted,
|
||||
|
||||
Reference in New Issue
Block a user