Commit 74e5a5a8 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '1dd02192'

* commit '1dd02192':
  hevc: clear unused refs on failure
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents ed8de157 1dd02192
...@@ -459,7 +459,7 @@ int ff_hevc_frame_rps(HEVCContext *s) ...@@ -459,7 +459,7 @@ int ff_hevc_frame_rps(HEVCContext *s)
const ShortTermRPS *short_rps = s->sh.short_term_rps; const ShortTermRPS *short_rps = s->sh.short_term_rps;
const LongTermRPS *long_rps = &s->sh.long_term_rps; const LongTermRPS *long_rps = &s->sh.long_term_rps;
RefPicList *rps = s->rps; RefPicList *rps = s->rps;
int i, ret; int i, ret = 0;
if (!short_rps) { if (!short_rps) {
rps[0].nb_refs = rps[1].nb_refs = 0; rps[0].nb_refs = rps[1].nb_refs = 0;
...@@ -493,7 +493,7 @@ int ff_hevc_frame_rps(HEVCContext *s) ...@@ -493,7 +493,7 @@ int ff_hevc_frame_rps(HEVCContext *s)
ret = add_candidate_ref(s, &rps[list], poc, HEVC_FRAME_FLAG_SHORT_REF); ret = add_candidate_ref(s, &rps[list], poc, HEVC_FRAME_FLAG_SHORT_REF);
if (ret < 0) if (ret < 0)
return ret; goto fail;
} }
/* add the long refs */ /* add the long refs */
...@@ -503,14 +503,15 @@ int ff_hevc_frame_rps(HEVCContext *s) ...@@ -503,14 +503,15 @@ int ff_hevc_frame_rps(HEVCContext *s)
ret = add_candidate_ref(s, &rps[list], poc, HEVC_FRAME_FLAG_LONG_REF); ret = add_candidate_ref(s, &rps[list], poc, HEVC_FRAME_FLAG_LONG_REF);
if (ret < 0) if (ret < 0)
return ret; goto fail;
} }
fail:
/* release any frames that are now unused */ /* release any frames that are now unused */
for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++)
ff_hevc_unref_frame(s, &s->DPB[i], 0); ff_hevc_unref_frame(s, &s->DPB[i], 0);
return 0; return ret;
} }
int ff_hevc_compute_poc(HEVCContext *s, int poc_lsb) int ff_hevc_compute_poc(HEVCContext *s, int poc_lsb)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment