fix tests

This commit is contained in:
aler9 2022-03-06 17:49:26 +01:00 committed by Alessandro Ros
parent dffe63f1bc
commit 2c485f918b
3 changed files with 13 additions and 7 deletions

View File

@ -221,6 +221,7 @@ func TestRTSPSourceDynamicH264Params(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
stream := gortsplib.NewServerStream(gortsplib.Tracks{track}) stream := gortsplib.NewServerStream(gortsplib.Tracks{track})
defer stream.Close()
s := gortsplib.Server{ s := gortsplib.Server{
Handler: &testServer{ Handler: &testServer{
@ -268,6 +269,8 @@ func TestRTSPSourceDynamicH264Params(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
stream.WritePacketRTP(0, pkts[0], true) stream.WritePacketRTP(0, pkts[0], true)
time.Sleep(1 * time.Second)
func() { func() {
c := gortsplib.Client{} c := gortsplib.Client{}

View File

@ -218,7 +218,11 @@ func TestClient(t *testing.T) {
return nil return nil
}, },
func(pts time.Duration, nalus [][]byte) { func(pts time.Duration, nalus [][]byte) {
require.Equal(t, [][]byte{{0x05}}, nalus) require.Equal(t, [][]byte{
{7, 1, 2, 3},
{8},
{0x05},
}, nalus)
close(packetRecv) close(packetRecv)
}, },
func(pts time.Duration, aus [][]byte) { func(pts time.Duration, aus [][]byte) {

View File

@ -33,10 +33,9 @@ func TestMuxerVideoAudio(t *testing.T) {
// group with IDR // group with IDR
err = m.WriteH264(2*time.Second, [][]byte{ err = m.WriteH264(2*time.Second, [][]byte{
{5}, // IDR
{9}, // AUD
{8}, // PPS
{7}, // SPS {7}, // SPS
{8}, // PPS
{5}, // IDR
}) })
require.NoError(t, err) require.NoError(t, err)
@ -124,8 +123,8 @@ func TestMuxerVideoAudio(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, &astits.Packet{ require.Equal(t, &astits.Packet{
AdaptationField: &astits.PacketAdaptationField{ AdaptationField: &astits.PacketAdaptationField{
Length: 145, Length: 148,
StuffingLength: 138, StuffingLength: 141,
HasPCR: true, HasPCR: true,
PCR: &astits.ClockReference{}, PCR: &astits.ClockReference{},
RandomAccessIndicator: true, RandomAccessIndicator: true,
@ -140,7 +139,7 @@ func TestMuxerVideoAudio(t *testing.T) {
0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x80, 0x80,
0x05, 0x21, 0x00, 0x03, 0x5f, 0x91, 0x05, 0x21, 0x00, 0x03, 0x5f, 0x91,
0, 0, 0, 1, 9, 240, // AUD 0, 0, 0, 1, 9, 240, // AUD
0, 0, 0, 1, 7, 1, 2, 3, // SPS 0, 0, 0, 1, 7, // SPS
0, 0, 0, 1, 8, // PPS 0, 0, 0, 1, 8, // PPS
0, 0, 0, 1, 5, // IDR 0, 0, 0, 1, 5, // IDR
}, bytes.Repeat([]byte{0xff}, 0)...), }, bytes.Repeat([]byte{0xff}, 0)...),