lavc/mediacodecdec_h264: fix SODB escaping
authorMatthieu Bouron <matthieu.bouron@stupeflix.com>
Tue, 6 Sep 2016 14:30:07 +0000 (16:30 +0200)
committerMatthieu Bouron <matthieu.bouron@stupeflix.com>
Wed, 28 Sep 2016 14:22:24 +0000 (16:22 +0200)
Fixes escaping of consecutive 0x00, 0x00, 0x0{0-3} sequences.

(cherry picked from commit f574012d5fe922684a5befa16828f22fe9a83ce8)

libavcodec/mediacodecdec_h264.c

index 11fb677..f663267 100644 (file)
@@ -103,9 +103,9 @@ static int h264_ps_to_nalu(const uint8_t *src, int src_size, uint8_t **out, int
             }
             *out = p = new;
 
-            i = i + 3;
-            memmove(p + i, p + i - 1, *out_size - i);
-            p[i - 1] = 0x03;
+            i = i + 2;
+            memmove(p + i + 1, p + i, *out_size - (i + 1));
+            p[i] = 0x03;
         }
     }
 done: