Bump up protocol for connection quality LOST. (#2297)
Also log trackID/trackInfo in layer mapping.
This commit is contained in:
@@ -990,6 +990,10 @@ func (p *ParticipantImpl) GetConnectionQuality() *livekit.ConnectionQualityInfo
|
|||||||
}
|
}
|
||||||
p.lock.Unlock()
|
p.lock.Unlock()
|
||||||
|
|
||||||
|
if minQuality == livekit.ConnectionQuality_LOST && !p.ProtocolVersion().SupportsConnectionQualityLost() {
|
||||||
|
minQuality = livekit.ConnectionQuality_POOR
|
||||||
|
}
|
||||||
|
|
||||||
return &livekit.ConnectionQualityInfo{
|
return &livekit.ConnectionQualityInfo{
|
||||||
ParticipantSid: string(p.ID()),
|
ParticipantSid: string(p.ID()),
|
||||||
Quality: minQuality,
|
Quality: minQuality,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ package types
|
|||||||
|
|
||||||
type ProtocolVersion int
|
type ProtocolVersion int
|
||||||
|
|
||||||
const CurrentProtocol = 10
|
const CurrentProtocol = 11
|
||||||
|
|
||||||
func (v ProtocolVersion) SupportsPackedStreamId() bool {
|
func (v ProtocolVersion) SupportsPackedStreamId() bool {
|
||||||
return v > 0
|
return v > 0
|
||||||
@@ -75,3 +75,7 @@ func (v ProtocolVersion) SupportHandlesDisconnectedUpdate() bool {
|
|||||||
func (v ProtocolVersion) SupportSyncStreamID() bool {
|
func (v ProtocolVersion) SupportSyncStreamID() bool {
|
||||||
return v > 9
|
return v > 9
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (v ProtocolVersion) SupportsConnectionQualityLost() bool {
|
||||||
|
return v > 10
|
||||||
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ func LayerPresenceFromTrackInfo(trackInfo *livekit.TrackInfo) *[livekit.VideoQua
|
|||||||
if layer.Quality <= livekit.VideoQuality_HIGH {
|
if layer.Quality <= livekit.VideoQuality_HIGH {
|
||||||
layerPresence[layer.Quality] = true
|
layerPresence[layer.Quality] = true
|
||||||
} else {
|
} else {
|
||||||
logger.Warnw("unexpected quality in track info", nil, "trackInfo", logger.Proto(trackInfo))
|
logger.Warnw("unexpected quality in track info", nil, "trackID", trackInfo.Sid, "trackInfo", logger.Proto(trackInfo))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,13 +97,13 @@ func RidToSpatialLayer(rid string, trackInfo *livekit.TrackInfo) int32 {
|
|||||||
return 2
|
return 2
|
||||||
|
|
||||||
case lp[livekit.VideoQuality_LOW] && lp[livekit.VideoQuality_MEDIUM]:
|
case lp[livekit.VideoQuality_LOW] && lp[livekit.VideoQuality_MEDIUM]:
|
||||||
logger.Warnw("unexpected rid f with only two qualities, low and medium", nil)
|
logger.Warnw("unexpected rid f with only two qualities, low and medium", nil, "trackID", trackInfo.Sid, "trackInfo", logger.Proto(trackInfo))
|
||||||
return 1
|
return 1
|
||||||
case lp[livekit.VideoQuality_LOW] && lp[livekit.VideoQuality_HIGH]:
|
case lp[livekit.VideoQuality_LOW] && lp[livekit.VideoQuality_HIGH]:
|
||||||
logger.Warnw("unexpected rid f with only two qualities, low and high", nil)
|
logger.Warnw("unexpected rid f with only two qualities, low and high", nil, "trackID", trackInfo.Sid, "trackInfo", logger.Proto(trackInfo))
|
||||||
return 1
|
return 1
|
||||||
case lp[livekit.VideoQuality_MEDIUM] && lp[livekit.VideoQuality_HIGH]:
|
case lp[livekit.VideoQuality_MEDIUM] && lp[livekit.VideoQuality_HIGH]:
|
||||||
logger.Warnw("unexpected rid f with only two qualities, medium and high", nil)
|
logger.Warnw("unexpected rid f with only two qualities, medium and high", nil, "trackID", trackInfo.Sid, "trackInfo", logger.Proto(trackInfo))
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -169,13 +169,13 @@ func SpatialLayerToRid(layer int32, trackInfo *livekit.TrackInfo) string {
|
|||||||
return FullResolution
|
return FullResolution
|
||||||
|
|
||||||
case lp[livekit.VideoQuality_LOW] && lp[livekit.VideoQuality_MEDIUM]:
|
case lp[livekit.VideoQuality_LOW] && lp[livekit.VideoQuality_MEDIUM]:
|
||||||
logger.Warnw("unexpected layer 2 with only two qualities, low and medium", nil)
|
logger.Warnw("unexpected layer 2 with only two qualities, low and medium", nil, "trackID", trackInfo.Sid, "trackInfo", logger.Proto(trackInfo))
|
||||||
return HalfResolution
|
return HalfResolution
|
||||||
case lp[livekit.VideoQuality_LOW] && lp[livekit.VideoQuality_HIGH]:
|
case lp[livekit.VideoQuality_LOW] && lp[livekit.VideoQuality_HIGH]:
|
||||||
logger.Warnw("unexpected layer 2 with only two qualities, low and high", nil)
|
logger.Warnw("unexpected layer 2 with only two qualities, low and high", nil, "trackID", trackInfo.Sid, "trackInfo", logger.Proto(trackInfo))
|
||||||
return HalfResolution
|
return HalfResolution
|
||||||
case lp[livekit.VideoQuality_MEDIUM] && lp[livekit.VideoQuality_HIGH]:
|
case lp[livekit.VideoQuality_MEDIUM] && lp[livekit.VideoQuality_HIGH]:
|
||||||
logger.Warnw("unexpected layer 2 with only two qualities, medium and high", nil)
|
logger.Warnw("unexpected layer 2 with only two qualities, medium and high", nil, "trackID", trackInfo.Sid, "trackInfo", logger.Proto(trackInfo))
|
||||||
return HalfResolution
|
return HalfResolution
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -240,7 +240,7 @@ func SpatialLayerToVideoQuality(layer int32, trackInfo *livekit.TrackInfo) livek
|
|||||||
return livekit.VideoQuality_HIGH
|
return livekit.VideoQuality_HIGH
|
||||||
|
|
||||||
default:
|
default:
|
||||||
logger.Errorw("invalid layer", nil, "layer", layer, "trackInfo", trackInfo)
|
logger.Errorw("invalid layer", nil, "trackID", trackInfo.Sid, "layer", layer, "trackInfo", logger.Proto(trackInfo))
|
||||||
return livekit.VideoQuality_HIGH
|
return livekit.VideoQuality_HIGH
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,7 +250,7 @@ func SpatialLayerToVideoQuality(layer int32, trackInfo *livekit.TrackInfo) livek
|
|||||||
return livekit.VideoQuality_HIGH
|
return livekit.VideoQuality_HIGH
|
||||||
|
|
||||||
default:
|
default:
|
||||||
logger.Errorw("invalid layer", nil, "layer", layer, "trackInfo", trackInfo)
|
logger.Errorw("invalid layer", nil, "trackID", trackInfo.Sid, "layer", layer, "trackInfo", logger.Proto(trackInfo))
|
||||||
return livekit.VideoQuality_HIGH
|
return livekit.VideoQuality_HIGH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user