mirror of
https://github.com/xaionaro-go/streamctl.git
synced 2025-10-26 17:10:29 +08:00
39 lines
962 B
Go
39 lines
962 B
Go
package yutoppgortmp
|
|
|
|
import (
|
|
"net"
|
|
"sync/atomic"
|
|
|
|
"github.com/xaionaro-go/go-rtmp"
|
|
"github.com/xaionaro-go/streamctl/pkg/streamserver/types/streamportserver"
|
|
"github.com/xaionaro-go/streamctl/pkg/streamtypes"
|
|
)
|
|
|
|
type PortServer struct {
|
|
*rtmp.Server
|
|
Listener net.Listener
|
|
ReadCount uint64
|
|
WriteCount uint64
|
|
}
|
|
|
|
var _ streamportserver.Server = (*PortServer)(nil)
|
|
|
|
func (srv *PortServer) Close() error {
|
|
return srv.Server.Close()
|
|
}
|
|
func (srv *PortServer) Type() streamtypes.ServerType {
|
|
return streamtypes.ServerTypeRTMP
|
|
}
|
|
func (srv *PortServer) ListenAddr() string {
|
|
return srv.Listener.Addr().String()
|
|
}
|
|
func (srv *PortServer) NumBytesConsumerWrote() uint64 {
|
|
return atomic.LoadUint64(&srv.WriteCount)
|
|
}
|
|
func (srv *PortServer) NumBytesProducerRead() uint64 {
|
|
return atomic.LoadUint64(&srv.ReadCount)
|
|
}
|
|
func (srv *PortServer) ProtocolSpecificConfig() streamportserver.ProtocolSpecificConfig {
|
|
return streamportserver.ProtocolSpecificConfig{}
|
|
}
|