rtptime: fix crash in case of packets from tracks with invalid clock rate (#400)

This commit is contained in:
Alessandro Ros
2023-09-02 20:45:30 +02:00
committed by GitHub
parent a887f070bf
commit cc450b92a0
2 changed files with 13 additions and 0 deletions

View File

@@ -138,3 +138,12 @@ func TestGlobalDecoder(t *testing.T) {
require.Equal(t, true, ok)
require.Equal(t, 6*time.Second, pts)
}
func TestGlobalDecoderInvalidClockRate(t *testing.T) {
g := NewGlobalDecoder()
tr := &dummyTrack{clockRate: 0, ptsEqualsDTS: true}
_, ok := g.Decode(tr, &rtp.Packet{Header: rtp.Header{Timestamp: 90000}})
require.Equal(t, false, ok)
}