vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlc...@free.fr> | Wed Apr 
11 18:29:22 2018 +0200| [0763f19727a52758699b919930d06c3278d08a11] | committer: 
Francois Cartegnie

packetizer: return annexb startcode up to end

fixes glitches on streams when startcode ends a packet
(mpegvideo + ps, probably others)

(cherry picked from commit 42ab152c79863ef76f73abd5b4f89a26f1106a5a)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=0763f19727a52758699b919930d06c3278d08a11
---

 modules/packetizer/startcode_helper.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/packetizer/startcode_helper.h 
b/modules/packetizer/startcode_helper.h
index 04d79a280b..136c384247 100644
--- a/modules/packetizer/startcode_helper.h
+++ b/modules/packetizer/startcode_helper.h
@@ -52,7 +52,7 @@ static inline const uint8_t * startcode_FindAnnexB_SSE2( 
const uint8_t *p, const
     /* First align to 16 */
     /* Skipping this step and doing unaligned loads isn't faster */
     const uint8_t *alignedend = p + 16 - ((intptr_t)p & 15);
-    for (end -= 3; p < alignedend && p < end; p++) {
+    for (end -= 3; p < alignedend && p <= end; p++) {
         if (p[0] == 0 && p[1] == 0 && p[2] == 1)
             return p;
     }
@@ -99,7 +99,7 @@ static inline const uint8_t * startcode_FindAnnexB_SSE2( 
const uint8_t *p, const
         }
     }
 
-    for (; p < end; p++) {
+    for (; p <= end; p++) {
         if (p[0] == 0 && p[1] == 0 && p[2] == 1)
             return p;
     }
@@ -121,7 +121,7 @@ static inline const uint8_t * startcode_FindAnnexB( const 
uint8_t *p, const uint
 #endif
     const uint8_t *a = p + 4 - ((intptr_t)p & 3);
 
-    for (end -= 3; p < a && p < end; p++) {
+    for (end -= 3; p < a && p <= end; p++) {
         if (p[0] == 0 && p[1] == 0 && p[2] == 1)
             return p;
     }
@@ -135,7 +135,7 @@ static inline const uint8_t * startcode_FindAnnexB( const 
uint8_t *p, const uint
         }
     }
 
-    for (end += 3; p < end; p++) {
+    for (end += 3; p <= end; p++) {
         if (p[0] == 0 && p[1] == 0 && p[2] == 1)
             return p;
     }

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to