Documentation ¶
Index ¶
- Variables
- func SimpleAuthCalcSecret(key string, streamName string) string
- type CommonHttpAddrConfig
- type CommonHttpServerConfig
- type ComplexGroupManager
- func (gm *ComplexGroupManager) GetGroup(appName string, streamName string) *Group
- func (gm *ComplexGroupManager) GetOrCreateGroup(appName string, streamName string) (group *Group, createFlag bool)
- func (gm *ComplexGroupManager) Iterate(onIterateGroup func(group *Group) bool)
- func (gm *ComplexGroupManager) Len() int
- type Config
- type CustomizePubSessionContext
- func (ctx *CustomizePubSessionContext) FeedAudioSpecificConfig(asc []byte)
- func (ctx *CustomizePubSessionContext) FeedAvPacket(packet base.AvPacket)
- func (ctx *CustomizePubSessionContext) StreamName() string
- func (ctx *CustomizePubSessionContext) UniqueKey() string
- func (ctx *CustomizePubSessionContext) WithOnRtmpMsg(onRtmpMsg func(msg base.RtmpMsg)) *CustomizePubSessionContext
- func (ctx *CustomizePubSessionContext) WithOption(modOption func(option *base.AvPacketStreamOption))
- type DebugConfig
- type DefaultHttpConfig
- type Group
- func (group *Group) AddCustomizePubSession(streamName string) (ICustomizePubSessionContext, error)
- func (group *Group) AddHttpflvSubSession(session *httpflv.SubSession)
- func (group *Group) AddHttptsSubSession(session *httpts.SubSession)
- func (group *Group) AddRtmpPubSession(session *rtmp.ServerSession) error
- func (group *Group) AddRtmpPullSession(session *rtmp.PullSession) error
- func (group *Group) AddRtmpPushSession(url string, session *rtmp.PushSession)
- func (group *Group) AddRtmpSubSession(session *rtmp.ServerSession)
- func (group *Group) AddRtspPubSession(session *rtsp.PubSession) error
- func (group *Group) AddRtspPullSession(session *rtsp.PullSession) error
- func (group *Group) DelCustomizePubSession(sessionCtx ICustomizePubSessionContext)
- func (group *Group) DelHttpflvSubSession(session *httpflv.SubSession)
- func (group *Group) DelHttptsSubSession(session *httpts.SubSession)
- func (group *Group) DelRtmpPubSession(session *rtmp.ServerSession)
- func (group *Group) DelRtmpPullSession(session *rtmp.PullSession)
- func (group *Group) DelRtmpPushSession(url string, session *rtmp.PushSession)
- func (group *Group) DelRtmpSubSession(session *rtmp.ServerSession)
- func (group *Group) DelRtspPubSession(session *rtsp.PubSession)
- func (group *Group) DelRtspPullSession(session *rtsp.PullSession)
- func (group *Group) DelRtspSubSession(session *rtsp.SubSession)
- func (group *Group) Dispose()
- func (group *Group) GetStat(maxsub int) base.StatGroup
- func (group *Group) HandleNewRtspSubSessionDescribe(session *rtsp.SubSession) (ok bool, sdp []byte)
- func (group *Group) HandleNewRtspSubSessionPlay(session *rtsp.SubSession)
- func (group *Group) HasInSession() bool
- func (group *Group) HasOutSession() bool
- func (group *Group) IsHlsMuxerAlive() bool
- func (group *Group) IsInactive() bool
- func (group *Group) KickSession(sessionId string) bool
- func (group *Group) OnAvPacket(pkt base.AvPacket)
- func (group *Group) OnFragmentOpen()
- func (group *Group) OnHlsMakeTs(info base.HlsMakeTsInfo)
- func (group *Group) OnPatPmt(b []byte)
- func (group *Group) OnReadRtmpAvMsg(msg base.RtmpMsg)
- func (group *Group) OnRtpPacket(pkt rtprtcp.RtpPacket)
- func (group *Group) OnSdp(sdpCtx sdp.LogicContext)
- func (group *Group) OnTsPackets(tsPackets []byte, frame *mpegts.Frame, boundary bool)
- func (group *Group) OutSessionNum() int
- func (group *Group) RunLoop()
- func (group *Group) StartPull(info base.ApiCtrlStartRelayPullReq) (string, error)
- func (group *Group) StopPull() string
- func (group *Group) StringifyDebugStats(maxsub int) string
- func (group *Group) Tick(tickCount uint32)
- type HlsConfig
- type HttpApiConfig
- type HttpApiServer
- type HttpNotify
- func (h *HttpNotify) NotifyOnHlsMakeTs(info base.HlsMakeTsInfo)
- func (h *HttpNotify) NotifyPubStart(info base.PubStartInfo)
- func (h *HttpNotify) NotifyPubStop(info base.PubStopInfo)
- func (h *HttpNotify) NotifyPullStart(info base.PullStartInfo)
- func (h *HttpNotify) NotifyPullStop(info base.PullStopInfo)
- func (h *HttpNotify) NotifyRtmpConnect(info base.RtmpConnectInfo)
- func (h *HttpNotify) NotifyServerStart(info base.LalInfo)
- func (h *HttpNotify) NotifySubStart(info base.SubStartInfo)
- func (h *HttpNotify) NotifySubStop(info base.SubStopInfo)
- func (h *HttpNotify) NotifyUpdate(info base.UpdateInfo)
- func (h *HttpNotify) OnHlsMakeTs(info base.HlsMakeTsInfo)
- func (h *HttpNotify) OnPubStart(info base.PubStartInfo)
- func (h *HttpNotify) OnPubStop(info base.PubStopInfo)
- func (h *HttpNotify) OnRelayPullStart(info base.PullStartInfo)
- func (h *HttpNotify) OnRelayPullStop(info base.PullStopInfo)
- func (h *HttpNotify) OnRtmpConnect(info base.RtmpConnectInfo)
- func (h *HttpNotify) OnServerStart(info base.LalInfo)
- func (h *HttpNotify) OnSubStart(info base.SubStartInfo)
- func (h *HttpNotify) OnSubStop(info base.SubStopInfo)
- func (h *HttpNotify) OnUpdate(info base.UpdateInfo)
- func (h *HttpNotify) RunLoop()
- type HttpNotifyConfig
- type HttpServerHandler
- type HttpflvConfig
- type HttptsConfig
- type ICustomizePubSessionContext
- type IGroupCreator
- type IGroupManager
- type IGroupObserver
- type IHttpServerHandlerObserver
- type ILalServer
- type INotifyHandler
- type ModOption
- type Option
- type PostTask
- type PprofConfig
- type RecordConfig
- type RelayPushConfig
- type RtmpConfig
- type RtspConfig
- type ServerManager
- func (sm *ServerManager) AddCustomizePubSession(streamName string) (ICustomizePubSessionContext, error)
- func (sm *ServerManager) CleanupHlsIfNeeded(appName string, streamName string, path string)
- func (sm *ServerManager) Config() *Config
- func (sm *ServerManager) CreateGroup(appName string, streamName string) *Group
- func (sm *ServerManager) CtrlKickSession(info base.ApiCtrlKickSessionReq) (ret base.HttpResponseBasic)
- func (sm *ServerManager) CtrlStartRelayPull(info base.ApiCtrlStartRelayPullReq) (ret base.ApiCtrlStartRelayPull)
- func (sm *ServerManager) CtrlStartRtpPub(info base.ApiCtrlStartRtpPubReq) (ret base.ApiCtrlStartRtpPub)
- func (sm *ServerManager) CtrlStopRelayPull(streamName string) (ret base.ApiCtrlStopRelayPull)
- func (sm *ServerManager) DelCustomizePubSession(sessionCtx ICustomizePubSessionContext)
- func (sm *ServerManager) Dispose()
- func (sm *ServerManager) GetGroup(appName string, streamName string) *Group
- func (sm *ServerManager) OnDelHttpflvSubSession(session *httpflv.SubSession)
- func (sm *ServerManager) OnDelHttptsSubSession(session *httpts.SubSession)
- func (sm *ServerManager) OnDelRtmpPubSession(session *rtmp.ServerSession)
- func (sm *ServerManager) OnDelRtmpSubSession(session *rtmp.ServerSession)
- func (sm *ServerManager) OnDelRtspPubSession(session *rtsp.PubSession)
- func (sm *ServerManager) OnDelRtspSession(session *rtsp.ServerCommandSession)
- func (sm *ServerManager) OnDelRtspSubSession(session *rtsp.SubSession)
- func (sm *ServerManager) OnHlsMakeTs(info base.HlsMakeTsInfo)
- func (sm *ServerManager) OnNewHttpflvSubSession(session *httpflv.SubSession) error
- func (sm *ServerManager) OnNewHttptsSubSession(session *httpts.SubSession) error
- func (sm *ServerManager) OnNewRtmpPubSession(session *rtmp.ServerSession) error
- func (sm *ServerManager) OnNewRtmpSubSession(session *rtmp.ServerSession) error
- func (sm *ServerManager) OnNewRtspPubSession(session *rtsp.PubSession) error
- func (sm *ServerManager) OnNewRtspSessionConnect(session *rtsp.ServerCommandSession)
- func (sm *ServerManager) OnNewRtspSubSessionDescribe(session *rtsp.SubSession) (ok bool, sdp []byte)
- func (sm *ServerManager) OnNewRtspSubSessionPlay(session *rtsp.SubSession) error
- func (sm *ServerManager) OnRelayPullStart(info base.PullStartInfo)
- func (sm *ServerManager) OnRelayPullStop(info base.PullStopInfo)
- func (sm *ServerManager) OnRtmpConnect(session *rtmp.ServerSession, opa rtmp.ObjectPairArray)
- func (sm *ServerManager) RunLoop() error
- func (sm *ServerManager) StatAllGroup() (sgs []base.StatGroup)
- func (sm *ServerManager) StatGroup(streamName string) *base.StatGroup
- func (sm *ServerManager) StatLalInfo() base.LalInfo
- type SimpleAuthConfig
- type SimpleAuthCtx
- type SimpleGroupManager
- func (s *SimpleGroupManager) GetGroup(appName string, streamName string) *Group
- func (s *SimpleGroupManager) GetOrCreateGroup(appName string, streamName string) (group *Group, createFlag bool)
- func (s *SimpleGroupManager) Iterate(onIterateGroup func(group *Group) bool)
- func (s *SimpleGroupManager) Len() int
- type StaticRelayPullConfig
Constants ¶
This section is empty.
Variables ¶
var DefaultConfFilenameList = []string{ filepath.FromSlash("lalserver.conf.json"), filepath.FromSlash("./conf/lalserver.conf.json"), filepath.FromSlash("../lalserver.conf.json"), filepath.FromSlash("../conf/lalserver.conf.json"), filepath.FromSlash("../../lalserver.conf.json"), filepath.FromSlash("../../conf/lalserver.conf.json"), filepath.FromSlash("../../../lalserver.conf.json"), filepath.FromSlash("../../../conf/lalserver.conf.json"), filepath.FromSlash("lal/conf/lalserver.conf.json"), }
DefaultConfFilenameList 没有指定配置文件时,按顺序作为优先级,找到第一个存在的并使用
var Log = nazalog.GetGlobalLogger()
Functions ¶
func SimpleAuthCalcSecret ¶
Types ¶
type CommonHttpAddrConfig ¶
type CommonHttpServerConfig ¶
type CommonHttpServerConfig struct { CommonHttpAddrConfig Enable bool `json:"enable"` EnableHttps bool `json:"enable_https"` UrlPattern string `json:"url_pattern"` }
type ComplexGroupManager ¶
type ComplexGroupManager struct {
// contains filtered or unexported fields
}
ComplexGroupManager
注意,这个模块的功能不完全,目前只使用SimpleGroupManager
TODO(chef):
- 现有逻辑重构至当前模块中【DONE】 - server_manger接入当前模块,替换掉原来的map【DONE】 - 重构整理使用server_manager的地方【DONE】 - 实现appName逻辑的IGroupManager【DONE】 - 增加单元测试【DONE】 - 配置文件或var.go中增加选取具体IGroupManager实现的开关 - 去除配置文件中一部分的url_pattern - 更新相应的文档:本文件注释,server_manager等中原有关于appName的注释,配置文件文档,流地址列表文档 - 创建group时没有appname,后面又有了,可以考虑更新一下 - ComplexGroupManager使用IGroupCreator
---------------------------------------------------------------------------------------------------------------------
背景:
有的协议需要结合appName和streamName作为流唯一标识(比如rtmp,httpflv,httpts) 有的协议不需要appName,只使用streamName作为流唯一标识(比如rtsp?)
目标:
有appName的协议,需要参考appName 没appName的协议,需要和有appName的协议互通
注意:
- 当以上两种类型的协议混用时,系统使用者应避免第二种协议的streamName,在第一种协议中存在相同的streamName,但是appName不止一个 这种情况下,内部无法知道该如何对应
- group可能由第一种协议创建,也可能由第二种协议创建
func NewComplexGroupManager ¶
func NewComplexGroupManager(groupCreator IGroupCreator) *ComplexGroupManager
func (*ComplexGroupManager) GetGroup ¶
func (gm *ComplexGroupManager) GetGroup(appName string, streamName string) *Group
func (*ComplexGroupManager) GetOrCreateGroup ¶
func (gm *ComplexGroupManager) GetOrCreateGroup(appName string, streamName string) (group *Group, createFlag bool)
func (*ComplexGroupManager) Iterate ¶
func (gm *ComplexGroupManager) Iterate(onIterateGroup func(group *Group) bool)
func (*ComplexGroupManager) Len ¶
func (gm *ComplexGroupManager) Len() int
type Config ¶
type Config struct { ConfVersion string `json:"conf_version"` RtmpConfig RtmpConfig `json:"rtmp"` DefaultHttpConfig DefaultHttpConfig `json:"default_http"` HttpflvConfig HttpflvConfig `json:"httpflv"` HlsConfig HlsConfig `json:"hls"` HttptsConfig HttptsConfig `json:"httpts"` RtspConfig RtspConfig `json:"rtsp"` RecordConfig RecordConfig `json:"record"` RelayPushConfig RelayPushConfig `json:"relay_push"` StaticRelayPullConfig StaticRelayPullConfig `json:"static_relay_pull"` HttpApiConfig HttpApiConfig `json:"http_api"` ServerId string `json:"server_id"` HttpNotifyConfig HttpNotifyConfig `json:"http_notify"` SimpleAuthConfig SimpleAuthConfig `json:"simple_auth"` PprofConfig PprofConfig `json:"pprof"` LogConfig nazalog.Option `json:"log"` DebugConfig DebugConfig `json:"debug"` }
func LoadConfAndInitLog ¶
type CustomizePubSessionContext ¶
type CustomizePubSessionContext struct {
// contains filtered or unexported fields
}
func NewCustomizePubSessionContext ¶
func NewCustomizePubSessionContext(streamName string) *CustomizePubSessionContext
func (*CustomizePubSessionContext) FeedAudioSpecificConfig ¶
func (ctx *CustomizePubSessionContext) FeedAudioSpecificConfig(asc []byte)
func (*CustomizePubSessionContext) FeedAvPacket ¶
func (ctx *CustomizePubSessionContext) FeedAvPacket(packet base.AvPacket)
func (*CustomizePubSessionContext) StreamName ¶
func (ctx *CustomizePubSessionContext) StreamName() string
func (*CustomizePubSessionContext) UniqueKey ¶
func (ctx *CustomizePubSessionContext) UniqueKey() string
func (*CustomizePubSessionContext) WithOnRtmpMsg ¶
func (ctx *CustomizePubSessionContext) WithOnRtmpMsg(onRtmpMsg func(msg base.RtmpMsg)) *CustomizePubSessionContext
func (*CustomizePubSessionContext) WithOption ¶
func (ctx *CustomizePubSessionContext) WithOption(modOption func(option *base.AvPacketStreamOption))
type DebugConfig ¶
type DefaultHttpConfig ¶
type DefaultHttpConfig struct {
CommonHttpAddrConfig
}
type Group ¶
type Group struct { UniqueKey string // const after init // contains filtered or unexported fields }
func NewGroup ¶
func NewGroup(appName string, streamName string, config *Config, observer IGroupObserver) *Group
func (*Group) AddCustomizePubSession ¶
func (group *Group) AddCustomizePubSession(streamName string) (ICustomizePubSessionContext, error)
func (*Group) AddHttpflvSubSession ¶
func (group *Group) AddHttpflvSubSession(session *httpflv.SubSession)
func (*Group) AddHttptsSubSession ¶
func (group *Group) AddHttptsSubSession(session *httpts.SubSession)
AddHttptsSubSession ...
func (*Group) AddRtmpPubSession ¶
func (group *Group) AddRtmpPubSession(session *rtmp.ServerSession) error
func (*Group) AddRtmpPullSession ¶
func (group *Group) AddRtmpPullSession(session *rtmp.PullSession) error
func (*Group) AddRtmpPushSession ¶
func (group *Group) AddRtmpPushSession(url string, session *rtmp.PushSession)
func (*Group) AddRtmpSubSession ¶
func (group *Group) AddRtmpSubSession(session *rtmp.ServerSession)
func (*Group) AddRtspPubSession ¶
func (group *Group) AddRtspPubSession(session *rtsp.PubSession) error
AddRtspPubSession TODO chef: rtsp package中,增加回调返回值判断,如果是false,将连接关掉
func (*Group) AddRtspPullSession ¶
func (group *Group) AddRtspPullSession(session *rtsp.PullSession) error
func (*Group) DelCustomizePubSession ¶
func (group *Group) DelCustomizePubSession(sessionCtx ICustomizePubSessionContext)
func (*Group) DelHttpflvSubSession ¶
func (group *Group) DelHttpflvSubSession(session *httpflv.SubSession)
func (*Group) DelHttptsSubSession ¶
func (group *Group) DelHttptsSubSession(session *httpts.SubSession)
func (*Group) DelRtmpPubSession ¶
func (group *Group) DelRtmpPubSession(session *rtmp.ServerSession)
func (*Group) DelRtmpPullSession ¶
func (group *Group) DelRtmpPullSession(session *rtmp.PullSession)
func (*Group) DelRtmpPushSession ¶
func (group *Group) DelRtmpPushSession(url string, session *rtmp.PushSession)
func (*Group) DelRtmpSubSession ¶
func (group *Group) DelRtmpSubSession(session *rtmp.ServerSession)
func (*Group) DelRtspPubSession ¶
func (group *Group) DelRtspPubSession(session *rtsp.PubSession)
func (*Group) DelRtspPullSession ¶
func (group *Group) DelRtspPullSession(session *rtsp.PullSession)
func (*Group) DelRtspSubSession ¶
func (group *Group) DelRtspSubSession(session *rtsp.SubSession)
func (*Group) HandleNewRtspSubSessionDescribe ¶
func (group *Group) HandleNewRtspSubSessionDescribe(session *rtsp.SubSession) (ok bool, sdp []byte)
func (*Group) HandleNewRtspSubSessionPlay ¶
func (group *Group) HandleNewRtspSubSessionPlay(session *rtsp.SubSession)
func (*Group) HasInSession ¶
func (*Group) HasOutSession ¶
func (*Group) IsHlsMuxerAlive ¶
func (*Group) IsInactive ¶
func (*Group) KickSession ¶
func (*Group) OnHlsMakeTs ¶
func (group *Group) OnHlsMakeTs(info base.HlsMakeTsInfo)
func (*Group) OnReadRtmpAvMsg ¶
OnReadRtmpAvMsg
输入rtmp数据. 来自 rtmp.ServerSession(Pub), rtmp.PullSession, CustomizePubSessionContext, (remux.DummyAudioFilter) 的回调.
func (*Group) OnSdp ¶
func (group *Group) OnSdp(sdpCtx sdp.LogicContext)
OnSdp OnRtpPacket OnAvPacket
输入rtsp(rtp)和rtp合帧之后的数据. 来自 rtsp.PubSession 的回调.
func (*Group) OnTsPackets ¶
OnTsPackets ...
func (*Group) OutSessionNum ¶
func (*Group) StartPull ¶
func (group *Group) StartPull(info base.ApiCtrlStartRelayPullReq) (string, error)
StartPull 外部命令主动触发pull拉流
func (*Group) StringifyDebugStats ¶
type HlsConfig ¶
type HlsConfig struct { CommonHttpServerConfig UseMemoryAsDiskFlag bool `json:"use_memory_as_disk_flag"` hls.MuxerConfig }
type HttpApiConfig ¶
type HttpApiServer ¶
type HttpApiServer struct {
// contains filtered or unexported fields
}
func NewHttpApiServer ¶
func NewHttpApiServer(addr string, sm *ServerManager) *HttpApiServer
func (*HttpApiServer) Listen ¶
func (h *HttpApiServer) Listen() (err error)
func (*HttpApiServer) RunLoop ¶
func (h *HttpApiServer) RunLoop() error
type HttpNotify ¶
type HttpNotify struct {
// contains filtered or unexported fields
}
func NewHttpNotify ¶
func NewHttpNotify(cfg HttpNotifyConfig, serverId string) *HttpNotify
func (*HttpNotify) NotifyOnHlsMakeTs ¶
func (h *HttpNotify) NotifyOnHlsMakeTs(info base.HlsMakeTsInfo)
func (*HttpNotify) NotifyPubStart ¶
func (h *HttpNotify) NotifyPubStart(info base.PubStartInfo)
func (*HttpNotify) NotifyPubStop ¶
func (h *HttpNotify) NotifyPubStop(info base.PubStopInfo)
func (*HttpNotify) NotifyPullStart ¶
func (h *HttpNotify) NotifyPullStart(info base.PullStartInfo)
func (*HttpNotify) NotifyPullStop ¶
func (h *HttpNotify) NotifyPullStop(info base.PullStopInfo)
func (*HttpNotify) NotifyRtmpConnect ¶
func (h *HttpNotify) NotifyRtmpConnect(info base.RtmpConnectInfo)
func (*HttpNotify) NotifyServerStart ¶
func (h *HttpNotify) NotifyServerStart(info base.LalInfo)
func (*HttpNotify) NotifySubStart ¶
func (h *HttpNotify) NotifySubStart(info base.SubStartInfo)
func (*HttpNotify) NotifySubStop ¶
func (h *HttpNotify) NotifySubStop(info base.SubStopInfo)
func (*HttpNotify) NotifyUpdate ¶
func (h *HttpNotify) NotifyUpdate(info base.UpdateInfo)
func (*HttpNotify) OnHlsMakeTs ¶
func (h *HttpNotify) OnHlsMakeTs(info base.HlsMakeTsInfo)
func (*HttpNotify) OnPubStart ¶
func (h *HttpNotify) OnPubStart(info base.PubStartInfo)
func (*HttpNotify) OnPubStop ¶
func (h *HttpNotify) OnPubStop(info base.PubStopInfo)
func (*HttpNotify) OnRelayPullStart ¶
func (h *HttpNotify) OnRelayPullStart(info base.PullStartInfo)
func (*HttpNotify) OnRelayPullStop ¶
func (h *HttpNotify) OnRelayPullStop(info base.PullStopInfo)
func (*HttpNotify) OnRtmpConnect ¶
func (h *HttpNotify) OnRtmpConnect(info base.RtmpConnectInfo)
func (*HttpNotify) OnServerStart ¶
func (h *HttpNotify) OnServerStart(info base.LalInfo)
func (*HttpNotify) OnSubStart ¶
func (h *HttpNotify) OnSubStart(info base.SubStartInfo)
func (*HttpNotify) OnSubStop ¶
func (h *HttpNotify) OnSubStop(info base.SubStopInfo)
func (*HttpNotify) OnUpdate ¶
func (h *HttpNotify) OnUpdate(info base.UpdateInfo)
func (*HttpNotify) RunLoop ¶
func (h *HttpNotify) RunLoop()
type HttpNotifyConfig ¶
type HttpNotifyConfig struct { Enable bool `json:"enable"` UpdateIntervalSec int `json:"update_interval_sec"` OnServerStart string `json:"on_server_start"` OnUpdate string `json:"on_update"` OnPubStart string `json:"on_pub_start"` OnPubStop string `json:"on_pub_stop"` OnSubStart string `json:"on_sub_start"` OnSubStop string `json:"on_sub_stop"` OnRelayPullStart string `json:"on_relay_pull_start"` OnRelayPullStop string `json:"on_relay_pull_stop"` OnRtmpConnect string `json:"on_rtmp_connect"` OnHlsMakeTs string `json:"on_hls_make_ts"` }
type HttpServerHandler ¶
type HttpServerHandler struct {
// contains filtered or unexported fields
}
func NewHttpServerHandler ¶
func NewHttpServerHandler(observer IHttpServerHandlerObserver) *HttpServerHandler
func (*HttpServerHandler) ServeSubSession ¶
func (h *HttpServerHandler) ServeSubSession(writer http.ResponseWriter, req *http.Request)
type HttpflvConfig ¶
type HttpflvConfig struct { CommonHttpServerConfig GopNum int `json:"gop_num"` }
type HttptsConfig ¶
type HttptsConfig struct { CommonHttpServerConfig GopNum int `json:"gop_num"` }
type ICustomizePubSessionContext ¶
type ICustomizePubSessionContext interface { // IAvPacketStream 传入音视频数据相关的接口。详细说明见 base.IAvPacketStream // base.IAvPacketStream UniqueKey() string StreamName() string }
type IGroupCreator ¶
type IGroupManager ¶
type IGroupManager interface { // GetOrCreateGroup // // @param appName 注意,如果没有,可以为"" // @return createFlag 如果为false表示group之前就存在,如果为true表示为当前新创建 // GetOrCreateGroup(appName string, streamName string) (group *Group, createFlag bool) // GetGroup // // @return 如果不存在,则返回nil // GetGroup(appName string, streamName string) *Group // Iterate 遍历所有 Group // // @param onIterateGroup 如果返回false,则删除这个 Group // Iterate(onIterateGroup func(group *Group) bool) Len() int }
IGroupManager
封装管理Group的容器 管理流标识(appName,streamName)与Group的映射关系。比如appName是否参与映射匹配
type IGroupObserver ¶
type IGroupObserver interface { CleanupHlsIfNeeded(appName string, streamName string, path string) OnHlsMakeTs(info base.HlsMakeTsInfo) OnRelayPullStart(info base.PullStartInfo) // TODO(chef): refactor me OnRelayPullStop(info base.PullStopInfo) }
type IHttpServerHandlerObserver ¶
type IHttpServerHandlerObserver interface { // OnNewHttpflvSubSession // // 通知上层有新的拉流者 // // @return nil则允许拉流,不为nil则关闭连接 // OnNewHttpflvSubSession(session *httpflv.SubSession) error OnDelHttpflvSubSession(session *httpflv.SubSession) OnNewHttptsSubSession(session *httpts.SubSession) error OnDelHttptsSubSession(session *httpts.SubSession) }
type ILalServer ¶
type ILalServer interface { RunLoop() error Dispose() // AddCustomizePubSession 定制化增强功能。业务方可以将自己的流输入到 ILalServer 中 // // @example 示例见 lal/app/demo/customize_lalserver // // @doc 文档见 <lalserver二次开发 - pub接入自定义流> https://pengrl.com/lal/#/customize_pub // AddCustomizePubSession(streamName string) (ICustomizePubSessionContext, error) // DelCustomizePubSession 将 ICustomizePubSessionContext 从 ILalServer 中删除 // DelCustomizePubSession(ICustomizePubSessionContext) // StatLalInfo StatAllGroup StatGroup CtrlStartPull CtrlKickOutSession // // 一些获取状态、发送控制命令的API。 // 目的是方便业务方在不修改logic包内代码的前提下,在外层实现一些特定逻辑的定制化开发。 // StatLalInfo() base.LalInfo StatAllGroup() (sgs []base.StatGroup) StatGroup(streamName string) *base.StatGroup CtrlStartRelayPull(info base.ApiCtrlStartRelayPullReq) base.ApiCtrlStartRelayPull CtrlStopRelayPull(streamName string) base.ApiCtrlStopRelayPull CtrlKickSession(info base.ApiCtrlKickSessionReq) base.HttpResponseBasic }
func NewLalServer ¶
func NewLalServer(modOption ...ModOption) ILalServer
NewLalServer 创建一个lal server
@param modOption: 定制化配置。可变参数,如果不关心,可以不填,具体字段见 Option
type INotifyHandler ¶
type INotifyHandler interface { OnServerStart(info base.LalInfo) OnUpdate(info base.UpdateInfo) OnPubStart(info base.PubStartInfo) OnPubStop(info base.PubStopInfo) OnSubStart(info base.SubStartInfo) OnSubStop(info base.SubStopInfo) OnRelayPullStart(info base.PullStartInfo) OnRelayPullStop(info base.PullStopInfo) OnRtmpConnect(info base.RtmpConnectInfo) OnHlsMakeTs(info base.HlsMakeTsInfo) }
INotifyHandler 事件通知接口
type Option ¶
type Option struct { // ConfFilename 配置文件,注意,如果为空,内部会尝试从 DefaultConfFilenameList 读取默认配置文件 // ConfFilename string // NotifyHandler // // 事件监听 // 业务方可实现 INotifyHandler 接口并传入从而获取到对应的事件通知。 // 如果不填写保持默认值nil,内部默认走http notify的逻辑(当然,还需要在配置文件中开启http notify功能)。 // 注意,如果业务方实现了自己的事件监听,则lal server内部不再走http notify的逻辑(也即二选一)。 // NotifyHandler INotifyHandler }
type PprofConfig ¶
type RecordConfig ¶
type RelayPushConfig ¶
type RtmpConfig ¶
type RtmpConfig struct { Enable bool `json:"enable"` Addr string `json:"addr"` GopNum int `json:"gop_num"` // TODO(chef): refactor 更名为gop_cache_num MergeWriteSize int `json:"merge_write_size"` AddDummyAudioEnable bool `json:"add_dummy_audio_enable"` AddDummyAudioWaitAudioMs int `json:"add_dummy_audio_wait_audio_ms"` }
type RtspConfig ¶
type RtspConfig struct { Enable bool `json:"enable"` Addr string `json:"addr"` OutWaitKeyFrameFlag bool `json:"out_wait_key_frame_flag"` rtsp.ServerAuthConfig }
type ServerManager ¶
type ServerManager struct {
// contains filtered or unexported fields
}
func NewServerManager ¶
func NewServerManager(modOption ...ModOption) *ServerManager
func (*ServerManager) AddCustomizePubSession ¶
func (sm *ServerManager) AddCustomizePubSession(streamName string) (ICustomizePubSessionContext, error)
func (*ServerManager) CleanupHlsIfNeeded ¶
func (sm *ServerManager) CleanupHlsIfNeeded(appName string, streamName string, path string)
func (*ServerManager) Config ¶
func (sm *ServerManager) Config() *Config
func (*ServerManager) CreateGroup ¶
func (sm *ServerManager) CreateGroup(appName string, streamName string) *Group
func (*ServerManager) CtrlKickSession ¶
func (sm *ServerManager) CtrlKickSession(info base.ApiCtrlKickSessionReq) (ret base.HttpResponseBasic)
CtrlKickSession
TODO(chef): refactor 不要返回http结果,返回error吧
func (*ServerManager) CtrlStartRelayPull ¶
func (sm *ServerManager) CtrlStartRelayPull(info base.ApiCtrlStartRelayPullReq) (ret base.ApiCtrlStartRelayPull)
func (*ServerManager) CtrlStartRtpPub ¶
func (sm *ServerManager) CtrlStartRtpPub(info base.ApiCtrlStartRtpPubReq) (ret base.ApiCtrlStartRtpPub)
func (*ServerManager) CtrlStopRelayPull ¶
func (sm *ServerManager) CtrlStopRelayPull(streamName string) (ret base.ApiCtrlStopRelayPull)
CtrlStopRelayPull
TODO(chef): 整理错误值
func (*ServerManager) DelCustomizePubSession ¶
func (sm *ServerManager) DelCustomizePubSession(sessionCtx ICustomizePubSessionContext)
func (*ServerManager) Dispose ¶
func (sm *ServerManager) Dispose()
func (*ServerManager) GetGroup ¶
func (sm *ServerManager) GetGroup(appName string, streamName string) *Group
func (*ServerManager) OnDelHttpflvSubSession ¶
func (sm *ServerManager) OnDelHttpflvSubSession(session *httpflv.SubSession)
func (*ServerManager) OnDelHttptsSubSession ¶
func (sm *ServerManager) OnDelHttptsSubSession(session *httpts.SubSession)
func (*ServerManager) OnDelRtmpPubSession ¶
func (sm *ServerManager) OnDelRtmpPubSession(session *rtmp.ServerSession)
func (*ServerManager) OnDelRtmpSubSession ¶
func (sm *ServerManager) OnDelRtmpSubSession(session *rtmp.ServerSession)
func (*ServerManager) OnDelRtspPubSession ¶
func (sm *ServerManager) OnDelRtspPubSession(session *rtsp.PubSession)
func (*ServerManager) OnDelRtspSession ¶
func (sm *ServerManager) OnDelRtspSession(session *rtsp.ServerCommandSession)
func (*ServerManager) OnDelRtspSubSession ¶
func (sm *ServerManager) OnDelRtspSubSession(session *rtsp.SubSession)
func (*ServerManager) OnHlsMakeTs ¶
func (sm *ServerManager) OnHlsMakeTs(info base.HlsMakeTsInfo)
func (*ServerManager) OnNewHttpflvSubSession ¶
func (sm *ServerManager) OnNewHttpflvSubSession(session *httpflv.SubSession) error
func (*ServerManager) OnNewHttptsSubSession ¶
func (sm *ServerManager) OnNewHttptsSubSession(session *httpts.SubSession) error
func (*ServerManager) OnNewRtmpPubSession ¶
func (sm *ServerManager) OnNewRtmpPubSession(session *rtmp.ServerSession) error
func (*ServerManager) OnNewRtmpSubSession ¶
func (sm *ServerManager) OnNewRtmpSubSession(session *rtmp.ServerSession) error
func (*ServerManager) OnNewRtspPubSession ¶
func (sm *ServerManager) OnNewRtspPubSession(session *rtsp.PubSession) error
func (*ServerManager) OnNewRtspSessionConnect ¶
func (sm *ServerManager) OnNewRtspSessionConnect(session *rtsp.ServerCommandSession)
func (*ServerManager) OnNewRtspSubSessionDescribe ¶
func (sm *ServerManager) OnNewRtspSubSessionDescribe(session *rtsp.SubSession) (ok bool, sdp []byte)
func (*ServerManager) OnNewRtspSubSessionPlay ¶
func (sm *ServerManager) OnNewRtspSubSessionPlay(session *rtsp.SubSession) error
func (*ServerManager) OnRelayPullStart ¶
func (sm *ServerManager) OnRelayPullStart(info base.PullStartInfo)
func (*ServerManager) OnRelayPullStop ¶
func (sm *ServerManager) OnRelayPullStop(info base.PullStopInfo)
func (*ServerManager) OnRtmpConnect ¶
func (sm *ServerManager) OnRtmpConnect(session *rtmp.ServerSession, opa rtmp.ObjectPairArray)
func (*ServerManager) RunLoop ¶
func (sm *ServerManager) RunLoop() error
func (*ServerManager) StatAllGroup ¶
func (sm *ServerManager) StatAllGroup() (sgs []base.StatGroup)
func (*ServerManager) StatGroup ¶
func (sm *ServerManager) StatGroup(streamName string) *base.StatGroup
func (*ServerManager) StatLalInfo ¶
func (sm *ServerManager) StatLalInfo() base.LalInfo
type SimpleAuthConfig ¶
type SimpleAuthConfig struct { Key string `json:"key"` DangerousLalSecret string `json:"dangerous_lal_secret"` PubRtmpEnable bool `json:"pub_rtmp_enable"` SubRtmpEnable bool `json:"sub_rtmp_enable"` SubHttpflvEnable bool `json:"sub_httpflv_enable"` SubHttptsEnable bool `json:"sub_httpts_enable"` PubRtspEnable bool `json:"pub_rtsp_enable"` SubRtspEnable bool `json:"sub_rtsp_enable"` HlsM3u8Enable bool `json:"hls_m3u8_enable"` }
type SimpleAuthCtx ¶
type SimpleAuthCtx struct {
// contains filtered or unexported fields
}
func NewSimpleAuthCtx ¶
func NewSimpleAuthCtx(config SimpleAuthConfig) *SimpleAuthCtx
func (*SimpleAuthCtx) OnHls ¶
func (s *SimpleAuthCtx) OnHls(streamName string, urlParam string) error
func (*SimpleAuthCtx) OnPubStart ¶
func (s *SimpleAuthCtx) OnPubStart(info base.PubStartInfo) error
func (*SimpleAuthCtx) OnSubStart ¶
func (s *SimpleAuthCtx) OnSubStart(info base.SubStartInfo) error
type SimpleGroupManager ¶
type SimpleGroupManager struct {
// contains filtered or unexported fields
}
SimpleGroupManager 忽略appName,只使用streamName
func NewSimpleGroupManager ¶
func NewSimpleGroupManager(groupCreator IGroupCreator) *SimpleGroupManager
func (*SimpleGroupManager) GetGroup ¶
func (s *SimpleGroupManager) GetGroup(appName string, streamName string) *Group
func (*SimpleGroupManager) GetOrCreateGroup ¶
func (s *SimpleGroupManager) GetOrCreateGroup(appName string, streamName string) (group *Group, createFlag bool)
func (*SimpleGroupManager) Iterate ¶
func (s *SimpleGroupManager) Iterate(onIterateGroup func(group *Group) bool)
func (*SimpleGroupManager) Len ¶
func (s *SimpleGroupManager) Len() int
type StaticRelayPullConfig ¶
Source Files ¶
- config.go
- customize_pubsession.go
- group__.go
- group__core_streaming.go
- group__in.go
- group__out_sub.go
- group__record_flv.go
- group__record_hls.go
- group__record_mpegts.go
- group__relay_pull.go
- group__relay_push.go
- group_manager.go
- http_api.go
- http_notify.go
- http_server_handler.go
- logic.go
- server_manager__.go
- server_manager__api.go
- simple_auth.go
- var.go