rtsp

package
v0.19.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthTypeDigest = "Digest"
	AuthTypeBasic  = "Basic"
	AuthAlgorithm  = "MD5"
)
View Source
const (
	MethodOptions      = "OPTIONS"
	MethodAnnounce     = "ANNOUNCE"
	MethodDescribe     = "DESCRIBE"
	MethodSetup        = "SETUP"
	MethodRecord       = "RECORD"
	MethodPlay         = "PLAY"
	MethodTeardown     = "TEARDOWN"
	MethodGetParameter = "GET_PARAMETER"
)
View Source
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"
)
View Source
const (
	TransportFieldClientPort  = "client_port"
	TransportFieldServerPort  = "server_port"
	TransportFieldInterleaved = "interleaved"
)
View Source
const (
	Interleaved = uint8(0x24)
)

Variables

View Source
var ErrRTSP = errors.New("lal.rtsp: fxxk")
View Source
var ResponseAnnounceTmpl = "RTSP/1.0 200 OK\r\n" +
	"CSeq: %s\r\n" +
	"\r\n"

CSeq

View Source
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,

View Source
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

View Source
var ResponsePlayTmpl = "RTSP/1.0 200 OK\r\n" +
	"CSeq: %s\r\n" +
	"Date: %s\r\n" +
	"\r\n"

CSeq Date

View Source
var ResponseRecordTmpl = "RTSP/1.0 200 OK\r\n" +
	"CSeq: %s\r\n" +
	"Session: %s\r\n" +
	"\r\n"

CSeq, Session

View Source
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

View Source
var ResponseTeardownTmpl = "RTSP/1.0 200 OK\r\n" +
	"CSeq: %s\r\n" +
	"\r\n"

CSeq

Functions

func PackRequest

func PackRequest(method, uri string, headers map[string]string, body string) (ret string)

body 可以为空

func PackResponseAnnounce

func PackResponseAnnounce(cseq string) string

func PackResponseDescribe

func PackResponseDescribe(cseq, sdp string) string

func PackResponseOptions

func PackResponseOptions(cseq string) string

func PackResponsePlay

func PackResponsePlay(cseq string) string

func PackResponseRecord

func PackResponseRecord(cseq string) string

func PackResponseSetup

func PackResponseSetup(cseq string, htv string) string

func PackResponseTeardown

func PackResponseTeardown(cseq string) string

Types

type AVPacketQueue

type AVPacketQueue struct {
	// contains filtered or unexported fields
}

func NewAVPacketQueue

func NewAVPacketQueue(onAVPacket OnAVPacket) *AVPacketQueue

func (*AVPacketQueue) Feed

func (a *AVPacketQueue) Feed(pkt base.AVPacket)

注意,调用方保证,音频相较于音频,视频相较于视频,时间戳是线性递增的。

func (*AVPacketQueue) PopAllByForce added in v0.19.12

func (a *AVPacketQueue) PopAllByForce()

type Auth

type Auth struct {
	Username string
	Password string

	Typ       string
	Realm     string
	Nonce     string
	Algorithm string
}

func (*Auth) FeedWWWAuthenticate

func (a *Auth) FeedWWWAuthenticate(s, username, password string)

func (*Auth) MakeAuthorization

func (a *Auth) MakeAuthorization(method, uri string) string

如果没有调用`FeedWWWAuthenticate`初始化过,则直接返回空字符串

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

func (*BaseInSession) GetSDP

