Skip to content

Commit

Permalink
Opt: del channle name
Browse files Browse the repository at this point in the history
  • Loading branch information
zijiren233 committed Oct 19, 2023
1 parent b4de437 commit c0062f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
7 changes: 2 additions & 5 deletions server/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
)

type Channel struct {
channelName string
inPublication uint32
players rwmap.RWMap[av.WriteCloser, *packWriter]

Expand All @@ -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)
}
Expand Down

0 comments on commit c0062f0

Please sign in to comment.