The segmentation fault occurs when CBR is selected without HRD parameter Signed-off-by: Xiang, Haihao <haihao.xi...@intel.com> --- src/gen6_mfc_common.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/gen6_mfc_common.c b/src/gen6_mfc_common.c index a6b418c..1f381ec 100644 --- a/src/gen6_mfc_common.c +++ b/src/gen6_mfc_common.c @@ -134,8 +134,8 @@ static void intel_mfc_brc_init(struct encode_state *encode_state, { struct gen6_mfc_context *mfc_context = encoder_context->mfc_context; VAEncSequenceParameterBufferH264 *pSequenceParameter = (VAEncSequenceParameterBufferH264 *)encode_state->seq_param_ext->buffer; - VAEncMiscParameterBuffer* pMiscParamHRD = (VAEncMiscParameterBuffer*)encode_state->misc_param[VAEncMiscParameterTypeHRD]->buffer; - VAEncMiscParameterHRD* pParameterHRD = (VAEncMiscParameterHRD*)pMiscParamHRD->data; + VAEncMiscParameterBuffer* pMiscParamHRD = NULL; + VAEncMiscParameterHRD* pParameterHRD = NULL; double bitrate = pSequenceParameter->bits_per_second; double framerate = (double)pSequenceParameter->time_scale /(2 * (double)pSequenceParameter->num_units_in_tick); int inum = 1, pnum = 0, bnum = 0; /* Gop structure: number of I, P, B frames in the Gop. */ @@ -145,6 +145,12 @@ static void intel_mfc_brc_init(struct encode_state *encode_state, double qp51_size = 0.001 * 8 * 3 * (pSequenceParameter->picture_width_in_mbs<<4) * (pSequenceParameter->picture_height_in_mbs<<4)/2; double bpf; + if (!encode_state->misc_param[VAEncMiscParameterTypeHRD] || !encode_state->misc_param[VAEncMiscParameterTypeHRD]->buffer) + return; + + pMiscParamHRD = (VAEncMiscParameterBuffer*)encode_state->misc_param[VAEncMiscParameterTypeHRD]->buffer; + pParameterHRD = (VAEncMiscParameterHRD*)pMiscParamHRD->data; + if (pSequenceParameter->ip_period) { pnum = (intra_period + ip_period - 1)/ip_period - 1; bnum = intra_period - inum - pnum; -- 1.9.1 _______________________________________________ Libva mailing list Libva@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libva