Documentation ¶
Index ¶
- Constants
- Variables
- func PackRequest(method, uri string, headers map[string]string, body string) (ret string)
- func PackResponseAnnounce(cseq string) string
- func PackResponseDescribe(cseq, sdp string) string
- func PackResponseOptions(cseq string) string
- func PackResponsePlay(cseq string) string
- func PackResponseRecord(cseq string) string
- func PackResponseSetup(cseq string, htv string) string
- func PackResponseTeardown(cseq string) string
- type Auth
- type AvPacketQueue
- type BaseInSession
- func (session *BaseInSession) Dispose() error
- func (session *BaseInSession) GetSdp() sdp.LogicContext
- func (session *BaseInSession) GetStat() base.StatSession
- func (session *BaseInSession) HandleInterleavedPacket(b []byte, channel int)
- func (session *BaseInSession) InitWithSdp(sdpCtx sdp.LogicContext)
- func (session *BaseInSession) IsAlive() (readAlive, writeAlive bool)
- func (session *BaseInSession) SetObserver(observer BaseInSessionObserver)
- func (session *BaseInSession) SetupWithChannel(uri string, rtpChannel, rtcpChannel int) error
- func (session *BaseInSession) SetupWithConn(uri string, rtpConn, rtcpConn *nazanet.UdpConnection) error
- func (session *BaseInSession) UniqueKey() string
- func (session *BaseInSession) UpdateStat(intervalSec uint32)
- func (session *BaseInSession) WaitChan() <-chan error
- func (session *BaseInSession) WriteRtpRtcpDummy()
- type BaseInSessionObserver
- type BaseOutSession
- func (session *BaseOutSession) Dispose() error
- func (session *BaseOutSession) GetStat() base.StatSession
- func (session *BaseOutSession) HandleInterleavedPacket(b []byte, channel int)
- func (session *BaseOutSession) InitWithSdp(sdpCtx sdp.LogicContext)
- func (session *BaseOutSession) IsAlive() (readAlive, writeAlive bool)
- func (session *BaseOutSession) SetupWithChannel(uri string, rtpChannel, rtcpChannel int) error
- func (session *BaseOutSession) SetupWithConn(uri string, rtpConn, rtcpConn *nazanet.UdpConnection) error
- func (session *BaseOutSession) UniqueKey() string
- func (session *BaseOutSession) UpdateStat(intervalSec uint32)
- func (session *BaseOutSession) WaitChan() <-chan error
- func (session *BaseOutSession) WriteRtpPacket(packet rtprtcp.RtpPacket) error
- type ClientCommandSession
- func (session *ClientCommandSession) AppName() string
- func (session *ClientCommandSession) Dispose() error
- func (session *ClientCommandSession) Do(rawUrl string) error
- func (session *ClientCommandSession) InitWithSdp(sdpCtx sdp.LogicContext)
- func (session *ClientCommandSession) RawQuery() string
- func (session *ClientCommandSession) RemoteAddr() string
- func (session *ClientCommandSession) StreamName() string
- func (session *ClientCommandSession) UniqueKey() string
- func (session *ClientCommandSession) Url() string
- func (session *ClientCommandSession) WaitChan() <-chan error
- func (session *ClientCommandSession) WriteInterleavedPacket(packet []byte, channel int) error
- type ClientCommandSessionObserver
- type ClientCommandSessionOption
- type ClientCommandSessionType
- type IInterleavedPacketWriter
- type ModClientCommandSessionOption
- type ModPullSessionOption
- type ModPushSessionOption
- type OnAvPacket
- type PubSession
- func (session *PubSession) AppName() string
- func (session *PubSession) Dispose() error
- func (session *PubSession) GetSdp() sdp.LogicContext
- func (session *PubSession) GetStat() base.StatSession
- func (session *PubSession) HandleInterleavedPacket(b []byte, channel int)
- func (session *PubSession) InitWithSdp(sdpCtx sdp.LogicContext)
- func (session *PubSession) IsAlive() (readAlive, writeAlive bool)
- func (session *PubSession) RawQuery() string
- func (session *PubSession) SetObserver(observer PubSessionObserver)
- func (session *PubSession) SetupWithChannel(uri string, rtpChannel, rtcpChannel int) error
- func (session *PubSession) SetupWithConn(uri string, rtpConn, rtcpConn *nazanet.UdpConnection) error
- func (session *PubSession) StreamName() string
- func (session *PubSession) UniqueKey() string
- func (session *PubSession) UpdateStat(intervalSec uint32)
- func (session *PubSession) Url() string
- func (session *PubSession) WriteInterleavedPacket(packet []byte, channel int) error
- type PubSessionObserver
- type PullSession
- func (session *PullSession) AppName() string
- func (session *PullSession) Dispose() error
- func (session *PullSession) GetSdp() sdp.LogicContext
- func (session *PullSession) GetStat() base.StatSession
- func (session *PullSession) IsAlive() (readAlive, writeAlive bool)
- func (session *PullSession) OnConnectResult()
- func (session *PullSession) OnDescribeResponse(sdpCtx sdp.LogicContext)
- func (session *PullSession) OnInterleavedPacket(packet []byte, channel int)
- func (session *PullSession) OnSetupResult()
- func (session *PullSession) OnSetupWithChannel(uri string, rtpChannel, rtcpChannel int)
- func (session *PullSession) OnSetupWithConn(uri string, rtpConn, rtcpConn *nazanet.UdpConnection)
- func (session *PullSession) Pull(rawUrl string) error
- func (session *PullSession) RawQuery() string
- func (session *PullSession) StreamName() string
- func (session *PullSession) UniqueKey() string
- func (session *PullSession) UpdateStat(intervalSec uint32)
- func (session *PullSession) Url() string
- func (session *PullSession) WaitChan() <-chan error
- func (session *PullSession) WriteInterleavedPacket(packet []byte, channel int) error
- type PullSessionObserver
- type PullSessionOption
- type PushSession
- func (session *PushSession) AppName() string
- func (session *PushSession) Dispose() error
- func (session *PushSession) GetStat() base.StatSession
- func (session *PushSession) IsAlive() (readAlive, writeAlive bool)
- func (session *PushSession) OnConnectResult()
- func (session *PushSession) OnDescribeResponse(sdpCtx sdp.LogicContext)
- func (session *PushSession) OnInterleavedPacket(packet []byte, channel int)
- func (session *PushSession) OnSetupResult()
- func (session *PushSession) OnSetupWithChannel(uri string, rtpChannel, rtcpChannel int)
- func (session *PushSession) OnSetupWithConn(uri string, rtpConn, rtcpConn *nazanet.UdpConnection)
- func (session *PushSession) Push(rawUrl string, sdpCtx sdp.LogicContext) error
- func (session *PushSession) RawQuery() string
- func (session *PushSession) StreamName() string
- func (session *PushSession) UniqueKey() string
- func (session *PushSession) UpdateStat(intervalSec uint32)
- func (session *PushSession) Url() string
- func (session *PushSession) WaitChan() <-chan error
- func (session *PushSession) WriteInterleavedPacket(packet []byte, channel int) error
- func (session *PushSession) WriteRtpPacket(packet rtprtcp.RtpPacket) error
- type PushSessionOption
- type Server
- func (s *Server) Dispose()
- func (s *Server) Listen() (err error)
- func (s *Server) OnDelRtspPubSession(session *PubSession)
- func (s *Server) OnDelRtspSubSession(session *SubSession)
- func (s *Server) OnNewRtspPubSession(session *PubSession) bool
- func (s *Server) OnNewRtspSubSessionDescribe(session *SubSession) (ok bool, sdp []byte)
- func (s *Server) OnNewRtspSubSessionPlay(session *SubSession) bool
- func (s *Server) RunLoop() error
- type ServerCommandSession
- func (session *ServerCommandSession) Dispose() error
- func (session *ServerCommandSession) GetStat() base.StatSession
- func (session *ServerCommandSession) IsAlive() (readAlive, writeAlive bool)
- func (session *ServerCommandSession) RemoteAddr() string
- func (session *ServerCommandSession) RunLoop() error
- func (session *ServerCommandSession) UniqueKey() string
- func (session *ServerCommandSession) UpdateStat(intervalSec uint32)
- func (session *ServerCommandSession) WriteInterleavedPacket(packet []byte, channel int) error
- type ServerCommandSessionObserver
- type ServerObserver
- type SubSession
- func (session *SubSession) AppName() string
- func (session *SubSession) Dispose() error
- func (session *SubSession) GetStat() base.StatSession
- func (session *SubSession) HandleInterleavedPacket(b []byte, channel int)
- func (session *SubSession) InitWithSdp(sdpCtx sdp.LogicContext)
- func (session *SubSession) IsAlive() (readAlive, writeAlive bool)
- func (session *SubSession) RawQuery() string
- func (session *SubSession) SetupWithChannel(uri string, rtpChannel, rtcpChannel int) error
- func (session *SubSession) SetupWithConn(uri string, rtpConn, rtcpConn *nazanet.UdpConnection) error
- func (session *SubSession) StreamName() string
- func (session *SubSession) UniqueKey() string
- func (session *SubSession) UpdateStat(intervalSec uint32)
- func (session *SubSession) Url() string
- func (session *SubSession) WriteInterleavedPacket(packet []byte, channel int) error
- func (session *SubSession) WriteRtpPacket(packet rtprtcp.RtpPacket)
Constants ¶
const ( AuthTypeDigest = "Digest" AuthTypeBasic = "Basic" AuthAlgorithm = "MD5" )
const ( MethodOptions = "OPTIONS" MethodAnnounce = "ANNOUNCE" MethodDescribe = "DESCRIBE" MethodSetup = "SETUP" MethodRecord = "RECORD" MethodPlay = "PLAY" MethodTeardown = "TEARDOWN" MethodGetParameter = "GET_PARAMETER" )
const ( // header key HeaderAccept = "Accept" HeaderUserAgent = "User-Agent" HeaderCSeq = "CSeq" HeaderContentLength = "Content-Length" HeaderTransport = "Transport" HeaderSession = "Session" HeaderRange = "Range" HeaderWwwAuthenticate = "WWW-Authenticate" HeaderAuthorization = "Authorization" HeaderPublic = "Public" // header value HeaderAcceptApplicationSdp = "application/sdp" HeaderRangeDefault = "npt=0.000-" HeaderTransportClientPlayTmpl = "RTP/AVP/UDP;unicast;client_port=%d-%d" // localRtpPort, localRtcpPort HeaderTransportClientPlayTcpTmpl = "RTP/AVP/TCP;unicast;interleaved=%d-%d" // rtpChannel, rtcpChannel HeaderTransportClientRecordTmpl = "RTP/AVP/UDP;unicast;client_port=%d-%d;mode=record" HeaderTransportClientRecordTcpTmpl = "RTP/AVP/TCP;unicast;interleaved=%d-%d;mode=record" HeaderTransportServerPlayTmpl = "RTP/AVP/UDP;unicast;client_port=%d-%d;server_port=%d-%d" //HeaderTransportServerPlayTCPTmpl = "RTP/AVP/TCP;unicast;interleaved=%d-%d" HeaderTransportServerRecordTmpl = "RTP/AVP/UDP;unicast;client_port=%d-%d;server_port=%d-%d;mode=record" )
const ( TransportFieldClientPort = "client_port" TransportFieldServerPort = "server_port" TransportFieldInterleaved = "interleaved" )
const (
Interleaved = uint8(0x24)
)
Variables ¶
var ErrRtsp = errors.New("lal.rtsp: fxxk")
var ResponseAnnounceTmpl = "RTSP/1.0 200 OK\r\n" +
"CSeq: %s\r\n" +
"\r\n"
CSeq
var ResponseDescribeTmpl = "RTSP/1.0 200 OK\r\n" +
"CSeq: %s\r\n" +
"Date: %s\r\n" +
"Content-Type: application/sdp\r\n" +
"Content-Length: %d\r\n" +
"\r\n" +
"%s"
CSeq, Date, Content-Length,
var ResponseOptionsTmpl = "RTSP/1.0 200 OK\r\n" + "Server: " + base.LalRtspOptionsResponseServer + "\r\n" + "CSeq: %s\r\n" + "Public: DESCRIBE, ANNOUNCE, SETUP, PLAY, PAUSE, RECORD, TEARDOWN\r\n" + "\r\n"
CSeq
var ResponsePlayTmpl = "RTSP/1.0 200 OK\r\n" +
"CSeq: %s\r\n" +
"Date: %s\r\n" +
"\r\n"
CSeq Date
var ResponseRecordTmpl = "RTSP/1.0 200 OK\r\n" +
"CSeq: %s\r\n" +
"Session: %s\r\n" +
"\r\n"
CSeq, Session
var ResponseSetupTmpl = "RTSP/1.0 200 OK\r\n" +
"CSeq: %s\r\n" +
"Date: %s\r\n" +
"Session: %s\r\n" +
"Transport: %s\r\n" +
"\r\n"
rfc2326 10.4 SETUP CSeq, Date, Session, Transport
var ResponseTeardownTmpl = "RTSP/1.0 200 OK\r\n" +
"CSeq: %s\r\n" +
"\r\n"
CSeq
Functions ¶
func PackRequest ¶
body 可以为空
func PackResponseAnnounce ¶
func PackResponseDescribe ¶
func PackResponseOptions ¶
func PackResponsePlay ¶
func PackResponseRecord ¶
func PackResponseSetup ¶
func PackResponseTeardown ¶
Types ¶
type Auth ¶
type Auth struct { Username string Password string Typ string Realm string Nonce string Algorithm string }
func (*Auth) FeedWwwAuthenticate ¶ added in v0.24.1
func (*Auth) MakeAuthorization ¶
如果没有调用`FeedWwwAuthenticate`初始化过,则直接返回空字符串
type AvPacketQueue ¶ added in v0.24.1
type AvPacketQueue struct {
// contains filtered or unexported fields
}
func NewAvPacketQueue ¶ added in v0.24.1
func NewAvPacketQueue(onAvPacket OnAvPacket) *AvPacketQueue
func (*AvPacketQueue) Feed ¶ added in v0.24.1
func (a *AvPacketQueue) Feed(pkt base.AvPacket)
注意,调用方保证,音频相较于音频,视频相较于视频,时间戳是线性递增的。
func (*AvPacketQueue) PopAllByForce ¶ added in v0.24.1
func (a *AvPacketQueue) PopAllByForce()
type BaseInSession ¶
type BaseInSession struct {
// contains filtered or unexported fields
}
func NewBaseInSession ¶
func NewBaseInSession(uniqueKey string, cmdSession IInterleavedPacketWriter) *BaseInSession
func NewBaseInSessionWithObserver ¶
func NewBaseInSessionWithObserver(uniqueKey string, cmdSession IInterleavedPacketWriter, observer BaseInSessionObserver) *BaseInSession
func (*BaseInSession) Dispose ¶
func (session *BaseInSession) Dispose() error
Dispose 文档请参考: IClientSessionLifecycle interface
func (*BaseInSession) GetSdp ¶ added in v0.24.1
func (session *BaseInSession) GetSdp() sdp.LogicContext
func (*BaseInSession) GetStat ¶
func (session *BaseInSession) GetStat() base.StatSession
func (*BaseInSession) HandleInterleavedPacket ¶
func (session *BaseInSession) HandleInterleavedPacket(b []byte, channel int)
func (*BaseInSession) InitWithSdp ¶ added in v0.24.1
func (session *BaseInSession) InitWithSdp(sdpCtx sdp.LogicContext)
func (*BaseInSession) IsAlive ¶
func (session *BaseInSession) IsAlive() (readAlive, writeAlive bool)
func (*BaseInSession) SetObserver ¶
func (session *BaseInSession) SetObserver(observer BaseInSessionObserver)
如果没有设置回调监听对象,可以通过该函数设置,调用方保证调用该函数发生在调用InitWithSdp之后
func (*BaseInSession) SetupWithChannel ¶
func (session *BaseInSession) SetupWithChannel(uri string, rtpChannel, rtcpChannel int) error
func (*BaseInSession) SetupWithConn ¶
func (session *BaseInSession) SetupWithConn(uri string, rtpConn, rtcpConn *nazanet.UdpConnection) error
func (*BaseInSession) UniqueKey ¶
func (session *BaseInSession) UniqueKey() string
func (*BaseInSession) UpdateStat ¶
func (session *BaseInSession) UpdateStat(intervalSec uint32)
func (*BaseInSession) WaitChan ¶ added in v0.24.1
func (session *BaseInSession) WaitChan() <-chan error
WaitChan 文档请参考: IClientSessionLifecycle interface
注意,目前只有一种情况,即上层主动调用Dispose函数,此时error为nil
func (*BaseInSession) WriteRtpRtcpDummy ¶ added in v0.24.1
func (session *BaseInSession) WriteRtpRtcpDummy()
发现pull时,需要先给对端发送数据,才能收到数据
type BaseInSessionObserver ¶
type BaseInSessionObserver interface { OnSdp(sdpCtx sdp.LogicContext) // 回调收到的RTP包 OnRtpPacket(pkt rtprtcp.RtpPacket) // @param pkt: pkt结构体中字段含义见rtprtcp.OnAvPacket OnAvPacket(pkt base.AvPacket) }
BaseInSession会向上层回调两种格式的数据(本质上是一份数据,业务方可自由选择使用): 1. 原始的rtp packet 2. rtp合并后的av packet
type BaseOutSession ¶
type BaseOutSession struct {
// contains filtered or unexported fields
}
out的含义是音视频由本端发送至对端
func NewBaseOutSession ¶
func NewBaseOutSession(uniqueKey string, cmdSession IInterleavedPacketWriter) *BaseOutSession
func (*BaseOutSession) Dispose ¶
func (session *BaseOutSession) Dispose() error
Dispose 文档请参考: IClientSessionLifecycle interface
func (*BaseOutSession) GetStat ¶
func (session *BaseOutSession) GetStat() base.StatSession
func (*BaseOutSession) HandleInterleavedPacket ¶
func (session *BaseOutSession) HandleInterleavedPacket(b []byte, channel int)
func (*BaseOutSession) InitWithSdp ¶ added in v0.24.1
func (session *BaseOutSession) InitWithSdp(sdpCtx sdp.LogicContext)
func (*BaseOutSession) IsAlive ¶
func (session *BaseOutSession) IsAlive() (readAlive, writeAlive bool)
func (*BaseOutSession) SetupWithChannel ¶
func (session *BaseOutSession) SetupWithChannel(uri string, rtpChannel, rtcpChannel int) error
func (*BaseOutSession) SetupWithConn ¶
func (session *BaseOutSession) SetupWithConn(uri string, rtpConn, rtcpConn *nazanet.UdpConnection) error
func (*BaseOutSession) UniqueKey ¶
func (session *BaseOutSession) UniqueKey() string
func (*BaseOutSession) UpdateStat ¶
func (session *BaseOutSession) UpdateStat(intervalSec uint32)
func (*BaseOutSession) WaitChan ¶ added in v0.24.1
func (session *BaseOutSession) WaitChan() <-chan error
WaitChan 文档请参考: IClientSessionLifecycle interface
注意,目前只有一种情况,即上层主动调用Dispose函数,此时error为nil
func (*BaseOutSession) WriteRtpPacket ¶ added in v0.24.1
func (session *BaseOutSession) WriteRtpPacket(packet rtprtcp.RtpPacket) error
type ClientCommandSession ¶
type ClientCommandSession struct {
// contains filtered or unexported fields
}
Push和Pull共用,封装了客户端底层信令信令部分。 业务方应该使用PushSession和PullSession,而不是直接使用ClientCommandSession,除非你确定要这么做。
func NewClientCommandSession ¶
func NewClientCommandSession(t ClientCommandSessionType, uniqueKey string, observer ClientCommandSessionObserver, modOptions ...ModClientCommandSessionOption) *ClientCommandSession
func (*ClientCommandSession) AppName ¶
func (session *ClientCommandSession) AppName() string
func (*ClientCommandSession) Dispose ¶
func (session *ClientCommandSession) Dispose() error
Dispose 文档请参考: IClientSessionLifecycle interface
func (*ClientCommandSession) Do ¶
func (session *ClientCommandSession) Do(rawUrl string) error
func (*ClientCommandSession) InitWithSdp ¶ added in v0.24.1
func (session *ClientCommandSession) InitWithSdp(sdpCtx sdp.LogicContext)
only for PushSession
func (*ClientCommandSession) RawQuery ¶
func (session *ClientCommandSession) RawQuery() string
func (*ClientCommandSession) RemoteAddr ¶
func (session *ClientCommandSession) RemoteAddr() string
func (*ClientCommandSession) StreamName ¶
func (session *ClientCommandSession) StreamName() string
func (*ClientCommandSession) UniqueKey ¶
func (session *ClientCommandSession) UniqueKey() string
func (*ClientCommandSession) Url ¶ added in v0.24.1
func (session *ClientCommandSession) Url() string
func (*ClientCommandSession) WaitChan ¶ added in v0.19.12
func (session *ClientCommandSession) WaitChan() <-chan error
WaitChan 文档请参考: IClientSessionLifecycle interface
func (*ClientCommandSession) WriteInterleavedPacket ¶
func (session *ClientCommandSession) WriteInterleavedPacket(packet []byte, channel int) error
type ClientCommandSessionObserver ¶
type ClientCommandSessionObserver interface { OnConnectResult() // only for PullSession OnDescribeResponse(sdpCtx sdp.LogicContext) OnSetupWithConn(uri string, rtpConn, rtcpConn *nazanet.UdpConnection) OnSetupWithChannel(uri string, rtpChannel, rtcpChannel int) OnSetupResult() OnInterleavedPacket(packet []byte, channel int) }
type ClientCommandSessionType ¶
type ClientCommandSessionType int
const ( CcstPullSession ClientCommandSessionType = iota CcstPushSession )
type ModClientCommandSessionOption ¶
type ModClientCommandSessionOption func(option *ClientCommandSessionOption)
type ModPullSessionOption ¶
type ModPullSessionOption func(option *PullSessionOption)
type ModPushSessionOption ¶
type ModPushSessionOption func(option *PushSessionOption)
type OnAvPacket ¶ added in v0.24.1
type PubSession ¶
type PubSession struct {
// contains filtered or unexported fields
}
func NewPubSession ¶
func NewPubSession(urlCtx base.UrlContext, cmdSession *ServerCommandSession) *PubSession
func (*PubSession) AppName ¶
func (session *PubSession) AppName() string
func (*PubSession) Dispose ¶
func (session *PubSession) Dispose() error
func (*PubSession) GetSdp ¶ added in v0.24.1
func (session *PubSession) GetSdp() sdp.LogicContext
func (*PubSession) GetStat ¶
func (session *PubSession) GetStat() base.StatSession
func (*PubSession) HandleInterleavedPacket ¶
func (session *PubSession) HandleInterleavedPacket(b []byte, channel int)
func (*PubSession) InitWithSdp ¶ added in v0.24.1
func (session *PubSession) InitWithSdp(sdpCtx sdp.LogicContext)
func (*PubSession) IsAlive ¶
func (session *PubSession) IsAlive() (readAlive, writeAlive bool)
func (*PubSession) RawQuery ¶
func (session *PubSession) RawQuery() string
func (*PubSession) SetObserver ¶
func (session *PubSession) SetObserver(observer PubSessionObserver)
func (*PubSession) SetupWithChannel ¶
func (session *PubSession) SetupWithChannel(uri string, rtpChannel, rtcpChannel int) error
func (*PubSession) SetupWithConn ¶
func (session *PubSession) SetupWithConn(uri string, rtpConn, rtcpConn *nazanet.UdpConnection) error
func (*PubSession) StreamName ¶
func (session *PubSession) StreamName() string
func (*PubSession) UniqueKey ¶
func (session *PubSession) UniqueKey() string
func (*PubSession) UpdateStat ¶
func (session *PubSession) UpdateStat(intervalSec uint32)
func (*PubSession) Url ¶ added in v0.24.1
func (session *PubSession) Url() string
func (*PubSession) WriteInterleavedPacket ¶
func (session *PubSession) WriteInterleavedPacket(packet []byte, channel int) error
IInterleavedPacketWriter, callback by BaseInSession
type PubSessionObserver ¶
type PubSessionObserver interface { BaseInSessionObserver }
type PullSession ¶
type PullSession struct {
// contains filtered or unexported fields
}
func NewPullSession ¶
func NewPullSession(observer PullSessionObserver, modOptions ...ModPullSessionOption) *PullSession
func (*PullSession) AppName ¶
func (session *PullSession) AppName() string
文档请参考: interface ISessionUrlContext
func (*PullSession) Dispose ¶
func (session *PullSession) Dispose() error
Dispose 文档请参考: IClientSessionLifecycle interface
func (*PullSession) GetSdp ¶ added in v0.24.1
func (session *PullSession) GetSdp() sdp.LogicContext
func (*PullSession) GetStat ¶
func (session *PullSession) GetStat() base.StatSession
文档请参考: interface ISessionStat
func (*PullSession) IsAlive ¶
func (session *PullSession) IsAlive() (readAlive, writeAlive bool)
文档请参考: interface ISessionStat
func (*PullSession) OnConnectResult ¶
func (session *PullSession) OnConnectResult()
ClientCommandSessionObserver, callback by ClientCommandSession
func (*PullSession) OnDescribeResponse ¶
func (session *PullSession) OnDescribeResponse(sdpCtx sdp.LogicContext)
ClientCommandSessionObserver, callback by ClientCommandSession
func (*PullSession) OnInterleavedPacket ¶
func (session *PullSession) OnInterleavedPacket(packet []byte, channel int)
ClientCommandSessionObserver, callback by ClientCommandSession
func (*PullSession) OnSetupResult ¶
func (session *PullSession) OnSetupResult()
ClientCommandSessionObserver, callback by ClientCommandSession
func (*PullSession) OnSetupWithChannel ¶
func (session *PullSession) OnSetupWithChannel(uri string, rtpChannel, rtcpChannel int)
ClientCommandSessionObserver, callback by ClientCommandSession
func (*PullSession) OnSetupWithConn ¶
func (session *PullSession) OnSetupWithConn(uri string, rtpConn, rtcpConn *nazanet.UdpConnection)
ClientCommandSessionObserver, callback by ClientCommandSession
func (*PullSession) Pull ¶
func (session *PullSession) Pull(rawUrl string) error
Pull 阻塞直到和对端完成拉流前,握手部分的工作(也即收到RTSP Play response),或者发生错误
func (*PullSession) RawQuery ¶
func (session *PullSession) RawQuery() string
文档请参考: interface ISessionUrlContext
func (*PullSession) StreamName ¶
func (session *PullSession) StreamName() string
文档请参考: interface ISessionUrlContext
func (*PullSession) UniqueKey ¶
func (session *PullSession) UniqueKey() string
文档请参考: interface IObject
func (*PullSession) UpdateStat ¶
func (session *PullSession) UpdateStat(intervalSec uint32)
文档请参考: interface ISessionStat
func (*PullSession) Url ¶ added in v0.24.1
func (session *PullSession) Url() string
文档请参考: interface ISessionUrlContext
func (*PullSession) WaitChan ¶ added in v0.19.12
func (session *PullSession) WaitChan() <-chan error
WaitChan 文档请参考: IClientSessionLifecycle interface
func (*PullSession) WriteInterleavedPacket ¶
func (session *PullSession) WriteInterleavedPacket(packet []byte, channel int) error
IInterleavedPacketWriter, callback by BaseInSession
type PullSessionObserver ¶
type PullSessionObserver interface { BaseInSessionObserver }
type PullSessionOption ¶
type PushSession ¶
type PushSession struct {
// contains filtered or unexported fields
}
func NewPushSession ¶
func NewPushSession(modOptions ...ModPushSessionOption) *PushSession
func (*PushSession) AppName ¶
func (session *PushSession) AppName() string
文档请参考: interface ISessionUrlContext
func (*PushSession) Dispose ¶
func (session *PushSession) Dispose() error
Dispose 文档请参考: IClientSessionLifecycle interface
func (*PushSession) GetStat ¶
func (session *PushSession) GetStat() base.StatSession
文档请参考: interface ISessionStat
func (*PushSession) IsAlive ¶
func (session *PushSession) IsAlive() (readAlive, writeAlive bool)
文档请参考: interface ISessionStat
func (*PushSession) OnConnectResult ¶
func (session *PushSession) OnConnectResult()
ClientCommandSessionObserver, callback by ClientCommandSession
func (*PushSession) OnDescribeResponse ¶
func (session *PushSession) OnDescribeResponse(sdpCtx sdp.LogicContext)
ClientCommandSessionObserver, callback by ClientCommandSession
func (*PushSession) OnInterleavedPacket ¶
func (session *PushSession) OnInterleavedPacket(packet []byte, channel int)
ClientCommandSessionObserver, callback by ClientCommandSession
func (*PushSession) OnSetupResult ¶
func (session *PushSession) OnSetupResult()
ClientCommandSessionObserver, callback by ClientCommandSession
func (*PushSession) OnSetupWithChannel ¶
func (session *PushSession) OnSetupWithChannel(uri string, rtpChannel, rtcpChannel int)
ClientCommandSessionObserver, callback by ClientCommandSession
func (*PushSession) OnSetupWithConn ¶
func (session *PushSession) OnSetupWithConn(uri string, rtpConn, rtcpConn *nazanet.UdpConnection)
ClientCommandSessionObserver, callback by ClientCommandSession
func (*PushSession) Push ¶
func (session *PushSession) Push(rawUrl string, sdpCtx sdp.LogicContext) error
Push 阻塞直到和对端完成推流前,握手部分的工作(也即收到RTSP Record response),或者发生错误
func (*PushSession) RawQuery ¶
func (session *PushSession) RawQuery() string
文档请参考: interface ISessionUrlContext
func (*PushSession) StreamName ¶
func (session *PushSession) StreamName() string
文档请参考: interface ISessionUrlContext
func (*PushSession) UniqueKey ¶
func (session *PushSession) UniqueKey() string
文档请参考: interface IObject
func (*PushSession) UpdateStat ¶
func (session *PushSession) UpdateStat(intervalSec uint32)
文档请参考: interface ISessionStat
func (*PushSession) Url ¶ added in v0.24.1
func (session *PushSession) Url() string
文档请参考: interface ISessionUrlContext
func (*PushSession) WaitChan ¶ added in v0.19.12
func (session *PushSession) WaitChan() <-chan error
WaitChan 文档请参考: IClientSessionLifecycle interface
func (*PushSession) WriteInterleavedPacket ¶
func (session *PushSession) WriteInterleavedPacket(packet []byte, channel int) error
IInterleavedPacketWriter, callback by BaseOutSession
func (*PushSession) WriteRtpPacket ¶ added in v0.24.1
func (session *PushSession) WriteRtpPacket(packet rtprtcp.RtpPacket) error
type PushSessionOption ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(addr string, observer ServerObserver) *Server
func (*Server) OnDelRtspPubSession ¶ added in v0.24.1
func (s *Server) OnDelRtspPubSession(session *PubSession)
ServerCommandSessionObserver
func (*Server) OnDelRtspSubSession ¶ added in v0.24.1
func (s *Server) OnDelRtspSubSession(session *SubSession)
ServerCommandSessionObserver
func (*Server) OnNewRtspPubSession ¶ added in v0.24.1
func (s *Server) OnNewRtspPubSession(session *PubSession) bool
ServerCommandSessionObserver
func (*Server) OnNewRtspSubSessionDescribe ¶ added in v0.24.1
func (s *Server) OnNewRtspSubSessionDescribe(session *SubSession) (ok bool, sdp []byte)
ServerCommandSessionObserver
func (*Server) OnNewRtspSubSessionPlay ¶ added in v0.24.1
func (s *Server) OnNewRtspSubSessionPlay(session *SubSession) bool
ServerCommandSessionObserver
type ServerCommandSession ¶
type ServerCommandSession struct {
// contains filtered or unexported fields
}
func NewServerCommandSession ¶
func NewServerCommandSession(observer ServerCommandSessionObserver, conn net.Conn) *ServerCommandSession
func (*ServerCommandSession) Dispose ¶
func (session *ServerCommandSession) Dispose() error
func (*ServerCommandSession) GetStat ¶
func (session *ServerCommandSession) GetStat() base.StatSession
func (*ServerCommandSession) IsAlive ¶
func (session *ServerCommandSession) IsAlive() (readAlive, writeAlive bool)
func (*ServerCommandSession) RemoteAddr ¶
func (session *ServerCommandSession) RemoteAddr() string
func (*ServerCommandSession) RunLoop ¶
func (session *ServerCommandSession) RunLoop() error
func (*ServerCommandSession) UniqueKey ¶
func (session *ServerCommandSession) UniqueKey() string
func (*ServerCommandSession) UpdateStat ¶
func (session *ServerCommandSession) UpdateStat(intervalSec uint32)
func (*ServerCommandSession) WriteInterleavedPacket ¶
func (session *ServerCommandSession) WriteInterleavedPacket(packet []byte, channel int) error
使用RTSP TCP命令连接,向对端发送RTP数据
type ServerCommandSessionObserver ¶
type ServerCommandSessionObserver interface { // @brief Announce阶段回调 // @return 如果返回false,则表示上层要强制关闭这个推流请求 OnNewRtspPubSession(session *PubSession) bool // @brief Describe阶段回调 // @return ok 如果返回false,则表示上层要强制关闭这个拉流请求 // @return sdp OnNewRtspSubSessionDescribe(session *SubSession) (ok bool, sdp []byte) // @brief Describe阶段回调 // @return ok 如果返回false,则表示上层要强制关闭这个拉流请求 OnNewRtspSubSessionPlay(session *SubSession) bool }
type ServerObserver ¶
type ServerObserver interface { // @brief 使得上层有能力管理未进化到Pub、Sub阶段的Session OnNewRtspSessionConnect(session *ServerCommandSession) // @brief 注意,对于已经进化到了Pub、Sub阶段的Session,该回调依然会被调用 OnDelRtspSession(session *ServerCommandSession) // @brief Announce阶段回调 // @return 如果返回false,则表示上层要强制关闭这个推流请求 OnNewRtspPubSession(session *PubSession) bool OnDelRtspPubSession(session *PubSession) // @return 如果返回false,则表示上层要强制关闭这个拉流请求 // @return sdp OnNewRtspSubSessionDescribe(session *SubSession) (ok bool, sdp []byte) // @brief Describe阶段回调 // @return ok 如果返回false,则表示上层要强制关闭这个拉流请求 OnNewRtspSubSessionPlay(session *SubSession) bool OnDelRtspSubSession(session *SubSession) }
type SubSession ¶
type SubSession struct { ShouldWaitVideoKeyFrame bool // contains filtered or unexported fields }
func NewSubSession ¶
func NewSubSession(urlCtx base.UrlContext, cmdSession *ServerCommandSession) *SubSession
func (*SubSession) AppName ¶
func (session *SubSession) AppName() string
func (*SubSession) Dispose ¶
func (session *SubSession) Dispose() error
func (*SubSession) GetStat ¶
func (session *SubSession) GetStat() base.StatSession
func (*SubSession) HandleInterleavedPacket ¶
func (session *SubSession) HandleInterleavedPacket(b []byte, channel int)
func (*SubSession) InitWithSdp ¶ added in v0.24.1
func (session *SubSession) InitWithSdp(sdpCtx sdp.LogicContext)
func (*SubSession) IsAlive ¶
func (session *SubSession) IsAlive() (readAlive, writeAlive bool)
func (*SubSession) RawQuery ¶
func (session *SubSession) RawQuery() string
func (*SubSession) SetupWithChannel ¶
func (session *SubSession) SetupWithChannel(uri string, rtpChannel, rtcpChannel int) error
func (*SubSession) SetupWithConn ¶
func (session *SubSession) SetupWithConn(uri string, rtpConn, rtcpConn *nazanet.UdpConnection) error
func (*SubSession) StreamName ¶
func (session *SubSession) StreamName() string
func (*SubSession) UniqueKey ¶
func (session *SubSession) UniqueKey() string
func (*SubSession) UpdateStat ¶
func (session *SubSession) UpdateStat(intervalSec uint32)
func (*SubSession) Url ¶ added in v0.24.1
func (session *SubSession) Url() string
func (*SubSession) WriteInterleavedPacket ¶
func (session *SubSession) WriteInterleavedPacket(packet []byte, channel int) error
IInterleavedPacketWriter, callback by BaseOutSession
func (*SubSession) WriteRtpPacket ¶ added in v0.24.1
func (session *SubSession) WriteRtpPacket(packet rtprtcp.RtpPacket)