From a38fbea91165b3da10b765682a67502bbb66e49e Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Tue, 15 Aug 2023 15:29:46 +0500 Subject: [PATCH] Basic create stream handle, void releasestream and fcpublish calls since no doc, and only going to accept stream data anyway --- rtmp/connect.go | 13 +++++++++++++ rtmp/server.go | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/rtmp/connect.go b/rtmp/connect.go index e5a0629..0e89b3c 100644 --- a/rtmp/connect.go +++ b/rtmp/connect.go @@ -1,5 +1,6 @@ package rtmp +import "fmt" func NegotiateConnect(chnk_wrp_ptr *ChunkWrapper) (bool) { if err := chnk_wrp_ptr.ReadPeerChunkSize(); err != nil { @@ -22,3 +23,15 @@ func NegotiateConnect(chnk_wrp_ptr *ChunkWrapper) (bool) { } return true } + +func CreateStream(chnk_wrp_ptr *ChunkWrapper) (bool) { + if _, err := chnk_wrp_ptr.ReadChunk(); err != nil { + return false + } + if _, err := chnk_wrp_ptr.ReadChunk(); err != nil { + return false + } + full_msg_ptr, _ := chnk_wrp_ptr.ReadChunk() + fmt.Println(full_msg_ptr) + return true +} diff --git a/rtmp/server.go b/rtmp/server.go index 702a7e2..dd0e02b 100644 --- a/rtmp/server.go +++ b/rtmp/server.go @@ -45,6 +45,8 @@ func handle_conn(conn net.Conn, stream_live *bool) { if !NegotiateConnect(chunk_wrapper) { return } - + if !CreateStream(chunk_wrapper) { + return + } *stream_live = false }