aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2015-09-12 21:50:24 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2015-10-09 21:57:05 +0200
commit7b6fced6b49f2e1c9a53a3a398a05d27d7ec932d (patch)
treeecd1652dab5ca6df0b37629dadf83809435b5f43
parentcac62c8ad9f17fa8733d425c28b984d2be833351 (diff)
downloadffmpeg-7b6fced6b49f2e1c9a53a3a398a05d27d7ec932d.tar.gz
hevc: properly handle no_rasl_output_flag when removing pictures from the DPB
Fixes ticket #4185. Reviewed-By: Mickael Raulet <Mickael.Raulet@insa-rennes.fr> Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com> (cherry picked from commit 0118158efa8e45761f9f65a3bb74f33907bd2aec)
-rw-r--r--libavcodec/hevc.c5
-rw-r--r--libavcodec/hevc.h1
-rw-r--r--libavcodec/hevc_refs.c2
3 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 5a71a8b09c..2f440a6daf 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -769,6 +769,8 @@ static int hls_slice_header(HEVCContext *s)
s->HEVClc->tu.cu_qp_offset_cb = 0;
s->HEVClc->tu.cu_qp_offset_cr = 0;
+ s->no_rasl_output_flag = IS_IDR(s) || IS_BLA(s) || (s->nal_unit_type == NAL_CRA_NUT && s->last_eos);
+
return 0;
}
@@ -3292,6 +3294,7 @@ static int hevc_update_thread_context(AVCodecContext *dst,
s->pocTid0 = s0->pocTid0;
s->max_ra = s0->max_ra;
s->eos = s0->eos;
+ s->no_rasl_output_flag = s0->no_rasl_output_flag;
s->is_nalff = s0->is_nalff;
s->nal_length_size = s0->nal_length_size;
@@ -3386,6 +3389,7 @@ static av_cold int hevc_decode_init(AVCodecContext *avctx)
s->enable_parallel_tiles = 0;
s->picture_struct = 0;
+ s->eos = 1;
if(avctx->active_thread_type & FF_THREAD_SLICE)
s->threads_number = avctx->thread_count;
@@ -3427,6 +3431,7 @@ static void hevc_decode_flush(AVCodecContext *avctx)
HEVCContext *s = avctx->priv_data;
ff_hevc_flush_dpb(s);
s->max_ra = INT_MAX;
+ s->eos = 1;
}
#define OFFSET(x) offsetof(HEVCContext, x)
diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h
index d88c7a527f..564e66e3e6 100644
--- a/libavcodec/hevc.h
+++ b/libavcodec/hevc.h
@@ -835,6 +835,7 @@ typedef struct HEVCContext {
int bs_height;
int is_decoded;
+ int no_rasl_output_flag;
HEVCPredContext hpc;
HEVCDSPContext hevcdsp;
diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
index b3a97871d5..dc35d3591a 100644
--- a/libavcodec/hevc_refs.c
+++ b/libavcodec/hevc_refs.c
@@ -158,7 +158,7 @@ int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush)
int min_poc = INT_MAX;
int i, min_idx, ret;
- if (s->sh.no_output_of_prior_pics_flag == 1) {
+ if (s->sh.no_output_of_prior_pics_flag == 1 && s->no_rasl_output_flag == 1) {
for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) {
HEVCFrame *frame = &s->DPB[i];
if (!(frame->flags & HEVC_FRAME_FLAG_BUMPING) && frame->poc != s->poc &&