improve tests

This commit is contained in:
aler9
2022-06-14 12:43:48 +02:00
parent 774d3f2973
commit 7d0e8ed058
9 changed files with 217 additions and 10 deletions

51
track_h265_test.go Normal file
View File

@@ -0,0 +1,51 @@
package gortsplib
import (
"testing"
psdp "github.com/pion/sdp/v3"
"github.com/stretchr/testify/require"
)
func TestTrackH265New(t *testing.T) {
track := NewTrackH265(96,
[]byte{0x01, 0x02}, []byte{0x03, 0x04}, []byte{0x05, 0x06})
require.Equal(t, "", track.GetControl())
require.Equal(t, []byte{0x01, 0x02}, track.VPS())
require.Equal(t, []byte{0x03, 0x04}, track.SPS())
require.Equal(t, []byte{0x05, 0x06}, track.PPS())
}
func TestTrackH265Clone(t *testing.T) {
track := NewTrackH265(96, []byte{0x01, 0x02}, []byte{0x03, 0x04}, []byte{0x05, 0x06})
clone := track.clone()
require.NotSame(t, track, clone)
require.Equal(t, track, clone)
}
func TestTrackH265MediaDescription(t *testing.T) {
track := NewTrackH265(96, []byte{0x01, 0x02}, []byte{0x03, 0x04}, []byte{0x05, 0x06})
require.Equal(t, &psdp.MediaDescription{
MediaName: psdp.MediaName{
Media: "video",
Protos: []string{"RTP", "AVP"},
Formats: []string{"96"},
},
Attributes: []psdp.Attribute{
{
Key: "rtpmap",
Value: "96 H265/90000",
},
{
Key: "fmtp",
Value: "96 sprop-vps=AQI=; sprop-sps=AwQ=; sprop-pps=BQY=",
},
{
Key: "control",
Value: "",
},
},
}, track.MediaDescription())
}