Skip to content

Commit

Permalink
hevc: clear unused refs on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
elenril committed Jan 27, 2015
1 parent f9f883a commit 1dd0219
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions libavcodec/hevc_refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ int ff_hevc_frame_rps(HEVCContext *s)
const ShortTermRPS *short_rps = s->sh.short_term_rps;
const LongTermRPS *long_rps = &s->sh.long_term_rps;
RefPicList *rps = s->rps;
int i, ret;
int i, ret = 0;

if (!short_rps) {
rps[0].nb_refs = rps[1].nb_refs = 0;
Expand Down Expand Up @@ -424,7 +424,7 @@ int ff_hevc_frame_rps(HEVCContext *s)

ret = add_candidate_ref(s, &rps[list], poc, HEVC_FRAME_FLAG_SHORT_REF);
if (ret < 0)
return ret;
goto fail;
}

/* add the long refs */
Expand All @@ -434,14 +434,15 @@ int ff_hevc_frame_rps(HEVCContext *s)

ret = add_candidate_ref(s, &rps[list], poc, HEVC_FRAME_FLAG_LONG_REF);
if (ret < 0)
return ret;
goto fail;
}

fail:
/* release any frames that are now unused */
for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++)
ff_hevc_unref_frame(s, &s->DPB[i], 0);

return 0;
return ret;
}

int ff_hevc_compute_poc(HEVCContext *s, int poc_lsb)
Expand Down

0 comments on commit 1dd0219

Please sign in to comment.