mediamtx/internal/formatprocessor/generic_test.go

52 lines
1009 B
Go
Raw Normal View History

package formatprocessor
import (
"testing"
"time"
2023-08-26 16:54:28 +00:00
"github.com/bluenviron/gortsplib/v4/pkg/format"
"github.com/pion/rtp"
"github.com/stretchr/testify/require"
)
func TestGenericRemovePadding(t *testing.T) {
2023-08-26 16:54:28 +00:00
forma := &format.Generic{
PayloadTyp: 96,
RTPMa: "private/90000",
}
2023-08-13 14:38:23 +00:00
err := forma.Init()
require.NoError(t, err)
2023-08-26 21:34:39 +00:00
p, err := New(1472, forma, false)
require.NoError(t, err)
pkt := &rtp.Packet{
Header: rtp.Header{
Version: 2,
Marker: true,
PayloadType: 96,
SequenceNumber: 123,
Timestamp: 45343,
SSRC: 563423,
Padding: true,
},
Payload: []byte{1, 2, 3, 4},
PaddingSize: 20,
}
_, err = p.ProcessRTPPacket(pkt, time.Time{}, 0, false)
require.NoError(t, err)
require.Equal(t, &rtp.Packet{
Header: rtp.Header{
Version: 2,
Marker: true,
PayloadType: 96,
SequenceNumber: 123,
Timestamp: 45343,
SSRC: 563423,
},
Payload: []byte{1, 2, 3, 4},
}, pkt)
}