diff options
author | James Zern <jzern@google.com> | 2016-02-16 17:56:13 -0800 |
---|---|---|
committer | James Zern <jzern@google.com> | 2016-02-16 18:10:01 -0800 |
commit | 0b9925ccec249780df13b62e52d20d18acd6895a (patch) | |
tree | 20005365582cd24a7ae9f7d52b26e62f7d881aaa | |
parent | 89cc68252846478fa7f2d570d96ff93776cefac6 (diff) | |
download | libvpx-0b9925ccec249780df13b62e52d20d18acd6895a.tar libvpx-0b9925ccec249780df13b62e52d20d18acd6895a.tar.gz libvpx-0b9925ccec249780df13b62e52d20d18acd6895a.tar.bz2 libvpx-0b9925ccec249780df13b62e52d20d18acd6895a.zip |
vp9_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: I3f55ea4a98be616bb5ab74d95ce4a3d6262e734a
-rw-r--r-- | vp9/vp9_cx_iface.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index db7f537a6..466fa759d 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -974,11 +974,11 @@ 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 * @@ -1017,8 +1017,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); |