mirror of https://bitbucket.org/ausocean/av.git
container/mts/mpegts.go: error test for invalid packet size in FindPid corrected
This commit is contained in:
parent
9dcf866162
commit
bccd7c2762
|
@ -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])
|
||||||
|
|
Loading…
Reference in New Issue