+ if (mc_handle->is_hw && mc_handle->is_video) {
+
+ if (handle->codec_resource) {
+ LOGE("Codec resource is tried to be acquired twice\n");
+ return MC_INTERNAL_ERROR;
+ }
+
+ /*
+ * TODO
+ * Currently volume of requested resource is set to 1. Default
+ * capacity for video encoder/decoder is 1 too. The actual capacity
+ * should be set in mmfw-sysconf > mmfw_resource_manager.ini.
+ * If different encode/decode operation needs different volume of
+ * video encoder/decoder, '1' in the following
+ * mm_resource_manager_mark_for_acquire function should be set to
+ * corresponding value.
+ * If that value depends on platform where it's executed,
+ * MM_RESOURCE_MANAGER_RES_TYPE_COND_* and
+ * mm_resource_manager_get_res_type_volume() can be used.
+ * Additional info can be found in doxygen comments of mm_resource_manager.h
+ */
+ rm_ret = mm_resource_manager_mark_for_acquire(resource_manager,
+ mc_handle->is_encoder ?
+ MM_RESOURCE_MANAGER_RES_TYPE_VIDEO_ENCODER :
+ MM_RESOURCE_MANAGER_RES_TYPE_VIDEO_DECODER,
+ 1, &resource);
+ if (rm_ret != MM_RESOURCE_MANAGER_ERROR_NONE)
+ switch (rm_ret) {
+ case MM_RESOURCE_MANAGER_ERROR_NOT_SUPPORTED:
+ return MEDIACODEC_ERROR_NOT_SUPPORTED_ON_DEVICE;
+ case MM_RESOURCE_MANAGER_ERROR_NOT_ENOUGH:
+ return MEDIACODEC_ERROR_RESOURCE_OVERLOADED;
+ default:
+ return MEDIACODEC_ERROR_INTERNAL;
+ }
+
+ rm_ret = mm_resource_manager_commit(resource_manager);
+ if (rm_ret != MM_RESOURCE_MANAGER_ERROR_NONE) {
+ mm_resource_manager_mark_for_release(resource_manager, resource);
+ switch (rm_ret) {
+ case MM_RESOURCE_MANAGER_ERROR_LOW_PRIORITY:
+ return MEDIACODEC_ERROR_RESOURCE_OVERLOADED;
+ default:
+ return MEDIACODEC_ERROR_INTERNAL;
+ }
+ }
+
+ handle->codec_resource = resource;
+ }
+