| @@ -48,6 +48,8 @@ void ff_vvc_unref_frame(VVCFrameContext *fc, VVCFrame *frame, int flags) · 47 unmodified lines |
| 48 | return; | 48 | return; |
| 49 | | 49 | |
| 50 | frame->flags &= ~flags; | 50 | frame->flags &= ~flags; |
| | 51 | if (!(frame->flags & ~VVC_FRAME_FLAG_CORRUPT)) |
| | 52 | frame->flags = 0; |
| 51 | if (!frame->flags) { | 53 | if (!frame->flags) { |
| 52 | av_frame_unref(frame->frame); | 54 | av_frame_unref(frame->frame); |
| 53 | av_refstruct_unref(&frame->sps); | 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 | if (nb_output) { | 282 | if (nb_output) { |
| 281 | VVCFrame *frame = &fc->DPB[min_idx]; | 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 | ret = av_frame_ref(out, frame->frame); | 288 | ret = av_frame_ref(out, frame->frame); |
| 284 | if (frame->flags & VVC_FRAME_FLAG_BUMPING) | 289 | if (frame->flags & VVC_FRAME_FLAG_BUMPING) |
| 285 | ff_vvc_unref_frame(fc, frame, VVC_FRAME_FLAG_OUTPUT | VVC_FRAME_FLAG_BUMPING); | 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 | frame->poc = poc; | 395 | frame->poc = poc; |
| 391 | frame->sequence = s->seq_decode; | 396 | frame->sequence = s->seq_decode; |
| 392 | frame->flags = 0; | 397 | frame->flags = VVC_FRAME_FLAG_CORRUPT; |
| 393 | | 398 | |
| 394 | ff_vvc_report_frame_finished(frame); | 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 | if (ref == fc->ref || list->nb_refs >= VVC_MAX_REF_ENTRIES) | 429 | if (ref == fc->ref || list->nb_refs >= VVC_MAX_REF_ENTRIES) |
| 425 | return AVERROR_INVALIDDATA; | 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 | if (!ref) { | 445 | if (!ref) { |
| 428 | ref = generate_missing_ref(s, fc, poc); | 446 | ref = generate_missing_ref(s, fc, poc); |
| 429 | if (!ref) | 447 | if (!ref) |