test

package
v0.1.29 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package test provides helpers for testing interceptors

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockStream

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

MockStream is a helper struct for testing interceptors.

func NewMockStream

func NewMockStream(info *interceptor.StreamInfo, i interceptor.Interceptor) *MockStream

NewMockStream creates a new MockStream

func (*MockStream) Close

func (s *MockStream) Close() error

Close closes the stream and the underlying interceptor

func (*MockStream) ReadRTCP

func (s *MockStream) ReadRTCP() chan RTCPWithError

ReadRTCP returns a channel containing the rtcp batched read, modified by the interceptor

func (*MockStream) ReadRTP

func (s *MockStream) ReadRTP() chan RTPWithError

ReadRTP returns a channel containing the rtp packets read, modified by the interceptor

func (*MockStream) ReceiveRTCP

func (s *MockStream) ReceiveRTCP(pkts []rtcp.Packet)

ReceiveRTCP schedules a new rtcp batch, so it can be read be the stream

func (*MockStream) ReceiveRTP

func (s *MockStream) ReceiveRTP(packet *rtp.Packet)

ReceiveRTP schedules a rtp packet, so it can be read be the stream

func (*MockStream) WriteRTCP

func (s *MockStream) WriteRTCP(pkts []rtcp.Packet) error

WriteRTCP writes a batch of rtcp packet to the stream, using the interceptor

func (*MockStream) WriteRTP

func (s *MockStream) WriteRTP(p *rtp.Packet) error

WriteRTP writes an rtp packet to the stream, using the interceptor

func (*MockStream) WrittenRTCP

func (s *MockStream) WrittenRTCP() chan []rtcp.Packet

WrittenRTCP returns a channel containing the rtcp batches written, modified by the interceptor

func (*MockStream) WrittenRTP

func (s *MockStream) WrittenRTP() chan *rtp.Packet

WrittenRTP returns a channel containing rtp packets written, modified by the interceptor

type MockTicker added in v0.1.12

type MockTicker struct {
	C chan time.Time
}

MockTicker is a helper to replace time.Ticker for testing purposes.

func (*MockTicker) Ch added in v0.1.12

func (t *MockTicker) Ch() <-chan time.Time

Ch returns the tickers channel

func (*MockTicker) Stop added in v0.1.12

func (t *MockTicker) Stop()

Stop stops the MockTicker.

func (*MockTicker) Tick added in v0.1.12

func (t *MockTicker) Tick(now time.Time)

Tick sends now to the channel

type MockTime added in v0.0.10

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

MockTime is a helper to replace time.Now() for testing purposes.

func (*MockTime) Now added in v0.0.10

func (t *MockTime) Now() time.Time

Now returns the current time.

func (*MockTime) SetNow added in v0.0.10

func (t *MockTime) SetNow(n time.Time)

SetNow sets the current time.

type RTCPWithError

type RTCPWithError struct {
	Packets []rtcp.Packet
	Err     error
}

RTCPWithError is used to send a batch of rtcp packets or an error on a channel

type RTPWithError

type RTPWithError struct {
	Packet *rtp.Packet
	Err    error
}

RTPWithError is used to send an rtp packet or an error on a channel

Jump to

Keyboard shortcuts

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