diff options
author | Sreerenj Balachandran <sreerenj.balachandran@intel.com> | 2017-12-01 23:38:20 -0800 |
---|---|---|
committer | Sreerenj Balachandran <sreerenj.balachandran@intel.com> | 2017-12-01 23:40:46 -0800 |
commit | 9be5ffecc73b793a4d2496ab230760a9c62db9f0 (patch) | |
tree | f4f771f3138c1ad80760953374f65069e73882bc | |
parent | 59bd211d3c2fb5abd32ea387d637bc8ce37e2e6f (diff) |
Statistics/Preenc: Fix mem leakpreenc
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapi_preenc_h264.c | 64 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c | 2 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapifei_objects.c | 1 |
3 files changed, 38 insertions, 29 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapi_preenc_h264.c b/gst-libs/gst/vaapi/gstvaapi_preenc_h264.c index 75b28db6..702afbca 100644 --- a/gst-libs/gst/vaapi/gstvaapi_preenc_h264.c +++ b/gst-libs/gst/vaapi/gstvaapi_preenc_h264.c @@ -520,6 +520,8 @@ gst_vaapi_preenc_h264_configure (GstVaapiPreEnc * preenc_base, /* Strore in prenc object */ gst_vaapi_codec_object_replace ((GstVaapiCodecObject **) & preenc_base->stats_mv, mv_out); + gst_vaapi_codec_object_unref ((GstVaapiCodecObject *) + preenc_base->stats_mv); } if (!input->disable_statistics_output) { @@ -532,40 +534,46 @@ gst_vaapi_preenc_h264_configure (GstVaapiPreEnc * preenc_base, /* Strore in prenc object */ gst_vaapi_codec_object_replace ((GstVaapiCodecObject **) & preenc_base->stats_statistics, statistics_out); + gst_vaapi_codec_object_unref ((GstVaapiCodecObject *) + preenc_base->stats_statistics); + } - if (input->past_ref_enabled) { - statistics_out_size = sizeof (VAStatsStatisticsH264) * - preenc->mb_width * preenc->mb_height; - statistics_out = - gst_vaapi_stats_statistics_new (preenc_base, NULL, - statistics_out_size); - preenc_base->past_ref_stats_bufid = - statistics_out->parent_instance.param_id; - /* Strore in prenc object */ - gst_vaapi_codec_object_replace ((GstVaapiCodecObject **) & - preenc_base->past_ref_statistics_out, statistics_out); - - va_stat_param->past_ref_stat_buf = &preenc_base->past_ref_stats_bufid; - } + if (input->past_ref_enabled) { + statistics_out_size = sizeof (VAStatsStatisticsH264) * + preenc->mb_width * preenc->mb_height; + statistics_out = + gst_vaapi_stats_statistics_new (preenc_base, NULL, statistics_out_size); + preenc_base->past_ref_stats_bufid = + statistics_out->parent_instance.param_id; + /* Strore in prenc object */ + gst_vaapi_codec_object_replace ((GstVaapiCodecObject **) & + preenc_base->past_ref_statistics_out, statistics_out); + gst_vaapi_codec_object_unref ((GstVaapiCodecObject *) + preenc_base->past_ref_statistics_out); - if (input->future_ref_enabled) { - statistics_out_size = sizeof (VAStatsStatisticsH264) * - preenc->mb_width * preenc->mb_height; - statistics_out = - gst_vaapi_stats_statistics_new (preenc_base, NULL, - statistics_out_size); - preenc_base->future_ref_stats_bufid = - statistics_out->parent_instance.param_id; - /* Strore in prenc object */ - gst_vaapi_codec_object_replace ((GstVaapiCodecObject **) & - preenc_base->future_ref_statistics_out, statistics_out); - - va_stat_param->future_ref_stat_buf = &preenc_base->future_ref_stats_bufid; - } + va_stat_param->past_ref_stat_buf = &preenc_base->past_ref_stats_bufid; + } + + if (input->future_ref_enabled) { + statistics_out_size = sizeof (VAStatsStatisticsH264) * + preenc->mb_width * preenc->mb_height; + statistics_out = + gst_vaapi_stats_statistics_new (preenc_base, NULL, statistics_out_size); + preenc_base->future_ref_stats_bufid = + statistics_out->parent_instance.param_id; + /* Strore in prenc object */ + gst_vaapi_codec_object_replace ((GstVaapiCodecObject **) & + preenc_base->future_ref_statistics_out, statistics_out); + gst_vaapi_codec_object_unref ((GstVaapiCodecObject *) + preenc_base->future_ref_statistics_out); + + va_stat_param->future_ref_stat_buf = &preenc_base->future_ref_stats_bufid; } gst_vaapi_codec_object_replace ((GstVaapiCodecObject **) & preenc_base->stats_param, stats_param); + gst_vaapi_codec_object_unref ((GstVaapiCodecObject *) + preenc_base->stats_param); preenc_base->input_surface_id = input->input_surface_id; va_stat_param->outputs = preenc_base->outputs; diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c b/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c index 906c3b25..f0a00a27 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c @@ -2527,7 +2527,7 @@ gst_vaapi_preenc (GstVaapiEncoderH264Fei * encoder, input.len_sp = 32; input.search_path = 0; input.sub_mb_part_mask = 0; - input.sub_pel_mode = 0; + input.sub_pel_mode = 3; input.inter_sad = 0; input.intra_sad = 0; input.adaptive_search = 0; diff --git a/gst-libs/gst/vaapi/gstvaapifei_objects.c b/gst-libs/gst/vaapi/gstvaapifei_objects.c index 889517e8..b409d062 100644 --- a/gst-libs/gst/vaapi/gstvaapifei_objects.c +++ b/gst-libs/gst/vaapi/gstvaapifei_objects.c @@ -359,6 +359,7 @@ GST_VAAPI_FEI_CODEC_DEFINE_TYPE (GstVaapiEncFeiDistortion, void gst_vaapi_enc_fei_distortion_destroy (GstVaapiEncFeiDistortion * fei_dist) { + GstVaapiFeiCodecObject *object = &fei_dist->parent_instance; vaapi_destroy_buffer (GET_VA_DISPLAY (fei_dist), &object->param_id); object->param = NULL; |