server

package
v0.0.0-...-80dd8e0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChannelAllowed

func ChannelAllowed(url string) bool

ChannelAllowed checks if the requested stream is allowed

Types

type CalcBitrate

type CalcBitrate struct {
	Bitrate int64

	Channel      *Channel
	OutputStream *OutputStream
	// contains filtered or unexported fields
}

CalcBitrate holds information for a stream's inbound bitrate

func (*CalcBitrate) ModifyPacket

func (bitrate *CalcBitrate) ModifyPacket(pkt *av.Packet, streams []av.CodecData, videoidx int, audioidx int) (drop bool, err error)

ModifyPacket accepts a filter to perform actions on the packet

type Channel

type Channel struct {
	URL           string
	Queue         *pubsub.Queue
	Lock          *sync.RWMutex
	Conn          *rtmp.Conn
	OutputStreams []OutputStream
	WaitGroup     *sync.WaitGroup
	RxBitrate     int64
}

Channel holds connection information and packet queue as well as a list of outbound streams

type OutputStream

type OutputStream struct {
	URL       string
	Channel   chan bool
	TxBitrate float64
}

OutputStream holds info about outbound rtmp streams

type PubSubMessage

type PubSubMessage struct {
	ChannelURL      string `json:"channel_url"`
	OutputStreamURL string `json:"output_stream_url"`
	Action          string `json:"action"`
}

PubSubMessage holds infomation on which stream to add/remove connections from

type Server

type Server struct {
	RedisAddr  string
	RtmpAddr   string
	FFMPEGPath string
	S3Bucket   string
	Lock       *sync.RWMutex
	Conn       *rtmp.Conn
}

Server holds config for the server

func NewServer

func NewServer(rtmpURL string, redisURL string, FFMPEGPath string, s3Bucket string) *Server

NewServer returns a new relay server

func (Server) HandlePlay

func (server Server) HandlePlay(conn *rtmp.Conn)

HandlePlay pushes incoming stream to outbound stream

func (Server) HandlePublish

func (server Server) HandlePublish(conn *rtmp.Conn)

HandlePublish handles an incoming stream

func (Server) NewChannel

func (server Server) NewChannel(conn *rtmp.Conn) *Channel

NewChannel is an incomming stream from a user

func (Server) Start

func (server Server) Start()

Start starts the RTMP server and relay proxies

Jump to

Keyboard shortcuts

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