* commit '13ca5d34ba5c473211daaae0a101123bcaada3e6': cbs_h264: Add hack for pic_timing with no active SPS Partially fixes #6896 - the sample stream from that ticket now works, but more obscure cases can still fail.
Unified · Split
| @@ -560,6 +560,22 @@ static int FUNC(sei_pic_timing)(CodedBitstreamContext *ctx, RWContext *rw, · 559 unmodified lines | ||
| 560 | 560 | int err; |
| 561 | 561 | |
| 562 | 562 | sps = h264->active_sps; |
| 563 | + if (!sps) { | |
| 564 | + // If there is exactly one possible SPS but it is not yet active | |
| 565 | + // then just assume that it should be the active one. | |
| 566 | + int i, k = -1; | |
| 567 | + for (i = 0; i < H264_MAX_SPS_COUNT; i++) { | |
| 568 | + if (h264->sps[i]) { | |
| 569 | + if (k >= 0) { | |
| 570 | + k = -1; | |
| 571 | + break; | |
| 572 | + } | |
| 573 | + k = i; | |
| 574 | + } | |
| 575 | + } | |
| 576 | + if (k >= 0) | |
| 577 | + sps = h264->sps[k]; | |
| 578 | + } | |
| 563 | 579 | if (!sps) { |
| 564 | 580 | av_log(ctx->log_ctx, AV_LOG_ERROR, |
| 565 | 581 | "No active SPS for pic_timing.\n"); |