From 48029e0ee6dda3b6847c53ba6cecef5e9d224d2f Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Thu, 10 Aug 2023 13:24:06 +0500 Subject: [PATCH] chunk format 3 handling --- rtmp/chunk.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rtmp/chunk.go b/rtmp/chunk.go index 7b806ab..f22c80f 100644 --- a/rtmp/chunk.go +++ b/rtmp/chunk.go @@ -212,8 +212,6 @@ func read_message_header_2(conn net.Conn, chnk_stream_ptr *chnk_stream, msg_ptr return nil } - - func read_chunk_data(conn net.Conn, msg_ptr *message, chnk_size uint32) (error) { bytes_left := msg_ptr.msg_len - msg_ptr.curr_bytes_read var buffer_end uint32 @@ -265,6 +263,9 @@ func ReadChunk(conn net.Conn, open_chnkstrms map[uint32]*chnk_stream, open_msgs if err := read_message_header_2(conn, chnkstream_ptr, msg_ptr, chunk_bufs_ptr); err != nil { return nil, err } + case 3: + chnkstream_ptr = open_chnkstrms[csid] + msg_ptr = open_msgs[chnkstream_ptr.last_msg_strm_id] } @@ -272,6 +273,8 @@ func ReadChunk(conn net.Conn, open_chnkstrms map[uint32]*chnk_stream, open_msgs return nil, err } + conn.SetDeadline(time.Time{}) + if msg_ptr.curr_bytes_read < msg_ptr.msg_len { open_msgs[chnkstream_ptr.last_msg_strm_id] = msg_ptr return nil, nil @@ -279,7 +282,4 @@ func ReadChunk(conn net.Conn, open_chnkstrms map[uint32]*chnk_stream, open_msgs delete(open_msgs, chnkstream_ptr.last_msg_strm_id) return msg_ptr, nil } - - conn.SetDeadline(time.Time{}) - return nil, nil }