rename Data into Unit (#1556)

This commit is contained in:
Alessandro Ros
2023-03-10 12:44:59 +01:00
committed by GitHub
parent 25dc252342
commit e8bdad8a1e
23 changed files with 240 additions and 237 deletions

View File

@@ -9,21 +9,21 @@ import (
"github.com/pion/rtp"
)
// DataMPEG4Audio is a MPEG4-audio data unit.
type DataMPEG4Audio struct {
// UnitMPEG4Audio is a MPEG4-audio data unit.
type UnitMPEG4Audio struct {
RTPPackets []*rtp.Packet
NTP time.Time
PTS time.Duration
AUs [][]byte
}
// GetRTPPackets implements Data.
func (d *DataMPEG4Audio) GetRTPPackets() []*rtp.Packet {
// GetRTPPackets implements Unit.
func (d *UnitMPEG4Audio) GetRTPPackets() []*rtp.Packet {
return d.RTPPackets
}
// GetNTP implements Data.
func (d *DataMPEG4Audio) GetNTP() time.Time {
// GetNTP implements Unit.
func (d *UnitMPEG4Audio) GetNTP() time.Time {
return d.NTP
}
@@ -48,11 +48,11 @@ func newMPEG4Audio(
return t, nil
}
func (t *formatProcessorMPEG4Audio) Process(dat Data, hasNonRTSPReaders bool) error { //nolint:dupl
tdata := dat.(*DataMPEG4Audio)
func (t *formatProcessorMPEG4Audio) Process(unit Unit, hasNonRTSPReaders bool) error { //nolint:dupl
tunit := unit.(*UnitMPEG4Audio)
if tdata.RTPPackets != nil {
pkt := tdata.RTPPackets[0]
if tunit.RTPPackets != nil {
pkt := tunit.RTPPackets[0]
// remove padding
pkt.Header.Padding = false
@@ -77,19 +77,19 @@ func (t *formatProcessorMPEG4Audio) Process(dat Data, hasNonRTSPReaders bool) er
return err
}
tdata.AUs = aus
tdata.PTS = PTS
tunit.AUs = aus
tunit.PTS = PTS
}
// route packet as is
return nil
}
pkts, err := t.encoder.Encode(tdata.AUs, tdata.PTS)
pkts, err := t.encoder.Encode(tunit.AUs, tunit.PTS)
if err != nil {
return err
}
tdata.RTPPackets = pkts
tunit.RTPPackets = pkts
return nil
}