mirror of
https://github.com/pion/webrtc.git
synced 2025-10-05 15:16:52 +08:00
Avoid crash in samplebuilder.PopWithTimestamp
If sample is null, PopWithTimestamp will crash with SIGSEGV.
This commit is contained in:

committed by
Sean DuBois

parent
41243cd179
commit
11f6a65fe2
@@ -379,3 +379,12 @@ func TestSampleBuilderWithPacketReleaseHandler(t *testing.T) {
|
||||
t.Errorf("Unexpected packet released by samples built")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPopWithTimestamp(t *testing.T) {
|
||||
t.Run("Crash on nil", func(t *testing.T) {
|
||||
s := New(0, &fakeDepacketizer{}, 1)
|
||||
sample, timestamp := s.PopWithTimestamp()
|
||||
assert.Nil(t, sample)
|
||||
assert.Equal(t, uint32(0), timestamp)
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user