fix(video): fix nil reference exception in playback metrics. Closes #3984

This commit is contained in:
Gabe Kangas 2024-10-26 12:22:19 -07:00
parent 05545cb6da
commit 0fccaa61fe

View file

@ -30,15 +30,15 @@ func ReportPlaybackMetrics(w http.ResponseWriter, r *http.Request) {
clientID := utils.GenerateClientIDFromRequest(r)
metrics.RegisterPlaybackErrorCount(clientID, *request.Errors)
if *request.Bandwidth != 0.0 {
if request.Bandwidth != nil && *request.Bandwidth != 0.0 {
metrics.RegisterPlayerBandwidth(clientID, *request.Bandwidth)
}
if *request.Latency != 0.0 {
if request.Latency != nil && *request.Latency != 0.0 {
metrics.RegisterPlayerLatency(clientID, *request.Latency)
}
if *request.DownloadDuration != 0.0 {
if request.DownloadDuration != nil && *request.DownloadDuration != 0.0 {
metrics.RegisterPlayerSegmentDownloadDuration(clientID, *request.DownloadDuration)
}