Re: [libav-devel] [PATCH 09/16] cbs_h264: Add hack for pic_timing with no active SPS

2018-02-18 Thread Luca Barbato

On 11/02/2018 19:14, Mark Thompson wrote:

If there is exactly one possible SPS but it is not yet active then just
assume that it should be the active one.
---
  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 0fe18441c..c2fd54682 100644
--- a/libavcodec/cbs_h264_syntax_template.c
+++ b/libavcodec/cbs_h264_syntax_template.c
@@ -560,6 +560,22 @@ static int FUNC(sei_pic_timing)(CodedBitstreamContext 
*ctx, RWContext *rw,
  int err;
  
  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");



Probably ok.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH 09/16] cbs_h264: Add hack for pic_timing with no active SPS

2018-02-11 Thread Mark Thompson
If there is exactly one possible SPS but it is not yet active then just
assume that it should be the active one.
---
 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 0fe18441c..c2fd54682 100644
--- a/libavcodec/cbs_h264_syntax_template.c
+++ b/libavcodec/cbs_h264_syntax_template.c
@@ -560,6 +560,22 @@ static int FUNC(sei_pic_timing)(CodedBitstreamContext 
*ctx, RWContext *rw,
 int err;
 
 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");
-- 
2.15.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel