Do not use skip_remaining to fully wipe the cache.
Thanks to Uoti for pointing out the problem.

CC: libav-sta...@libav.org
---
 libavcodec/bitstream.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/bitstream.h b/libavcodec/bitstream.h
index d6dd2b9411..1b23cb2fa7 100644
--- a/libavcodec/bitstream.h
+++ b/libavcodec/bitstream.h
@@ -239,11 +239,13 @@ static inline void skip_remaining(BitstreamContext *bc, 
unsigned n)
 /* Skip n bits in the buffer. */
 static inline void bitstream_skip(BitstreamContext *bc, unsigned n)
 {
-    if (n <= bc->bits_left)
+    if (n < bc->bits_left)
         skip_remaining(bc, n);
     else {
         n -= bc->bits_left;
-        skip_remaining(bc, bc->bits_left);
+        bc->bits      = 0;
+        bc->bits_left = 0;
+
         if (n >= 64) {
             unsigned skip = n / 8;
 
-- 
2.12.2

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to