container/mts/mpegts.go: error test for invalid packet size in FindPid corrected

This commit is contained in:
Saxon 2019-05-08 00:07:23 +09:30
parent 9dcf866162
commit bccd7c2762
1 changed files with 1 additions and 1 deletions

View File

@ -175,7 +175,7 @@ func FindPat(d []byte) ([]byte, int, error) {
// is found, then it is returned along with its index, otherwise nil, -1 and an error is returned. // is found, then it is returned along with its index, otherwise nil, -1 and an error is returned.
func FindPid(d []byte, pid uint16) (pkt []byte, i int, err error) { func FindPid(d []byte, pid uint16) (pkt []byte, i int, err error) {
if len(d) < PacketSize { if len(d) < PacketSize {
return nil, -1, errors.New("Mpegts data not of valid length") return nil, -1, errors.New("MPEGTS data not of valid length")
} }
for i = 0; i < len(d); i += PacketSize { for i = 0; i < len(d); i += PacketSize {
p := (uint16(d[i+1]&0x1f) << 8) | uint16(d[i+2]) p := (uint16(d[i+1]&0x1f) << 8) | uint16(d[i+2])