ref: 9a664917b0d6d13342d5531d004ce76bba9e7f8c
parent: 421043340a121330ec5429471a9ec5e362b18706
parent: a6b3e01a27a60bcd24470a4f4a2f9edea647901a
author: Yaowu Xu <[email protected]>
date: Tue Feb 3 05:36:42 EST 2015
Merge "Add mutex initialization in encoder"
--- 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;