rtc

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PacketH264 = "H264"
	PacketHEVC = "HEVC"
	PacketPCMA = "PCMA"
	PacketPCMU = "PCMU"
	PacketOPUS = "OPUS"
)

Variables

View Source
var ErrNeedMoreFrames = errors.New("need more frames")

Functions

func NewJessibucaSession

func NewJessibucaSession(appName, streamid string, writeChanSize int, pc *peerConnection, lalServer logic.ILalServer) *jessibucaSession

func NewWhepSession

func NewWhepSession(appName, streamid string, writeChanSize int, pc *peerConnection, lalServer logic.ILalServer) *whepSession

func NewWhipSession

func NewWhipSession(streamid string, pc *peerConnection, lalServer logic.ILalServer) *whipSession

Types

type G711RtpDecoder

type G711RtpDecoder struct {
	IRtpDecoder
	// contains filtered or unexported fields
}

func NewG711RtpDecoder

func NewG711RtpDecoder(f format.Format) *G711RtpDecoder

func (*G711RtpDecoder) Decode

func (r *G711RtpDecoder) Decode(pkt *rtp.Packet) ([]byte, error)

type G711RtpEncoder

type G711RtpEncoder struct {
	IRtpEncoder
	// contains filtered or unexported fields
}

func NewG711RtpEncoder

func NewG711RtpEncoder(pt uint8) *G711RtpEncoder

func (*G711RtpEncoder) Encode

func (enc *G711RtpEncoder) Encode(msg base.RtmpMsg) ([]*rtp.Packet, error)

type H264RtpDecoder

type H264RtpDecoder struct {
	IRtpDecoder
	// contains filtered or unexported fields
}

func NewH264RtpDecoder

func NewH264RtpDecoder(f format.Format) *H264RtpDecoder

func (*H264RtpDecoder) Decode

func (r *H264RtpDecoder) Decode(pkt *rtp.Packet) ([]byte, error)

type H264RtpEncoder

type H264RtpEncoder struct {
	IRtpEncoder
	// contains filtered or unexported fields
}

func NewH264RtpEncoder

func NewH264RtpEncoder(codec []byte) *H264RtpEncoder

func (*H264RtpEncoder) Encode

func (enc *H264RtpEncoder) Encode(msg base.RtmpMsg) ([]*rtp.Packet, error)

func (*H264RtpEncoder) UpdateVideoCodec added in v0.3.6

func (enc *H264RtpEncoder) UpdateVideoCodec(_ []byte, sps, pps []byte)

type H265RtpDecoder added in v0.3.3

type H265RtpDecoder struct {
	IRtpDecoder
	// contains filtered or unexported fields
}

func NewH265RtpDecoder added in v0.3.3

func NewH265RtpDecoder(f format.Format) *H265RtpDecoder

func (*H265RtpDecoder) Decode added in v0.3.3

func (r *H265RtpDecoder) Decode(pkt *rtp.Packet) ([]byte, error)

type HevcRtpEncoder added in v0.3.4

type HevcRtpEncoder struct {
	IRtpEncoder
	// contains filtered or unexported fields
}

func NewHevcRtpEncoder added in v0.3.4

func NewHevcRtpEncoder(codec []byte) *HevcRtpEncoder

func (*HevcRtpEncoder) Encode added in v0.3.4

func (enc *HevcRtpEncoder) Encode(msg base.RtmpMsg) ([]*rtp.Packet, error)

func (*HevcRtpEncoder) UpdateVideoCodec added in v0.3.6

func (enc *HevcRtpEncoder) UpdateVideoCodec(vps, sps, pps []byte)

type IRtpDecoder

type IRtpDecoder interface {
	Decode(pkt *rtp.Packet) ([]byte, error)
}

type IRtpEncoder

type IRtpEncoder interface {
	Encode(msg base.RtmpMsg) ([]*rtp.Packet, error)
}

type OpusRtpDecoder

type OpusRtpDecoder struct {
	IRtpDecoder
	// contains filtered or unexported fields
}

func NewOpusRtpDecoder

func NewOpusRtpDecoder(f format.Format) *OpusRtpDecoder

func (*OpusRtpDecoder) Decode

func (r *OpusRtpDecoder) Decode(pkt *rtp.Packet) ([]byte, error)

type OpusRtpEncoder

type OpusRtpEncoder struct {
	IRtpEncoder
	// contains filtered or unexported fields
}

func NewOpusRtpEncoder

func NewOpusRtpEncoder(pt uint8) *OpusRtpEncoder

func (*OpusRtpEncoder) Encode

func (enc *OpusRtpEncoder) Encode(msg base.RtmpMsg) ([]*rtp.Packet, error)

type Packer

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

func NewPacker

func NewPacker(mimeType string, codec []byte) *Packer

func (*Packer) Encode

func (p *Packer) Encode(msg base.RtmpMsg) ([]*rtp.Packet, error)

func (*Packer) UpdateVideoCodec added in v0.3.6

func (p *Packer) UpdateVideoCodec(vps, sps, pps []byte)

type RtcServer

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

func NewRtcServer

func NewRtcServer(config config.RtcConfig, lal logic.ILalServer) (*RtcServer, error)

func (*RtcServer) HandleJessibuca

func (s *RtcServer) HandleJessibuca(c *gin.Context)

func (*RtcServer) HandleWHEP

func (s *RtcServer) HandleWHEP(c *gin.Context)

func (*RtcServer) HandleWHIP

func (s *RtcServer) HandleWHIP(c *gin.Context)

func (*RtcServer) HandleZlmWebrtcPlay added in v0.3.6

func (s *RtcServer) HandleZlmWebrtcPlay(app, stream, offer string) (string, error)

HandleZlmWebrtcPlay ZLM 兼容 WebRTC 播放,返回 SDP answer 为什么独立方法:ZLM 信令格式为 JSON {"code":0,"sdp":"..."},与 WHEP 纯 SDP 不同

func (*RtcServer) SetStreamNotFoundFn added in v0.3.6

func (s *RtcServer) SetStreamNotFoundFn(fn StreamNotFoundFn)

SetStreamNotFoundFn 注入流不存在回调

type StreamNotFoundFn added in v0.3.6

type StreamNotFoundFn func(app, stream, schema string)

StreamNotFoundFn 流不存在时的回调,触发 on_stream_not_found 通知上层拉流

type UnPacker

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

func NewUnPacker

func NewUnPacker(mimeType string, clockRate uint32, pktChan chan<- base.AvPacket) *UnPacker

func (*UnPacker) UnPack

func (un *UnPacker) UnPack(pkt *rtp.Packet) (err error)

Jump to

Keyboard shortcuts

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