[FFmpeg-cvslog] cbs_h264: Add hack for pic_timing with no active SPS

Mark Thompson git at videolan.org
Thu Feb 22 00:10:52 EET 2018


ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Mon Dec 11 00:22:42 2017 +0000| [13ca5d34ba5c473211daaae0a101123bcaada3e6] | committer: Mark Thompson

cbs_h264: Add hack for pic_timing with no active SPS

If there is exactly one possible SPS but it is not yet active then just
assume that it should be the active one.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=13ca5d34ba5c473211daaae0a101123bcaada3e6
---

 libavcodec/cbs_h264_syntax_template.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/libavcodec/cbs_h264_syntax_template.c b/libavcodec/cbs_h264_syntax_template.c
index 0fe18441c0..c2fd546822 100644
--- a/libavcodec/cbs_h264_syntax_template.c
+++ b/libavcodec/cbs_h264_syntax_template.c
@@ -561,6 +561,22 @@ static int FUNC(sei_pic_timing)(CodedBitstreamContext *ctx, RWContext *rw,
 
     sps = h264->active_sps;
     if (!sps) {
+        // If there is exactly one possible SPS but it is not yet active
+        // then just assume that it should be the active one.
+        int i, k = -1;
+        for (i = 0; i < H264_MAX_SPS_COUNT; i++) {
+            if (h264->sps[i]) {
+                if (k >= 0) {
+                    k = -1;
+                    break;
+                }
+                k = i;
+            }
+        }
+        if (k >= 0)
+            sps = h264->sps[k];
+    }
+    if (!sps) {
         av_log(ctx->log_ctx, AV_LOG_ERROR,
                "No active SPS for pic_timing.\n");
         return AVERROR_INVALIDDATA;



More information about the ffmpeg-cvslog mailing list