From b0239ed761615b3abec6d9c40b8a051b4bf1ebfc Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Tue, 15 Aug 2023 15:55:11 +0500 Subject: [PATCH] Fix format 3 handling for new messages with the same delta and other params --- rtmp/chunk.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rtmp/chunk.go b/rtmp/chunk.go index 5aa483a..98fb87a 100644 --- a/rtmp/chunk.go +++ b/rtmp/chunk.go @@ -265,7 +265,18 @@ func ReadChunk(conn net.Conn, open_chnkstrms map[uint32]*ChunkStream, open_msgs } case 3: chnkstream_ptr = open_chnkstrms[csid] - msg_ptr = open_msgs[chnkstream_ptr.last_msg_strm_id] + msg_prev, ok := open_msgs[chnkstream_ptr.last_msg_strm_id] + if !ok { + msg_ptr = new(Message) + msg_ptr.msg_type = chnkstream_ptr.last_msg_type + msg_ptr.msg_len = chnkstream_ptr.last_msg_len + msg_ptr.data = make([]byte, msg_ptr.msg_len) + + chnkstream_ptr.timestamp += chnkstream_ptr.timedelta + msg_ptr.timestamp = chnkstream_ptr.timestamp + } else { + msg_ptr = msg_prev + } } n, err := read_chunk_data(conn, msg_ptr, chnk_size)