Merge commit '373fd76b4dbd9aa03ed28e502f33f2ca8c1ce19a'
authorClément Bœsch <u@pkh.me>
Wed, 26 Apr 2017 15:25:54 +0000 (17:25 +0200)
committerClément Bœsch <u@pkh.me>
Wed, 26 Apr 2017 15:25:54 +0000 (17:25 +0200)
* commit '373fd76b4dbd9aa03ed28e502f33f2ca8c1ce19a':
  hevcdec: do not set decoder-global SPS prematurely

Merged-by: Clément Bœsch <u@pkh.me>
1  2 
libavcodec/hevcdec.c

@@@ -455,23 -477,14 +455,23 @@@ static int hls_slice_header(HEVCContex
          return AVERROR_INVALIDDATA;
      }
      s->ps.pps = (HEVCPPS*)s->ps.pps_list[sh->pps_id]->data;
 +    if (s->nal_unit_type == HEVC_NAL_CRA_NUT && s->last_eos == 1)
 +        sh->no_output_of_prior_pics_flag = 1;
  
      if (s->ps.sps != (HEVCSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data) {
-         const HEVCSPS* last_sps = s->ps.sps;
+         const HEVCSPS *sps = (HEVCSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data;
++        const HEVCSPS *last_sps = s->ps.sps;
          enum AVPixelFormat pix_fmt;
  
-         s->ps.sps = (HEVCSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data;
 +        if (last_sps && IS_IRAP(s) && s->nal_unit_type != HEVC_NAL_CRA_NUT) {
-             if (s->ps.sps->width !=  last_sps->width || s->ps.sps->height != last_sps->height ||
-                 s->ps.sps->temporal_layer[s->ps.sps->max_sub_layers - 1].max_dec_pic_buffering !=
++            if (sps->width != last_sps->width || sps->height != last_sps->height ||
++                sps->temporal_layer[sps->max_sub_layers - 1].max_dec_pic_buffering !=
 +                last_sps->temporal_layer[last_sps->max_sub_layers - 1].max_dec_pic_buffering)
 +                sh->no_output_of_prior_pics_flag = 0;
 +        }
          ff_hevc_clear_refs(s);
  
-         pix_fmt = get_format(s, s->ps.sps);
+         pix_fmt = get_format(s, sps);
          if (pix_fmt < 0)
              return pix_fmt;