rtmp: add new AMF0 encoder and encoder (#3069)

This improves performance, security and removes a dependency.
This commit is contained in:
Alessandro Ros
2024-02-24 19:11:42 +01:00
committed by GitHub
parent e06155b9b0
commit da7c5744b1
56 changed files with 1159 additions and 321 deletions

View File

@@ -14,8 +14,7 @@ type ExtendedSequenceStart struct {
Config []byte
}
// Unmarshal implements Message.
func (m *ExtendedSequenceStart) Unmarshal(raw *rawmessage.Message) error {
func (m *ExtendedSequenceStart) unmarshal(raw *rawmessage.Message) error {
if len(raw.Body) < 6 {
return fmt.Errorf("not enough bytes")
}
@@ -32,8 +31,7 @@ func (m ExtendedSequenceStart) marshalBodySize() int {
return 5 + len(m.Config)
}
// Marshal implements Message.
func (m ExtendedSequenceStart) Marshal() (*rawmessage.Message, error) {
func (m ExtendedSequenceStart) marshal() (*rawmessage.Message, error) {
body := make([]byte, m.marshalBodySize())
body[0] = 0b10000000 | byte(ExtendedTypeSequenceStart)