[FFmpeg-cvslog] hevc: clear unused refs on failure
Anton Khirnov
git at videolan.org
Tue Jan 27 13:09:17 CET 2015
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Nov 20 09:26:35 2014 +0100| [1dd021929f8157b88529ce1e6ab6351dd2899e89] | committer: Anton Khirnov
hevc: clear unused refs on failure
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1dd021929f8157b88529ce1e6ab6351dd2899e89
---
libavcodec/hevc_refs.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
index 658ead7..ccb441b 100644
--- a/libavcodec/hevc_refs.c
+++ b/libavcodec/hevc_refs.c
@@ -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;
@@ -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 */
@@ -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)
More information about the ffmpeg-cvslog
mailing list