From 59bf9d15a81cc9d074c99e266ee618eb4bd5d8fb Mon Sep 17 00:00:00 2001 From: Alan Noble Date: Sun, 12 Nov 2023 06:42:45 +0000 Subject: [PATCH] Include PID in mts.FindPid error Approved-by: Trek Hopton Approved-by: David Sutton --- container/mts/mpegts.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/container/mts/mpegts.go b/container/mts/mpegts.go index cdabf239..bda0ca8f 100644 --- a/container/mts/mpegts.go +++ b/container/mts/mpegts.go @@ -176,7 +176,6 @@ func FindPat(d []byte) ([]byte, int, error) { // Errors used by FindPid. var ( ErrInvalidLen = errors.New("MPEG-TS data not of valid length") - errCouldNotFind = errors.New("could not find packet with given PID") ) // FindPid will take a clip of MPEG-TS and try to find a packet with given PID - if one @@ -192,7 +191,7 @@ func FindPid(d []byte, pid uint16) (pkt []byte, i int, err error) { return } } - return nil, -1, errCouldNotFind + return nil, -1, fmt.Errorf("could not find packet with PID %d", pid) } // LastPid will take a clip of MPEG-TS and try to find a packet @@ -211,7 +210,7 @@ func LastPid(d []byte, pid uint16) (pkt []byte, i int, err error) { return } } - return nil, -1, errCouldNotFind + return nil, -1, fmt.Errorf("could not find packet with PID %d", pid) } // Errors used by FindPSI.