h264_mp4toannexb: fix the pps offset when there are more than one sps in avcc
author赵宇龙 <zylthinking@gmail.com>
Fri, 9 Oct 2015 05:59:56 +0000 (13:59 +0800)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 9 Oct 2015 23:37:00 +0000 (01:37 +0200)
the pps offset is used to locate pps in the spspps_buf; however, the
current calc method is wrong because it is the offset of the original
avctx->extradata;
when there is only one sps in the avcc; the value is correct by
coincidence, however, it will fail in avcc with multi sps

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/h264_mp4toannexb_bsf.c

index a927bab3f808a661fcdae52f10f40c59284e3159..2d447f7550706778bdcc7c7a40dbc61ca4b73d9d 100644 (file)
@@ -122,7 +122,7 @@ pps:
         if (!unit_nb && !sps_done++) {
             unit_nb = *extradata++; /* number of pps unit(s) */
             if (unit_nb) {
-                ctx->pps_offset = (extradata - 1) - (avctx->extradata + 4);
+                ctx->pps_offset = total_size;
                 pps_seen = 1;
             }
         }