Documentation
¶
Index ¶
- func RTCPBytes(p *RTCPPacket) *[]byte
- func RTPBytes(p *RTPPacket) *[]byte
- type BWE
- type Codec
- type Consumer
- type Data
- type DataChunk
- type Driver
- type ECN
- type Element
- type EncodedFrame
- type EncodedVideo
- type Format
- type FrameRate
- type GCC
- type Nada
- func (n *Nada) OnAck(sequenceNumber uint64, size int, departure time.Time, arrival time.Time, ...)
- func (n *Nada) OnLoss(sequenceNumber uint64, size int, departure time.Time)
- func (n *Nada) UpdateECNCounts(ect0 uint64, ect1 uint64, ce uint64)
- func (n *Nada) UpdateRTT(rtt time.Duration)
- func (n *Nada) UpdateTargetRate(time.Time) int
- type Packet
- type Puller
- type RTCP
- type RTCPPacket
- type RTP
- type RTPPacket
- type RTTSource
- type RawFrame
- type RawVideo
- type Sink
- type Source
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RTCPBytes ¶
func RTCPBytes(p *RTCPPacket) *[]byte
RTCPBytes says where an RTCP packet keeps its buffer, for the io adapters.
Types ¶
type Codec ¶
type Codec int
Codec identifies a media codec. It is the single codec type shared by the media pipelines (gstreamer, gopipe) and the transports.
func NewCodecFromMimeType ¶
NewCodecFromMimeType parses a codec from a "<media>/<codec>" MIME type, as negotiated by WebRTC. The media type is ignored, because every codec here is a video codec.
type Consumer ¶
type Consumer[T any] interface { Element // Attach names the upstream puller. Attach(p Puller[T]) error }
Consumer is a pull input: it reads from the puller it is attached to.
type DataChunk ¶
type DataChunk struct {
Data []byte
}
DataChunk is non-media payload, such as a data channel's.
type Driver ¶
type Driver interface {
Element
// Run moves packets until the stream ends, ctx is cancelled, or an error
// occurs. It blocks, and returns nil at the end of the stream.
Run(ctx context.Context) error
}
Driver is an element that needs a goroutine of its own. Exactly one element per scheduling segment is a Driver.
type Element ¶
type Element interface {
// Close releases the element's resources. It is safe to call more than
// once.
Close() error
}
Element is what a pipeline graph can own.
type EncodedFrame ¶
EncodedFrame is one coded picture.
type EncodedVideo ¶
EncodedVideo is the format of an edge carrying EncodedFrame. It carries no frame rate, because the wire does not: each EncodedFrame times itself.
func (EncodedVideo) String ¶
func (f EncodedVideo) String() string
type Format ¶
A Format says what an edge carries, with the parameters an element needs in order to configure itself for it. Each format pairs with one payload type by convention, so an element asserts the format it expects in Sink.Negotiate.
Formats are compared with ==, by the elements that merge several inputs into one output, so a format is a comparable value: a struct of scalars, not a pointer and not a struct holding a slice or a map.
type FrameRate ¶
type FrameRate struct {
Num, Den int
}
FrameRate is a nominal frame rate, in frames per second. Containers and codec APIs that want a timebase instead take the inverse fraction.
type GCC ¶
type GCC struct {
// contains filtered or unexported fields
}
func (*GCC) UpdateECNCounts ¶
UpdateECNCounts implements BWE.
type Nada ¶
type Nada struct {
// contains filtered or unexported fields
}
func NewNadaWithConfig ¶
func (*Nada) OnAck ¶
func (n *Nada) OnAck(sequenceNumber uint64, size int, departure time.Time, arrival time.Time, ecn ECN)
OnAck implements BWE.
func (*Nada) UpdateECNCounts ¶
UpdateECNCounts implements BWE.
type Packet ¶
type Packet[T any] interface { // Value is valid until Release. Value() *T // Clone returns an independent reference, which the caller must Release. Clone() Packet[T] // Release gives the reference up. Release() }
A Packet is one owned reference to a value of type T. Sink.Write and Puller.Pull transfer ownership, so the receiver must either Release the packet or pass it downstream. Clone first to keep or fan out a packet.
type Puller ¶
type Puller[T any] interface { Element // Format is what this puller produces. Format() Format // Pull hands the next packet to the caller, io.EOF at the end of the // stream. Pull(ctx context.Context) (Packet[T], error) }
Puller is a pull output: its downstream calls Pull.
type RTCP ¶
type RTCP struct{}
RTCP is the format of an edge carrying RTCPPacket. It has no parameters, because pipelines generate and parse RTCP internally.
type RTTSource ¶
type RTTSource interface {
// RTT returns the current round trip time of the connection.
RTT() time.Duration
}
RTTSource is implemented by a transport endpoint that knows the round trip time of the connection.
It is optional: a media pipeline that adapts to the RTT, such as one deciding how long to wait for a missing packet, type-asserts its endpoint to it and falls back to a fixed value for a transport that does not know its RTT.
type RawVideo ¶
type RawVideo struct {
Width, Height uint
Subsampling image.YCbCrSubsampleRatio
FrameRate FrameRate
}
RawVideo is the format of an edge carrying RawFrame.
type Sink ¶
type Sink[T any] interface { Element // Negotiate configures the sink for format f, or rejects it. It is called // once every edge is wired, before the first Write, and again before the // first packet of a new format. Negotiate(f Format) error // Write consumes one packet and takes ownership of it. It must not block // indefinitely: an element that cannot keep up drops instead. Write(p Packet[T]) error // EndOfStream reports that no more packets will arrive. EndOfStream() error }
Sink is a push input: its upstream calls Write.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cmdmain implements commands and subcommands.
|
Package cmdmain implements commands and subcommands. |
|
Package data carries non media payload as a pipeline: a source that produces chunks and a sink that consumes them, both over mrtp.DataChunk.
|
Package data carries non media payload as a pipeline: a source that produces chunks and a sink that consumes them, both over mrtp.DataChunk. |
|
internal
|
|
|
testvideo
Package testvideo generates synthetic I420 video for tests, so they need no video file.
|
Package testvideo generates synthetic I420 video for tests, so they need no video file. |
|
Package media defines the boundary between media pipelines and transports.
|
Package media defines the boundary between media pipelines and transports. |
|
Package pipeline is the machinery behind the mrtp element model: pooled packets, the graph that wires elements together and drives them, and the generic elements that every pipeline needs.
|
Package pipeline is the machinery behind the mrtp element model: pooled packets, the graph that wires elements together and drives them, and the generic elements that every pipeline needs. |
|
Package udp implements plain RTP over UDP as a transport.
|
Package udp implements plain RTP over UDP as a transport. |