From b5029a25a886c5ca10c296dce03a0422bdfb430f Mon Sep 17 00:00:00 2001 From: James Zern Date: Tue, 16 Feb 2016 17:58:54 -0800 Subject: [PATCH] vp10_cx_iface,encode: remove redundant cpi check this is allocated in init(), a NULL pointer on encode() should be treated as a failure. Change-Id: I09c206f088982716fd5acc39949ceb25576313fc --- vp10/vp10_cx_iface.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vp10/vp10_cx_iface.c b/vp10/vp10_cx_iface.c index 63d3adc1f..d2357a864 100644 --- a/vp10/vp10_cx_iface.c +++ b/vp10/vp10_cx_iface.c @@ -892,11 +892,13 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx, const vpx_rational_t *const timebase = &ctx->cfg.g_timebase; size_t data_sz; + if (cpi == NULL) return VPX_CODEC_INVALID_PARAM; + if (img != NULL) { res = validate_img(ctx, img); // TODO(jzern) the checks related to cpi's validity should be treated as a // failure condition, encoder setup is done fully in init() currently. - if (res == VPX_CODEC_OK && cpi != NULL) { + if (res == VPX_CODEC_OK) { // There's no codec control for multiple alt-refs so check the encoder // instance for its status to determine the compressed data size. data_sz = ctx->cfg.g_w * ctx->cfg.g_h * get_image_bps(img) / 8 * @@ -935,8 +937,7 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx, } } - // Initialize the encoder instance on the first frame. - if (res == VPX_CODEC_OK && cpi != NULL) { + if (res == VPX_CODEC_OK) { unsigned int lib_flags = 0; YV12_BUFFER_CONFIG sd; int64_t dst_time_stamp = timebase_units_to_ticks(timebase, pts);