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