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 }