mirror of
https://github.com/aler9/rtsp-simple-server
synced 2025-10-06 16:17:59 +08:00
@@ -97,13 +97,6 @@ func TestServerPublish(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
n := 0
|
||||
timeNow := func() time.Time {
|
||||
d := time.Date(2009, 5, 20, 22, 15, 25, 427000, time.Local).Add(time.Duration(n) * 2 * time.Second)
|
||||
n++
|
||||
return d
|
||||
}
|
||||
|
||||
s := &Server{
|
||||
Address: "127.0.0.1:1935",
|
||||
ReadTimeout: conf.Duration(10 * time.Second),
|
||||
@@ -116,7 +109,6 @@ func TestServerPublish(t *testing.T) {
|
||||
RunOnConnectRestart: false,
|
||||
RunOnDisconnect: "",
|
||||
ExternalCmdPool: nil,
|
||||
TimeNow: timeNow,
|
||||
PathManager: pathManager,
|
||||
Parent: test.NilLogger,
|
||||
}
|
||||
@@ -154,6 +146,12 @@ func TestServerPublish(t *testing.T) {
|
||||
err = w.Initialize()
|
||||
require.NoError(t, err)
|
||||
|
||||
err = w.WriteH264(
|
||||
2*time.Second, 2*time.Second, [][]byte{
|
||||
{5, 2, 3, 4},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
<-path.streamCreated
|
||||
|
||||
recv := make(chan struct{})
|
||||
@@ -168,7 +166,7 @@ func TestServerPublish(t *testing.T) {
|
||||
require.Equal(t, [][]byte{
|
||||
test.FormatH264.SPS,
|
||||
test.FormatH264.PPS,
|
||||
{5, 6, 7, 8},
|
||||
{5, 2, 3, 4},
|
||||
}, u.(*unit.H264).AU)
|
||||
close(recv)
|
||||
return nil
|
||||
@@ -179,7 +177,7 @@ func TestServerPublish(t *testing.T) {
|
||||
|
||||
err = w.WriteH264(
|
||||
3*time.Second, 3*time.Second, [][]byte{
|
||||
{5, 6, 7, 8},
|
||||
{5, 2, 3, 4},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -305,16 +303,8 @@ func TestServerRead(t *testing.T) {
|
||||
})
|
||||
}()
|
||||
|
||||
n := 0
|
||||
timeNow := func() time.Time {
|
||||
d := time.Date(2009, 5, 20, 22, 15, 25, 427000, time.Local).Add(time.Duration(n) * 2 * time.Second)
|
||||
n++
|
||||
return d
|
||||
}
|
||||
|
||||
r := &rtmp.Reader{
|
||||
Conn: conn,
|
||||
TimeNow: timeNow,
|
||||
Conn: conn,
|
||||
}
|
||||
err = r.Initialize()
|
||||
require.NoError(t, err)
|
||||
|
Reference in New Issue
Block a user