From c0062f0f285f9c1824ab8e6065c97f9fbb5719b3 Mon Sep 17 00:00:00 2001 From: zijiren233 Date: Thu, 19 Oct 2023 17:00:56 +0800 Subject: [PATCH] Opt: del channle name --- cmd/server.go | 2 +- server/channel.go | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/cmd/server.go b/cmd/server.go index c2d8728..541c82b 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -38,7 +38,7 @@ func Server(cmd *cobra.Command, args []string) { tcp := muxer.Match(cmux.Any()) channels := rwmap.RWMap[string, *server.Channel]{} s := server.NewRtmpServer(func(ReqAppName, ReqChannelName string, IsPublisher bool) (*server.Channel, error) { - c, _ := channels.LoadOrStore(ReqAppName, server.NewChannel(ReqAppName)) + c, _ := channels.LoadOrStore(ReqAppName, server.NewChannel()) c.InitHlsPlayer() return c, nil }) diff --git a/server/channel.go b/server/channel.go index 42e0705..97adbbe 100644 --- a/server/channel.go +++ b/server/channel.go @@ -14,7 +14,6 @@ import ( ) type Channel struct { - channelName string inPublication uint32 players rwmap.RWMap[av.WriteCloser, *packWriter] @@ -27,10 +26,8 @@ type Channel struct { type ChannelConf func(*Channel) -func NewChannel(channelName string, conf ...ChannelConf) *Channel { - ch := &Channel{ - channelName: channelName, - } +func NewChannel(conf ...ChannelConf) *Channel { + ch := &Channel{} for _, c := range conf { c(ch) }