stream-server/rtmp/data_loop.go

27 lines
450 B
Go
Raw Normal View History

2023-08-17 16:35:06 +05:00
package rtmp
import (
"fmt"
"stream_server/rtmp/flv"
2023-08-17 16:35:06 +05:00
)
func HandleDataLoop(chnk_wrp_ptr *ChunkWrapper) {
file_writer, err := flv.NewFLVWriter(chnk_wrp_ptr.params.stream_key)
defer file_writer.Close()
if err != nil {
return
}
if err = chnk_wrp_ptr.ReadMetadata(file_writer); err != nil {
return
}
2023-08-17 16:35:06 +05:00
for {
p, err := chnk_wrp_ptr.ReadChunk()
if err != nil {
return
}
if p != nil {
fmt.Println(p.msg_type, p.msg_len)
}
}
}