]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/h264_mp4toannexb_bsf.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavcodec / h264_mp4toannexb_bsf.c
index e7f2e7ab04628f248a054849922021455058c165..e85bdb671225d8b5cfe70ebc31f93906d2abc0ad 100644 (file)
@@ -87,14 +87,8 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
         /* retrieve sps and pps unit(s) */
         unit_nb = *extradata++ & 0x1f; /* number of sps unit(s) */
         if (!unit_nb) {
-            unit_nb = *extradata++; /* number of pps unit(s) */
-            sps_done++;
-
-            if (unit_nb)
-                pps_seen = 1;
-        }
-        else
-        {
+            goto pps;
+        } else {
             sps_seen = 1;
         }
 
@@ -117,9 +111,12 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
             memcpy(out+total_size-unit_size-4, nalu_header, 4);
             memcpy(out+total_size-unit_size,   extradata+2, unit_size);
             extradata += 2+unit_size;
-
-            if (!unit_nb && !sps_done++)
+pps:
+            if (!unit_nb && !sps_done++) {
                 unit_nb = *extradata++; /* number of pps unit(s) */
+                if (unit_nb)
+                    pps_seen = 1;
+            }
         }
 
         if(out)