Log config when debug-level

This commit is contained in:
2021-09-19 05:49:23 +02:00
parent bc02653473
commit 66aea2f30b
4 changed files with 31 additions and 19 deletions

View File

@@ -369,25 +369,25 @@ type StreamInfo struct {
Path string
}
func (s *RTMPServer) List() []*StreamInfo {
func (rs *RTMPServer) List() []*StreamInfo {
var results []*StreamInfo
_, port, _ := net.SplitHostPort(s.ListenAddr)
_, port, _ := net.SplitHostPort(rs.ListenAddr)
for _, stream := range s.streams {
results = append(results, &StreamInfo{Name: stream.Name, Path: fmt.Sprintf("rtmp://%s:%s/view/%s", s.Hostname, port, stream.Name)})
for _, stream := range rs.streams {
results = append(results, &StreamInfo{Name: stream.Name, Path: fmt.Sprintf("rtmp://%s:%s/view/%s", rs.Hostname, port, stream.Name)})
}
return results
}
func (s *RTMPServer) GetInfo(name string) (*StreamInfo, error) {
stream, ok := s.streams[name]
func (rs *RTMPServer) GetInfo(name string) (*StreamInfo, error) {
stream, ok := rs.streams[name]
if !ok {
return nil, ErrNoSuchItem
}
_, port, _ := net.SplitHostPort(s.ListenAddr)
_, port, _ := net.SplitHostPort(rs.ListenAddr)
return &StreamInfo{
Name: stream.Name,
Path: fmt.Sprintf("rtmp://%s:%s/view/%s", s.Hostname, port, stream.Name),
Path: fmt.Sprintf("rtmp://%s:%s/view/%s", rs.Hostname, port, stream.Name),
}, nil
}