package aoiprxkit

import "testing"

func TestParseRTPPacket(t *testing.T) {
	buf := []byte{
		0x80, 0x61, 0x12, 0x34,
		0x00, 0x00, 0x00, 0x05,
		0x11, 0x22, 0x33, 0x44,
		0x01, 0x02, 0x03,
	}
	p, err := ParseRTPPacket(buf)
	if err != nil {
		t.Fatalf("unexpected err: %v", err)
	}
	if p.Version != 2 || p.PayloadType != 97 || p.SequenceNumber != 0x1234 || p.Timestamp != 5 || p.SSRC != 0x11223344 {
		t.Fatalf("unexpected packet: %+v", p)
	}
	if len(p.Payload) != 3 || p.Payload[0] != 1 || p.Payload[2] != 3 {
		t.Fatalf("unexpected payload: %v", p.Payload)
	}
}
