MCPcopy Create free account
hub / github.com/pion/rtp / TestRFC8285TwoByteSetExtensionShouldEnableExensionsWhenAdding

Function TestRFC8285TwoByteSetExtensionShouldEnableExensionsWhenAdding

packet_test.go:842–885  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

840}
841
842func TestRFC8285TwoByteSetExtensionShouldEnableExensionsWhenAdding(t *testing.T) {
843 payload := []byte{
844 // Payload
845 0x98, 0x36, 0xbe, 0x88, 0x9e,
846 }
847 p := &Packet{
848 Header: Header{
849 Marker: true,
850 Extension: false,
851 Version: 2,
852 PayloadType: 96,
853 SequenceNumber: 27023,
854 Timestamp: 3653407706,
855 SSRC: 476325762,
856 CSRC: []uint32{},
857 },
858 Payload: payload,
859 }
860
861 extension := []byte{
862 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
863 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
864 }
865 err := p.SetExtension(1, extension)
866 if err != nil {
867 t.Error("Error setting extension")
868 }
869
870 if p.Extension != true {
871 t.Error("Extension should be set to true")
872 }
873
874 if p.ExtensionProfile != 0x1000 {
875 t.Error("Extension profile should be set to 0xBEDE")
876 }
877
878 if len(p.Extensions) != 1 {
879 t.Error("Extensions should be set to 1")
880 }
881
882 if !bytes.Equal(p.GetExtension(1), extension) {
883 t.Error("Extension value is not set")
884 }
885}
886
887func TestRFC8285TwoByteSetExtensionShouldUpdateExistingExension(t *testing.T) {
888 payload := []byte{

Callers

nothing calls this directly

Calls 2

SetExtensionMethod · 0.80
GetExtensionMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…