From f6e23abbaff9e28fd5119b4cb18c7258f09be1a0 Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Thu, 17 Aug 2023 13:28:00 +0500 Subject: [PATCH] msg stream id little-endian fix --- rtmp/chunk.go | 2 +- rtmp/chunk2.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rtmp/chunk.go b/rtmp/chunk.go index 98fb87a..4b72a75 100644 --- a/rtmp/chunk.go +++ b/rtmp/chunk.go @@ -85,7 +85,7 @@ func read_msg_streamid(conn net.Conn, chunk_bufs_ptr *ChunkBuffers) (msg_streami if _, err = conn.Read(chunk_bufs_ptr.msg_streamid); err != nil { return } - msg_streamid = binary.BigEndian.Uint32(chunk_bufs_ptr.msg_streamid) + msg_streamid = binary.LittleEndian.Uint32(chunk_bufs_ptr.msg_streamid) return } diff --git a/rtmp/chunk2.go b/rtmp/chunk2.go index 99b2b14..513b9fd 100644 --- a/rtmp/chunk2.go +++ b/rtmp/chunk2.go @@ -23,7 +23,7 @@ func write_message_header_0(chunk_buffer *[]byte, msg_strmid uint32, msg_ptr *Me binary.BigEndian.PutUint32(msg_len_inter, msg_ptr.msg_len) copy((*chunk_buffer)[basic_header_size + 3:basic_header_size + 6], msg_len_inter[1:]) (*chunk_buffer)[basic_header_size + 6] = msg_ptr.msg_type - binary.BigEndian.PutUint32((*chunk_buffer)[basic_header_size + 7:basic_header_size + 11], msg_strmid) + binary.LittleEndian.PutUint32((*chunk_buffer)[basic_header_size + 7:basic_header_size + 11], msg_strmid) } func write_chunk_data(chunk_buffer *[]byte, data []byte, bytes_buffered *uint32, chunk_data_size uint32, header_size uint32) {