Files
mediamtx/internal/unit/unit.go
T
Alessandro RosandGitHub f5f03562d3 rewrite Unit definition (#5079)
Stream units now share the same struct, with a specialized payload.
2025-10-11 12:18:51 +02:00

30 lines
476 B
Go

// Package unit contains the unit definition.
package unit
import (
"reflect"
"time"
"github.com/pion/rtp"
)
// Unit is an atomic unit of a stream.
type Unit struct {
// relative time
PTS int64
// absolute time
NTP time.Time
// RTP packets
RTPPackets []*rtp.Packet
// codec-dependent payload
Payload Payload
}
// NilPayload checks whether the payload is nil.
func (u Unit) NilPayload() bool {
return u.Payload == nil || reflect.ValueOf(u.Payload).IsNil()
}