func (session *BaseInSession) GetSDP() ([]byte, 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

func (session *BaseInSession) InitWithSDP(rawSDP []byte, sdpLogicCtx 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) WriteRTPRTCPDummy

func (session *BaseInSession) WriteRTPRTCPDummy()

发现pull时,需要先给对端发送数据,才能收到数据

type BaseInSessionObserver

type BaseInSessionObserver interface {
	OnRTPPacket(pkt rtprtcp.RTPPacket)

	// @param asc: AAC AudioSpecificConfig,注意,如果不存在音频或音频不为AAC,则为nil
	// @param vps, sps, pps 如果都为nil,则没有视频,如果sps, pps不为nil,则vps不为nil是H265,vps为nil是H264
	//
	// 注意,4个参数可能同时为nil
	OnAVConfig(asc, vps, sps, pps []byte)

	// @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
}

func NewBaseOutSession

func NewBaseOutSession(uniqueKey string, cmdSession IInterleavedPacketWriter) *BaseOutSession

func (*BaseOutSession) Dispose

func (session *BaseOutSession) Dispose() error

func (*BaseOutSession) GetStat

func (session *BaseOutSession) GetStat() base.StatSession

func (*BaseOutSession) HandleInterleavedPacket

func (session *BaseOutSession) HandleInterleavedPacket(b []byte, channel int)

func (*BaseOutSession) InitWithSDP

func (session *BaseOutSession) InitWithSDP(rawSDP []byte, sdpLogicCtx 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) WriteRTPPacket

func (session *BaseOutSession) WriteRTPPacket(packet rtprtcp.RTPPacket)

type ClientCommandSession

type ClientCommandSession struct {
	// contains filtered or unexported fields
}

Push和Pull共用,封装了客户端底层信令信令部分。 业务方应该使用PushSession和PullSession,而不是直接使用ClientCommandSession,除非你确定要这么做。

func (*ClientCommandSession) AppName

func (session *ClientCommandSession) AppName() string

func (*ClientCommandSession) Dispose

func (session *ClientCommandSession) Dispose() error

func (*ClientCommandSession) Do

func (session *ClientCommandSession) Do(rawURL string) error

func (*ClientCommandSession) InitWithSDP

func (session *ClientCommandSession) InitWithSDP(rawSDP []byte, sdpLogicCtx 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) URL added in v0.19.12

func (session *ClientCommandSession) URL() string

func (*ClientCommandSession) UniqueKey

func (session *ClientCommandSession) UniqueKey() string

func (*ClientCommandSession) WaitChan added in v0.19.12

func (session *ClientCommandSession) WaitChan() <-chan error

func (*ClientCommandSession) WriteInterleavedPacket

func (session *ClientCommandSession) WriteInterleavedPacket(packet []byte, channel int) error

type ClientCommandSessionObserver

type ClientCommandSessionObserver interface {
	OnConnectResult()

	// only for PullSession
	OnDescribeResponse(rawSDP []byte, sdpLogicCtx sdp.LogicContext)

	OnSetupWithConn(uri string, rtpConn, rtcpConn *nazanet.UDPConnection)
	OnSetupWithChannel(uri string, rtpChannel, rtcpChannel int)
	OnSetupResult()

	OnInterleavedPacket(packet []byte, channel int)
}

type ClientCommandSessionOption

type ClientCommandSessionOption struct {
	DoTimeoutMS int
	OverTCP     bool
}

type ClientCommandSessionType

type ClientCommandSessionType int
const (
	CCSTPullSession ClientCommandSessionType = iota
	CCSTPushSession
)

type IInterleavedPacketWriter

type IInterleavedPacketWriter interface {
	WriteInterleavedPacket(packet []byte, channel int) error
}

type ModClientCommandSessionOption

type ModClientCommandSessionOption func(option *ClientCommandSessionOption)

type ModPullSessionOption

type ModPullSessionOption func(option *PullSessionOption)

type ModPushSessionOption

type ModPushSessionOption func(option *PushSessionOption)

type OnAVPacket

type OnAVPacket func(pkt base.AVPacket)

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

func (session *PubSession) GetSDP() ([]byte, 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

func (session *PubSession) InitWithSDP(rawSDP []byte, sdpLogicCtx 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) URL

func (session *PubSession) URL() string

func (*PubSession) UniqueKey

func (session *PubSession) UniqueKey() string

func (*PubSession) UpdateStat

func (session *PubSession) UpdateStat(intervalSec uint32)

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

文档请参考: interface IClientSessionLifecycle

func (*PullSession) GetSDP

func (session *PullSession) GetSDP() ([]byte, 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(rawSDP []byte, sdpLogicCtx 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

阻塞直到和对端完成拉流前,握手部分的工作(也即收到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) URL added in v0.19.12

func (session *PullSession) URL() 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) WaitChan added in v0.19.12

func (session *PullSession) WaitChan() <-chan error

文档请参考: interface IClientSessionLifecycle

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 PullSessionOption struct {
	// 从调用Pull函数,到接收音视频数据的前一步,也即收到rtsp play response的超时时间
	// 如果为0,则没有超时时间
	PullTimeoutMS int

	OverTCP bool // 是否使用interleaved模式,也即是否通过rtsp command tcp连接传输rtp/rtcp数据
}

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

文档请参考: interface IClientSessionLifecycle

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(rawSDP []byte, sdpLogicCtx 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, rawSDP []byte, sdpLogicCtx sdp.LogicContext) error

阻塞直到和对端完成推流前,握手部分的工作(也即收到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) URL added in v0.19.12

func (session *PushSession) URL() 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) WaitChan added in v0.19.12

func (session *PushSession) WaitChan() <-chan error

文档请参考: interface IClientSessionLifecycle

func (*PushSession) WriteInterleavedPacket

func (session *PushSession) WriteInterleavedPacket(packet []byte, channel int) error

IInterleavedPacketWriter, callback by BaseOutSession

func (*PushSession) WriteRTPPacket

func (session *PushSession) WriteRTPPacket(packet rtprtcp.RTPPacket)

type PushSessionOption

type PushSessionOption struct {
	PushTimeoutMS int
	OverTCP       bool
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(addr string, observer ServerObserver) *Server

func (*Server) Dispose

func (s *Server) Dispose()

func (*Server) Listen

func (s *Server) Listen() (err error)

func (*Server) OnDelRTSPPubSession

func (s *Server) OnDelRTSPPubSession(session *PubSession)

ServerCommandSessionObserver

func (*Server) OnDelRTSPSubSession

func (s *Server) OnDelRTSPSubSession(session *SubSession)

ServerCommandSessionObserver

func (*Server) OnNewRTSPPubSession

func (s *Server) OnNewRTSPPubSession(session *PubSession) bool

ServerCommandSessionObserver

func (*Server) OnNewRTSPSubSessionDescribe

func (s *Server) OnNewRTSPSubSessionDescribe(session *SubSession) (ok bool, sdp []byte)

ServerCommandSessionObserver

func (*Server) OnNewRTSPSubSessionPlay

func (s *Server) OnNewRTSPSubSessionPlay(session *SubSession) bool

ServerCommandSessionObserver

func (*Server) RunLoop

func (s *Server) RunLoop() error

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 {
	// 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

func (session *SubSession) InitWithSDP(rawSDP []byte, sdpLogicCtx 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) URL

func (session *SubSession) URL() string

func (*SubSession) UniqueKey

func (session *SubSession) UniqueKey() string

func (*SubSession) UpdateStat

func (session *SubSession) UpdateStat(intervalSec uint32)

func (*SubSession) WriteInterleavedPacket

func (session *SubSession) WriteInterleavedPacket(packet []byte, channel int) error

IInterleavedPacketWriter, callback by BaseOutSession

func (*SubSession) WriteRTPPacket

func (session *SubSession) WriteRTPPacket(packet rtprtcp.RTPPacket)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL