Merge "Add mutex initialization in encoder"
This commit is contained in:
commit
9a664917b0
@ -743,6 +743,12 @@ static vpx_codec_err_t encoder_init(vpx_codec_ctx_t *ctx,
|
|||||||
if (priv->buffer_pool == NULL)
|
if (priv->buffer_pool == NULL)
|
||||||
return VPX_CODEC_MEM_ERROR;
|
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) {
|
if (ctx->config.enc) {
|
||||||
// Update the reference to the config structure to an internal copy.
|
// Update the reference to the config structure to an internal copy.
|
||||||
priv->cfg = *ctx->config.enc;
|
priv->cfg = *ctx->config.enc;
|
||||||
@ -774,6 +780,9 @@ static vpx_codec_err_t encoder_init(vpx_codec_ctx_t *ctx,
|
|||||||
static vpx_codec_err_t encoder_destroy(vpx_codec_alg_priv_t *ctx) {
|
static vpx_codec_err_t encoder_destroy(vpx_codec_alg_priv_t *ctx) {
|
||||||
free(ctx->cx_data);
|
free(ctx->cx_data);
|
||||||
vp9_remove_compressor(ctx->cpi);
|
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->buffer_pool);
|
||||||
vpx_free(ctx);
|
vpx_free(ctx);
|
||||||
return VPX_CODEC_OK;
|
return VPX_CODEC_OK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user