• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

hardware/intel/intel-driver


Commit MetaInfo

Revisão70579a58e6684add8b7f50b8f10be7bb473700cb (tree)
Hora2015-04-29 16:52:24
AutorXiang, Haihao <haihao.xiang@inte...>
CommiterXiang, Haihao

Mensagem de Log

Fix segmentation fault

The segmentation fault occurs when CBR is selected without HRD parameter

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>

Mudança Sumário

Diff

--- 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,
134134 {
135135 struct gen6_mfc_context *mfc_context = encoder_context->mfc_context;
136136 VAEncSequenceParameterBufferH264 *pSequenceParameter = (VAEncSequenceParameterBufferH264 *)encode_state->seq_param_ext->buffer;
137- VAEncMiscParameterBuffer* pMiscParamHRD = (VAEncMiscParameterBuffer*)encode_state->misc_param[VAEncMiscParameterTypeHRD]->buffer;
138- VAEncMiscParameterHRD* pParameterHRD = (VAEncMiscParameterHRD*)pMiscParamHRD->data;
137+ VAEncMiscParameterBuffer* pMiscParamHRD = NULL;
138+ VAEncMiscParameterHRD* pParameterHRD = NULL;
139139 double bitrate = pSequenceParameter->bits_per_second;
140140 double framerate = (double)pSequenceParameter->time_scale /(2 * (double)pSequenceParameter->num_units_in_tick);
141141 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,
145145 double qp51_size = 0.001 * 8 * 3 * (pSequenceParameter->picture_width_in_mbs<<4) * (pSequenceParameter->picture_height_in_mbs<<4)/2;
146146 double bpf;
147147
148+ if (!encode_state->misc_param[VAEncMiscParameterTypeHRD] || !encode_state->misc_param[VAEncMiscParameterTypeHRD]->buffer)
149+ return;
150+
151+ pMiscParamHRD = (VAEncMiscParameterBuffer*)encode_state->misc_param[VAEncMiscParameterTypeHRD]->buffer;
152+ pParameterHRD = (VAEncMiscParameterHRD*)pMiscParamHRD->data;
153+
148154 if (pSequenceParameter->ip_period) {
149155 pnum = (intra_period + ip_period - 1)/ip_period - 1;
150156 bnum = intra_period - inum - pnum;