diff --git a/internal/core/rtsp_source_test.go b/internal/core/rtsp_source_test.go index 11c148a2..5809bb4d 100644 --- a/internal/core/rtsp_source_test.go +++ b/internal/core/rtsp_source_test.go @@ -221,6 +221,7 @@ func TestRTSPSourceDynamicH264Params(t *testing.T) { require.NoError(t, err) stream := gortsplib.NewServerStream(gortsplib.Tracks{track}) + defer stream.Close() s := gortsplib.Server{ Handler: &testServer{ @@ -268,6 +269,8 @@ func TestRTSPSourceDynamicH264Params(t *testing.T) { require.NoError(t, err) stream.WritePacketRTP(0, pkts[0], true) + time.Sleep(1 * time.Second) + func() { c := gortsplib.Client{} diff --git a/internal/hls/client_test.go b/internal/hls/client_test.go index 0ccbb578..ac3d8f3c 100644 --- a/internal/hls/client_test.go +++ b/internal/hls/client_test.go @@ -218,7 +218,11 @@ func TestClient(t *testing.T) { return nil }, 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) }, func(pts time.Duration, aus [][]byte) { diff --git a/internal/hls/muxer_test.go b/internal/hls/muxer_test.go index 2d69bc2c..73534553 100644 --- a/internal/hls/muxer_test.go +++ b/internal/hls/muxer_test.go @@ -33,10 +33,9 @@ func TestMuxerVideoAudio(t *testing.T) { // group with IDR err = m.WriteH264(2*time.Second, [][]byte{ - {5}, // IDR - {9}, // AUD - {8}, // PPS {7}, // SPS + {8}, // PPS + {5}, // IDR }) require.NoError(t, err) @@ -124,8 +123,8 @@ func TestMuxerVideoAudio(t *testing.T) { require.NoError(t, err) require.Equal(t, &astits.Packet{ AdaptationField: &astits.PacketAdaptationField{ - Length: 145, - StuffingLength: 138, + Length: 148, + StuffingLength: 141, HasPCR: true, PCR: &astits.ClockReference{}, RandomAccessIndicator: true, @@ -140,7 +139,7 @@ func TestMuxerVideoAudio(t *testing.T) { 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x80, 0x80, 0x05, 0x21, 0x00, 0x03, 0x5f, 0x91, 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, 5, // IDR }, bytes.Repeat([]byte{0xff}, 0)...),