hal_codec_buffer_s *hal_buffer = NULL;
hal_codec_ipc_buffer_s *ipc_buffer = NULL;
- g_autoptr(GMutexLocker) locker = NULL;
-
HAL_CODEC_RETURN_VAL_IF_FAILED(handle, HAL_CODEC_ERROR_INVALID_PARAMETER);
HAL_CODEC_RETURN_VAL_IF_FAILED(handle->rpc_handle, HAL_CODEC_ERROR_INVALID_PARAMETER);
ipc_buffer = &handle->ipc_buffer;
- ret = rpc_port_proxy_codec_invoke_release_output_buffer(handle->rpc_handle, buffer_index);
- if (ret != HAL_CODEC_ERROR_NONE) {
- SLOGE("invoke release output buffer failed[0x%x]", ret);
- return ret;
- }
-
- locker = g_mutex_locker_new(&ipc_buffer->lock);
+ g_mutex_lock(&ipc_buffer->lock);
hal_buffer = ipc_buffer->output_buffers[buffer_index];
ipc_buffer->output_buffers[buffer_index] = NULL;
if (!hal_buffer) {
SLOGW("NULL buffer for index[%d]", buffer_index);
+ g_mutex_unlock(&ipc_buffer->lock);
return HAL_CODEC_ERROR_NONE;
}
ipc_buffer->output_buffer_count--;
+ g_mutex_unlock(&ipc_buffer->lock);
+
if (handle->type == HAL_CODEC_TYPE_DECODER)
__hal_codec_ipc_hal_buffer_release_decoder_output(hal_buffer);
else
__hal_codec_ipc_hal_buffer_release_encoder_output(hal_buffer);
- return HAL_CODEC_ERROR_NONE;
+ ret = rpc_port_proxy_codec_invoke_release_output_buffer(handle->rpc_handle, buffer_index);
+ if (ret != HAL_CODEC_ERROR_NONE)
+ SLOGE("invoke release output buffer failed[0x%x]", ret);
+
+ return ret;
}