| @@ -48,6 +48,8 @@ void ff_vvc_unref_frame(VVCFrameContext *fc, VVCFrame *frame, int flags) · 47 unmodified lines |
| 48 | 48 | return; |
| 49 | 49 | |
| 50 | 50 | frame->flags &= ~flags; |
| 51 | + if (!(frame->flags & ~VVC_FRAME_FLAG_CORRUPT)) |
| 52 | + frame->flags = 0; |
| 51 | 53 | if (!frame->flags) { |
| 52 | 54 | av_frame_unref(frame->frame); |
| 53 | 55 | av_refstruct_unref(&frame->sps); |
| @@ -280,6 +282,9 @@ int ff_vvc_output_frame(VVCContext *s, VVCFrameContext *fc, AVFrame *out, const · 226 unmodified lines |
| 280 | 282 | if (nb_output) { |
| 281 | 283 | VVCFrame *frame = &fc->DPB[min_idx]; |
| 282 | 284 | |
| 285 | + if (frame->flags & VVC_FRAME_FLAG_CORRUPT) |
| 286 | + frame->frame->flags |= AV_FRAME_FLAG_CORRUPT; |
| 287 | + |
| 283 | 288 | ret = av_frame_ref(out, frame->frame); |
| 284 | 289 | if (frame->flags & VVC_FRAME_FLAG_BUMPING) |
| 285 | 290 | ff_vvc_unref_frame(fc, frame, VVC_FRAME_FLAG_OUTPUT | VVC_FRAME_FLAG_BUMPING); |
| @@ -389,7 +394,7 @@ static VVCFrame *generate_missing_ref(VVCContext *s, VVCFrameContext *fc, int po · 103 unmodified lines |
| 389 | 394 | |
| 390 | 395 | frame->poc = poc; |
| 391 | 396 | frame->sequence = s->seq_decode; |
| 392 | | − frame->flags = 0; |
| 397 | + frame->flags = VVC_FRAME_FLAG_CORRUPT; |
| 393 | 398 | |
| 394 | 399 | ff_vvc_report_frame_finished(frame); |
| 395 | 400 | |
| @@ -424,6 +429,19 @@ static int add_candidate_ref(VVCContext *s, VVCFrameContext *fc, RefPicList *lis · 28 unmodified lines |
| 424 | 429 | if (ref == fc->ref || list->nb_refs >= VVC_MAX_REF_ENTRIES) |
| 425 | 430 | return AVERROR_INVALIDDATA; |
| 426 | 431 | |
| 432 | + if (!IS_CVSS(s)) { |
| 433 | + const bool ref_corrupt = !ref || (ref->flags & VVC_FRAME_FLAG_CORRUPT); |
| 434 | + const bool recovering = s->no_output_before_recovery_flag && !GDR_IS_RECOVERED(s); |
| 435 | + |
| 436 | + if (ref_corrupt && !recovering) { |
| 437 | + if (!(s->avctx->flags & AV_CODEC_FLAG_OUTPUT_CORRUPT) && |
| 438 | + !(s->avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL)) |
| 439 | + return AVERROR_INVALIDDATA; |
| 440 | + |
| 441 | + fc->ref->flags |= VVC_FRAME_FLAG_CORRUPT; |
| 442 | + } |
| 443 | + } |
| 444 | + |
| 427 | 445 | if (!ref) { |
| 428 | 446 | ref = generate_missing_ref(s, fc, poc); |
| 429 | 447 | if (!ref) |