File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -300,6 +300,9 @@ func (s *SampleBuilder) Pop() *media.Sample {
300
300
// no sample is compiled).
301
301
func (s * SampleBuilder ) PopWithTimestamp () (* media.Sample , uint32 ) {
302
302
sample := s .Pop ()
303
+ if sample == nil {
304
+ return nil , 0
305
+ }
303
306
return sample , sample .PacketTimestamp
304
307
}
305
308
Original file line number Diff line number Diff line change @@ -379,3 +379,12 @@ func TestSampleBuilderWithPacketReleaseHandler(t *testing.T) {
379
379
t .Errorf ("Unexpected packet released by samples built" )
380
380
}
381
381
}
382
+
383
+ func TestPopWithTimestamp (t * testing.T ) {
384
+ t .Run ("Crash on nil" , func (t * testing.T ) {
385
+ s := New (0 , & fakeDepacketizer {}, 1 )
386
+ sample , timestamp := s .PopWithTimestamp ()
387
+ assert .Nil (t , sample )
388
+ assert .Equal (t , uint32 (0 ), timestamp )
389
+ })
390
+ }
You can’t perform that action at this time.
0 commit comments