diff --git a/pkg/media/samplebuilder/samplebuilder.go b/pkg/media/samplebuilder/samplebuilder.go index b72889beb7b..170c00f068d 100644 --- a/pkg/media/samplebuilder/samplebuilder.go +++ b/pkg/media/samplebuilder/samplebuilder.go @@ -357,12 +357,6 @@ func timestampDistance(x, y uint32) uint32 { // An Option configures a SampleBuilder. type Option func(o *SampleBuilder) -// WithPartitionHeadChecker is obsolete, it does nothing. -func WithPartitionHeadChecker(interface{}) Option { - return func(o *SampleBuilder) { - } -} - // WithPacketReleaseHandler set a callback when the builder is about to release // some packet. func WithPacketReleaseHandler(h func(*rtp.Packet)) Option { diff --git a/pkg/media/samplebuilder/samplebuilder_test.go b/pkg/media/samplebuilder/samplebuilder_test.go index 85cc1760ee6..c5fc75846aa 100644 --- a/pkg/media/samplebuilder/samplebuilder_test.go +++ b/pkg/media/samplebuilder/samplebuilder_test.go @@ -27,6 +27,7 @@ type sampleBuilderTest struct { type fakeDepacketizer struct { headChecker bool headBytes []byte + alwaysHead bool } func (f *fakeDepacketizer) Unmarshal(r []byte) ([]byte, error) { @@ -45,6 +46,10 @@ func (f *fakeDepacketizer) IsPartitionHead(payload []byte) bool { return false } + if f.alwaysHead { + return true + } + for _, b := range f.headBytes { if payload[0] == b { return true @@ -490,16 +495,11 @@ func TestSampleBuilderWithPacketHeadHandler(t *testing.T) { assert.Equal(t, 2, headCount, "two sample heads should have been inspected") } -type truePartitionHeadChecker struct{} - -func (f *truePartitionHeadChecker) IsPartitionHead([]byte) bool { - return true -} - func TestSampleBuilderData(t *testing.T) { - s := New(10, &fakeDepacketizer{}, 1, - WithPartitionHeadChecker(&truePartitionHeadChecker{}), - ) + s := New(10, &fakeDepacketizer{ + headChecker: true, + alwaysHead: true, + }, 1) j := 0 for i := 0; i < 0x20000; i++ { p := rtp.Packet{