mediamtx/internal/unit/unit.go
Alessandro Ros f5f03562d3
Some checks are pending
code_lint / go (push) Waiting to run
code_lint / go_mod (push) Waiting to run
code_lint / docs (push) Waiting to run
code_lint / api_docs (push) Waiting to run
code_test / test_64 (push) Waiting to run
code_test / test_32 (push) Waiting to run
code_test / test_e2e (push) Waiting to run
rewrite Unit definition (#5079)
Stream units now share the same struct, with a specialized payload.
2025-10-11 12:18:51 +02:00

29 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()
}