mirror of
https://github.com/aler9/rtsp-simple-server
synced 2025-10-06 16:17:59 +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:
@@ -17,7 +17,7 @@ type Chunk2 struct {
|
||||
// Read reads the chunk.
|
||||
func (c *Chunk2) Read(r io.Reader, chunkBodyLen uint32) error {
|
||||
header := make([]byte, 4)
|
||||
_, err := r.Read(header)
|
||||
_, err := io.ReadFull(r, header)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -26,7 +26,7 @@ func (c *Chunk2) Read(r io.Reader, chunkBodyLen uint32) error {
|
||||
c.TimestampDelta = uint32(header[1])<<16 | uint32(header[2])<<8 | uint32(header[3])
|
||||
|
||||
c.Body = make([]byte, chunkBodyLen)
|
||||
_, err = r.Read(c.Body)
|
||||
_, err = io.ReadFull(r, c.Body)
|
||||
return err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user