Fixed panics with nil stats (#517)
This commit is contained in:
@@ -677,6 +677,9 @@ func (b *Buffer) GetStats() *StreamStatsWithLayers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stats := b.rtpStats.ToProto()
|
stats := b.rtpStats.ToProto()
|
||||||
|
if stats == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
layers := make(map[int]LayerStats)
|
layers := make(map[int]LayerStats)
|
||||||
layers[0] = LayerStats{
|
layers[0] = LayerStats{
|
||||||
|
|||||||
@@ -1201,6 +1201,9 @@ func (d *DownTrack) GetTrackStats() map[uint32]*buffer.StreamStatsWithLayers {
|
|||||||
streamStats := make(map[uint32]*buffer.StreamStatsWithLayers, 1)
|
streamStats := make(map[uint32]*buffer.StreamStatsWithLayers, 1)
|
||||||
|
|
||||||
stats := d.rtpStats.ToProto()
|
stats := d.rtpStats.ToProto()
|
||||||
|
if stats == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
layers := make(map[int]buffer.LayerStats)
|
layers := make(map[int]buffer.LayerStats)
|
||||||
layers[0] = buffer.LayerStats{
|
layers[0] = buffer.LayerStats{
|
||||||
|
|||||||
@@ -420,6 +420,9 @@ func (w *WebRTCReceiver) GetTrackStats() map[uint32]*buffer.StreamStatsWithLayer
|
|||||||
}
|
}
|
||||||
|
|
||||||
sswl := buff.GetStats()
|
sswl := buff.GetStats()
|
||||||
|
if sswl == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// if simulcast, patch buffer stats with correct layer
|
// if simulcast, patch buffer stats with correct layer
|
||||||
if w.isSimulcast {
|
if w.isSimulcast {
|
||||||
|
|||||||
Reference in New Issue
Block a user