Use type-specific track prefixes.
* Use type-specific track prefixes.
Making it easier to identify track type from its ID
* also include track source
@@ -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,
