diff --git a/vp8/decoder/onyxd_if.c b/vp8/decoder/onyxd_if.c index dff53dc17..c6b566036 100644 --- a/vp8/decoder/onyxd_if.c +++ b/vp8/decoder/onyxd_if.c @@ -444,10 +444,17 @@ int vp8_create_decoder_instances(struct frame_buffers *fb, VP8D_CONFIG *oxcf) { if (!fb->pbi[0]) return VPX_CODEC_ERROR; #if CONFIG_MULTITHREAD - /* enable row-based threading only when use_frame_threads - * is disabled */ + if (setjmp(fb->pbi[0]->common.error.jmp)) { + vp8_remove_decoder_instances(fb); + memset(fb->pbi, 0, sizeof(fb->pbi) / sizeof(fb->pbi[0])); + vp8_clear_system_state(); + return VPX_CODEC_ERROR; + } + + fb->pbi[0]->common.error.setjmp = 1; fb->pbi[0]->max_threads = oxcf->max_threads; vp8_decoder_create_threads(fb->pbi[0]); + fb->pbi[0]->common.error.setjmp = 0; #endif } else { /* TODO : create frame threads and decoder instances for each diff --git a/vp8/vp8_dx_iface.c b/vp8/vp8_dx_iface.c index 674a8567b..cab0a9997 100644 --- a/vp8/vp8_dx_iface.c +++ b/vp8/vp8_dx_iface.c @@ -342,7 +342,7 @@ static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx, } res = vp8_create_decoder_instances(&ctx->yv12_frame_buffers, &oxcf); - ctx->decoder_init = 1; + if (res == VPX_CODEC_OK) ctx->decoder_init = 1; } /* Set these even if already initialized. The caller may have changed the