From 050e8b104f6d5f0b3d2202c940c9ebade9feff63 Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Thu, 17 Aug 2023 16:35:06 +0500 Subject: [PATCH] basic data loop handle (placeholder) --- rtmp/connect.go | 3 --- rtmp/data_loop.go | 17 +++++++++++++++++ rtmp/server.go | 1 + 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 rtmp/data_loop.go diff --git a/rtmp/connect.go b/rtmp/connect.go index d60018f..834efdf 100644 --- a/rtmp/connect.go +++ b/rtmp/connect.go @@ -1,7 +1,6 @@ package rtmp import ( - "fmt" "os" ) @@ -53,8 +52,6 @@ func PublishAsKey(chnk_wrp_ptr *ChunkWrapper) (bool) { if err := chnk_wrp_ptr.WritePublishResponse(); err != nil { return false } - p, _ := chnk_wrp_ptr.ReadChunk() - fmt.Println(p) return true } diff --git a/rtmp/data_loop.go b/rtmp/data_loop.go new file mode 100644 index 0000000..56c095d --- /dev/null +++ b/rtmp/data_loop.go @@ -0,0 +1,17 @@ +package rtmp + +import ( + "fmt" +) + +func HandleDataLoop(chnk_wrp_ptr *ChunkWrapper) { + for { + p, err := chnk_wrp_ptr.ReadChunk() + if err != nil { + return + } + if p != nil { + fmt.Println(p.msg_type, p.msg_len) + } + } +} diff --git a/rtmp/server.go b/rtmp/server.go index 89df686..ef2885d 100644 --- a/rtmp/server.go +++ b/rtmp/server.go @@ -52,5 +52,6 @@ func handle_conn(conn net.Conn, stream_live *bool) { if !PublishAsKey(chunk_wrapper) { return } + HandleDataLoop(chunk_wrapper) *stream_live = false }