diff --git a/libmpeg/source/mpeg-ts-h264.c b/libmpeg/source/mpeg-ts-h264.c index bc6c62b9..f648be2b 100644 --- a/libmpeg/source/mpeg-ts-h264.c +++ b/libmpeg/source/mpeg-ts-h264.c @@ -147,7 +147,7 @@ int mpeg_h264_find_new_access_unit(const uint8_t* data, size_t bytes, int* vcl) { // pes data loss ??? *vcl = MPEG_VCL_CORRUPT; - return (int)(p - data + n - leading); + return (int)(p - data + n - (leading>3?3:leading)); } else { diff --git a/libmpeg/source/mpeg-ts-h265.c b/libmpeg/source/mpeg-ts-h265.c index a6666a90..0eb8149d 100644 --- a/libmpeg/source/mpeg-ts-h265.c +++ b/libmpeg/source/mpeg-ts-h265.c @@ -122,7 +122,7 @@ int mpeg_h265_find_new_access_unit(const uint8_t* data, size_t bytes, int* vcl) { // pes data loss ??? *vcl = MPEG_VCL_CORRUPT; // for assert - return (int)(p - data + n - leading); + return (int)(p - data + n - (leading > 3 ? 3 : leading)); } else { diff --git a/libmpeg/source/mpeg-ts-h266.c b/libmpeg/source/mpeg-ts-h266.c index d558d4d3..575ba203 100644 --- a/libmpeg/source/mpeg-ts-h266.c +++ b/libmpeg/source/mpeg-ts-h266.c @@ -86,7 +86,7 @@ int mpeg_h266_find_new_access_unit(const uint8_t* data, size_t bytes, int* vcl) { // pes data loss ??? *vcl = MPEG_VCL_CORRUPT; // for assert - return (int)(p - data + n - leading); + return (int)(p - data + n - (leading > 3 ? 3 : leading)); } else {