Fixed panics with nil stats (#517)

This commit is contained in:
David Zhao
2022-03-15 12:01:26 -07:00
committed by GitHub
parent 4d1cc82c89
commit d498cccc05
3 changed files with 9 additions and 0 deletions
+3
View File
@@ -1201,6 +1201,9 @@ func (d *DownTrack) GetTrackStats() map[uint32]*buffer.StreamStatsWithLayers {
streamStats := make(map[uint32]*buffer.StreamStatsWithLayers, 1)
stats := d.rtpStats.ToProto()
if stats == nil {
return nil
}
layers := make(map[int]buffer.LayerStats)
layers[0] = buffer.LayerStats{