mirror of
https://github.com/aler9/rtsp-simple-server
synced 2025-10-05 23:56:54 +08:00
rtmp: rewrite implementation of rtmp connection (#1047)
* rtmp: improve MsgCommandAMF0 * rtmp: fix MsgSetPeerBandwidth * rtmp: add message tests * rtmp: replace implementation with new one * rtmp: rename handshake functions * rtmp: avoid calling useless function * rtmp: use time.Duration for PTSDelta * rtmp: fix decoding chunks with relevant size * rtmp: rewrite implementation of rtmp connection * rtmp: fix tests * rtmp: improve error message * rtmp: replace h264 config implementation * link against github.com/notedit/rtmp * normalize MessageStreamID * rtmp: make acknowledge optional * rtmp: fix decoding of chunk2 + chunk3 * avoid using encoding/binary
This commit is contained in:
@@ -141,9 +141,9 @@ func TestRTMPServerAuth(t *testing.T) {
|
||||
nconn, err := net.Dial("tcp", u.Host)
|
||||
require.NoError(t, err)
|
||||
defer nconn.Close()
|
||||
conn := rtmp.NewClientConn(nconn, u)
|
||||
conn := rtmp.NewConn(nconn)
|
||||
|
||||
err = conn.ClientHandshake(true)
|
||||
err = conn.InitializeClient(u, true)
|
||||
require.NoError(t, err)
|
||||
|
||||
_, _, err = conn.ReadTracks()
|
||||
@@ -229,9 +229,17 @@ func TestRTMPServerAuthFail(t *testing.T) {
|
||||
nconn, err := net.Dial("tcp", u.Host)
|
||||
require.NoError(t, err)
|
||||
defer nconn.Close()
|
||||
conn := rtmp.NewClientConn(nconn, u)
|
||||
conn := rtmp.NewConn(nconn)
|
||||
|
||||
err = conn.ClientHandshake(true)
|
||||
err = conn.InitializeClient(u, true)
|
||||
require.NoError(t, err)
|
||||
|
||||
for i := 0; i < 3; i++ {
|
||||
_, err := conn.ReadMessage()
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
_, err = conn.ReadMessage()
|
||||
require.Equal(t, err, io.EOF)
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user