From 8f8ae7c5589ea7616d4242b03040b799a6838b25 Mon Sep 17 00:00:00 2001 From: Saxon Date: Sat, 11 May 2019 13:50:40 +0930 Subject: [PATCH] container/mts: using uint16 for PID always --- container/mts/encoder.go | 4 ++-- container/mts/mpegts.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/container/mts/encoder.go b/container/mts/encoder.go index a50c2615..fbcd4cc6 100644 --- a/container/mts/encoder.go +++ b/container/mts/encoder.go @@ -303,12 +303,12 @@ func (e *Encoder) tick() { // pts retuns the current presentation timestamp. func (e *Encoder) pts() uint64 { - return uint64((e.clock + e.ptsOffset).Seconds() * PTSFreq) + return uint64((e.clock + e.ptsOffset).Seconds() * PTSFrequency) } // pcr returns the current program clock reference. func (e *Encoder) pcr() uint64 { - return uint64(e.clock.Seconds() * PCRFreq) + return uint64(e.clock.Seconds() * PCRFrequency) } // ccFor returns the next continuity counter for pid. diff --git a/container/mts/mpegts.go b/container/mts/mpegts.go index f5fae7dc..3145dab9 100644 --- a/container/mts/mpegts.go +++ b/container/mts/mpegts.go @@ -318,9 +318,9 @@ func DiscontinuityIndicator(f bool) Option { } // GetPTSRange retreives the first and last PTS of an MPEGTS clip. -func GetPTSRange(clip []byte, pidType int) (pts [2]uint64, err error) { +func GetPTSRange(clip []byte, pidType uint16) (pts [2]uint64, err error) { // Find the first packet with PID pidType. - pkt, _, err := FindPid(clip, uint16(pidType)) + pkt, _, err := FindPid(clip, pidType) if err != nil { return [2]uint64{}, err } @@ -344,7 +344,7 @@ func GetPTSRange(clip []byte, pidType int) (pts [2]uint64, err error) { // Get the final PTS searching from end of clip for access unit start. for i := len(clip) - PacketSize; i >= 0; i -= PacketSize { copy(_pkt[:], clip[i:i+PacketSize]) - if packet.PayloadUnitStartIndicator(&_pkt) && _pkt.PID() == pidType { + if packet.PayloadUnitStartIndicator(&_pkt) && uint16(_pkt.PID()) == pidType { payload, err = packet.Payload(&_pkt) if err != nil { return [2]uint64{}, err