Merge "vp9_dthread: pass frame counts to decoder functions"
diff --git a/test/decode_api_test.cc b/test/decode_api_test.cc
index 2837f8c..f9b13f6 100644
--- a/test/decode_api_test.cc
+++ b/test/decode_api_test.cc
@@ -57,6 +57,21 @@
}
}
+#if CONFIG_VP8_DECODER
+TEST(DecodeAPI, OptionalParams) {
+ vpx_codec_ctx_t dec;
+
+#if CONFIG_ERROR_CONCEALMENT
+ EXPECT_EQ(VPX_CODEC_OK, vpx_codec_dec_init(&dec, &vpx_codec_vp8_dx_algo, NULL,
+ VPX_CODEC_USE_ERROR_CONCEALMENT));
+#else
+ EXPECT_EQ(VPX_CODEC_INCAPABLE,
+ vpx_codec_dec_init(&dec, &vpx_codec_vp8_dx_algo, NULL,
+ VPX_CODEC_USE_ERROR_CONCEALMENT));
+#endif // CONFIG_ERROR_CONCEALMENT
+}
+#endif // CONFIG_VP8_DECODER
+
#if CONFIG_VP9_DECODER
// Test VP9 codec controls after a decode error to ensure the code doesn't
// misbehave.
diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c
index 312e3f1..251d240 100644
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -743,6 +743,12 @@
if (priv->buffer_pool == NULL)
return VPX_CODEC_MEM_ERROR;
+#if CONFIG_MULTITHREAD
+ if (pthread_mutex_init(&priv->buffer_pool->pool_mutex, NULL)) {
+ return VPX_CODEC_MEM_ERROR;
+ }
+#endif
+
if (ctx->config.enc) {
// Update the reference to the config structure to an internal copy.
priv->cfg = *ctx->config.enc;
@@ -774,6 +780,9 @@
static vpx_codec_err_t encoder_destroy(vpx_codec_alg_priv_t *ctx) {
free(ctx->cx_data);
vp9_remove_compressor(ctx->cpi);
+#if CONFIG_MULTITHREAD
+ pthread_mutex_destroy(&ctx->buffer_pool->pool_mutex);
+#endif
vpx_free(ctx->buffer_pool);
vpx_free(ctx);
return VPX_CODEC_OK;