mirror of
https://github.com/lkmio/lkm.git
synced 2025-11-02 11:24:11 +08:00
测试合并写
This commit is contained in:
28
main.go
28
main.go
@@ -1,13 +1,20 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net"
|
||||
"net/http"
|
||||
|
||||
_ "net/http/pprof"
|
||||
|
||||
"github.com/yangjiechina/avformat/librtmp"
|
||||
"github.com/yangjiechina/avformat/utils"
|
||||
"github.com/yangjiechina/live-server/rtmp"
|
||||
"github.com/yangjiechina/live-server/stream"
|
||||
)
|
||||
|
||||
func CreateTransStream(protocol stream.Protocol, streams []utils.AVStream) stream.ITransStream {
|
||||
if stream.ProtocolRtmp == protocol {
|
||||
|
||||
return rtmp.NewTransStream(librtmp.ChunkSize)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -18,5 +25,24 @@ func init() {
|
||||
}
|
||||
|
||||
func main() {
|
||||
stream.AppConfig.GOPCache = 2
|
||||
impl := rtmp.NewServer()
|
||||
addr := "0.0.0.0:1935"
|
||||
tcpAddr, err := net.ResolveTCPAddr("tcp", addr)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = impl.Start(tcpAddr)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
println("启动rtmp服务成功:" + addr)
|
||||
|
||||
loadConfigError := http.ListenAndServe(":19999", nil)
|
||||
if loadConfigError != nil {
|
||||
panic(loadConfigError)
|
||||
}
|
||||
select {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user