fix: wite MessageStreamID in littleEndian

This commit is contained in:
langhuihui
2023-08-17 19:35:43 +08:00
parent 44522009fb
commit 91af4e990e
2 changed files with 7 additions and 2 deletions
+3 -1
View File
@@ -1,6 +1,8 @@
package rtmp
import (
"encoding/binary"
"m7s.live/engine/v4/util"
)
@@ -70,7 +72,7 @@ func (h *ChunkHeader) WriteTo(t byte, b *util.Buffer) {
b.WriteUint24(h.MessageLength)
b.WriteByte(h.MessageTypeID)
if t < RTMP_CHUNK_HEAD_8 {
b.WriteUint32(h.MessageStreamID)
binary.LittleEndian.PutUint32(b.Malloc(4), h.MessageStreamID)
}
}
}
+4 -1
View File
@@ -3,6 +3,7 @@ package rtmp
import (
"crypto/tls"
"errors"
"fmt"
"net"
"net/url"
"strings"
@@ -92,6 +93,8 @@ func NewRTMPClient(addr string) (client *NetConnection, err error) {
} else {
return nil, err
}
default:
fmt.Println(cmd.CommandName)
}
}
}
@@ -197,7 +200,7 @@ func (puller *RTMPPuller) Pull() (err error) {
puller.StreamID = response.StreamId
m := &PlayMessage{}
m.StreamId = response.StreamId
m.TransactionId = 1
m.TransactionId = 4
m.CommandMessage.CommandName = "play"
URL, _ := url.Parse(puller.RemoteURL)
ps := strings.Split(URL.Path, "/")