[FFmpeg-devel] [PATCH] h264_mp4toannexb

赵宇龙 zylthinking at gmail.com
Fri Oct 9 07:59:56 CEST 2015


>From 9654bf635c72fd3bd4208afcf4a1b8b8667735db Mon Sep 17 00:00:00 2001
From: zylthinking <zylthinking at gmail.com>
Date: Fri, 9 Oct 2015 13:46:45 +0800
Subject: [PATCH] fix pps offfset fault when there are more than one sps in
 avcc

the pps offset is used to locate pps in the spspps_buf; however, the
current calc method maybe be 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
---
 libavcodec/h264_mp4toannexb_bsf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/h264_mp4toannexb_bsf.c
b/libavcodec/h264_mp4toannexb_bsf.c
index a5da84a..6c620fa 100644
--- a/libavcodec/h264_mp4toannexb_bsf.c
+++ b/libavcodec/h264_mp4toannexb_bsf.c
@@ -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;
             }
         }
-- 
2.3.4


More information about the ffmpeg-devel mailing list