[allocator]: Transform allocator normal to std

1. Use allocator std to replace default normal allocator on all OS.
2. Use wrapper to simplify mpp_allocator.

Change-Id: I13314a9eec3c5b39bc5ad8ddb3033ac2da79ba8f
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
Herman Chen
2016-12-15 17:10:44 +08:00
parent 249f83f35b
commit e2f0da0a89
10 changed files with 223 additions and 372 deletions

View File

@@ -6,13 +6,13 @@ endif()
if(${ANDROID}) if(${ANDROID})
set(OS_DIR android) set(OS_DIR android)
set(MPP_ALLOCATOR allocator/allocator_ion.c ${DRM_FILES}) set(MPP_ALLOCATOR allocator/allocator_std.c allocator/allocator_ion.c ${DRM_FILES})
elseif(${UNIX}) elseif(${UNIX})
set(OS_DIR linux) set(OS_DIR linux)
set(MPP_ALLOCATOR allocator/allocator_ion.c ${DRM_FILES}) set(MPP_ALLOCATOR allocator/allocator_std.c allocator/allocator_ion.c ${DRM_FILES})
elseif(${WIN32}) elseif(${WIN32})
set(OS_DIR window) set(OS_DIR window)
set(MPP_ALLOCATOR ) set(MPP_ALLOCATOR allocator/allocator_std.c)
else() else()
message(SEND_ERROR "Can not found platform definistion ${CMAKE_SYSTEM}") message(SEND_ERROR "Can not found platform definistion ${CMAKE_SYSTEM}")
endif() endif()

View File

@@ -360,9 +360,10 @@ MPP_RET os_allocator_drm_close(void *ctx)
os_allocator allocator_drm = { os_allocator allocator_drm = {
os_allocator_drm_open, os_allocator_drm_open,
os_allocator_drm_close,
os_allocator_drm_alloc, os_allocator_drm_alloc,
os_allocator_drm_free, os_allocator_drm_free,
os_allocator_drm_import, os_allocator_drm_import,
os_allocator_drm_release, os_allocator_drm_release,
os_allocator_drm_close, NULL,
}; };

View File

@@ -442,10 +442,11 @@ MPP_RET os_allocator_ion_close(void *ctx)
os_allocator allocator_ion = { os_allocator allocator_ion = {
os_allocator_ion_open, os_allocator_ion_open,
os_allocator_ion_close,
os_allocator_ion_alloc, os_allocator_ion_alloc,
os_allocator_ion_free, os_allocator_ion_free,
os_allocator_ion_import, os_allocator_ion_import,
os_allocator_ion_release, os_allocator_ion_release,
os_allocator_ion_close, NULL,
}; };

View File

@@ -0,0 +1,125 @@
/*
* Copyright 2015 Rockchip Electronics Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdio.h>
#include "os_mem.h"
#include "os_allocator.h"
#include "mpp_mem.h"
#include "mpp_log.h"
typedef struct {
size_t alignment;
RK_S32 fd_count;
} allocator_ctx;
MPP_RET allocator_std_open(void **ctx, size_t alignment)
{
MPP_RET ret = MPP_OK;
allocator_ctx *p = NULL;
if (NULL == ctx) {
mpp_err_f("do not accept NULL input\n");
return MPP_ERR_NULL_PTR;
}
p = mpp_malloc(allocator_ctx, 1);
if (NULL == p) {
mpp_err_f("failed to allocate context\n");
ret = MPP_ERR_MALLOC;
} else
p->alignment = alignment;
p->fd_count = 0;
*ctx = p;
return ret;
}
MPP_RET allocator_std_alloc(void *ctx, MppBufferInfo *info)
{
allocator_ctx *p = NULL;
if (NULL == ctx) {
mpp_err_f("found NULL context input\n");
return MPP_ERR_NULL_PTR;
}
p = (allocator_ctx *)ctx;
info->fd = p->fd_count++;
return (MPP_RET)os_malloc(&info->ptr, p->alignment, info->size);
}
MPP_RET allocator_std_free(void *ctx, MppBufferInfo *info)
{
(void) ctx;
if (info->ptr)
os_free(info->ptr);
return MPP_OK;
}
MPP_RET allocator_std_import(void *ctx, MppBufferInfo *info)
{
allocator_ctx *p = (allocator_ctx *)ctx;
mpp_assert(ctx);
mpp_assert(info->ptr);
mpp_assert(info->size);
info->hnd = NULL;
info->fd = p->fd_count++;
return MPP_OK;
}
MPP_RET allocator_std_release(void *ctx, MppBufferInfo *info)
{
(void) ctx;
mpp_assert(info->ptr);
mpp_assert(info->size);
info->ptr = NULL;
info->size = 0;
info->hnd = NULL;
info->fd = -1;
return MPP_OK;
}
MPP_RET allocator_std_mmap(void *ctx, MppBufferInfo *info)
{
mpp_assert(ctx);
mpp_assert(info->ptr);
mpp_assert(info->size);
return MPP_OK;
}
MPP_RET allocator_std_close(void *ctx)
{
if (ctx) {
mpp_free(ctx);
return MPP_OK;
}
mpp_err_f("found NULL context input\n");
return MPP_NOK;
}
os_allocator allocator_std = {
allocator_std_open,
allocator_std_close,
allocator_std_alloc,
allocator_std_free,
allocator_std_import,
allocator_std_release,
allocator_std_mmap,
};

View File

@@ -0,0 +1,20 @@
/*
* Copyright 2015 Rockchip Electronics Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "os_allocator.h"
extern os_allocator allocator_std;

View File

@@ -14,112 +14,10 @@
* limitations under the License. * limitations under the License.
*/ */
#include <errno.h> #include "allocator_std.h"
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include "os_mem.h"
#include "os_allocator.h"
#include "allocator_ion.h" #include "allocator_ion.h"
#include "allocator_drm.h" #include "allocator_drm.h"
#include "mpp_mem.h"
#include "mpp_log.h"
#include "mpp_common.h"
typedef struct {
RK_U32 alignment;
RK_S32 fd_count;
} allocator_ctx_normal;
MPP_RET os_allocator_normal_open(void **ctx, size_t alignment)
{
MPP_RET ret = MPP_OK;
allocator_ctx_normal *p = NULL;
if (NULL == ctx) {
mpp_err("os_allocator_open Android do not accept NULL input\n");
return MPP_ERR_NULL_PTR;
}
p = mpp_malloc(allocator_ctx_normal, 1);
if (NULL == p) {
mpp_err("os_allocator_open Android failed to allocate context\n");
ret = MPP_ERR_MALLOC;
} else
p->alignment = alignment;
p->fd_count = 0;
*ctx = p;
return ret;
}
MPP_RET os_allocator_normal_alloc(void *ctx, MppBufferInfo *info)
{
allocator_ctx_normal *p = NULL;
if (NULL == ctx) {
mpp_err("os_allocator_close Android do not accept NULL input\n");
return MPP_ERR_NULL_PTR;
}
p = (allocator_ctx_normal *)ctx;
info->fd = p->fd_count++;
return os_malloc(&info->ptr, p->alignment, info->size);
}
MPP_RET os_allocator_normal_free(void *ctx, MppBufferInfo *info)
{
(void)ctx;
if (info->ptr)
os_free(info->ptr);
return MPP_OK;
}
MPP_RET os_allocator_normal_import(void *ctx, MppBufferInfo *info)
{
allocator_ctx_normal *p = (allocator_ctx_normal *)ctx;
mpp_assert(ctx);
mpp_assert(info->ptr);
mpp_assert(info->size);
info->hnd = NULL;
info->fd = p->fd_count++;
return MPP_OK;
}
MPP_RET os_allocator_normal_release(void *ctx, MppBufferInfo *info)
{
(void)ctx;
mpp_assert(info->ptr);
mpp_assert(info->size);
info->ptr = NULL;
info->size = 0;
info->hnd = NULL;
info->fd = -1;
return MPP_OK;
}
MPP_RET os_allocator_normal_close(void *ctx)
{
if (ctx) {
mpp_free(ctx);
return MPP_OK;
}
mpp_err("os_allocator_close Linux found NULL context input\n");
return MPP_NOK;
}
static os_allocator allocator_normal = {
os_allocator_normal_open,
os_allocator_normal_alloc,
os_allocator_normal_free,
os_allocator_normal_import,
os_allocator_normal_release,
os_allocator_normal_close,
};
MPP_RET os_allocator_get(os_allocator *api, MppBufferType type) MPP_RET os_allocator_get(os_allocator *api, MppBufferType type)
{ {
MPP_RET ret = MPP_OK; MPP_RET ret = MPP_OK;
@@ -127,7 +25,7 @@ MPP_RET os_allocator_get(os_allocator *api, MppBufferType type)
switch (type) { switch (type) {
case MPP_BUFFER_TYPE_NORMAL : case MPP_BUFFER_TYPE_NORMAL :
case MPP_BUFFER_TYPE_V4L2 : { case MPP_BUFFER_TYPE_V4L2 : {
*api = allocator_normal; *api = allocator_std;
} }
break; break;
case MPP_BUFFER_TYPE_ION : { case MPP_BUFFER_TYPE_ION : {
@@ -138,7 +36,7 @@ MPP_RET os_allocator_get(os_allocator *api, MppBufferType type)
#ifdef HAVE_DRM #ifdef HAVE_DRM
*api = allocator_drm; *api = allocator_drm;
#else #else
*api = allocator_normal; *api = allocator_std;
#endif #endif
} }
break; break;

View File

@@ -14,145 +14,40 @@
* limitations under the License. * limitations under the License.
*/ */
#include <stdio.h> #include "mpp_log.h"
#include "os_mem.h"
#include "os_allocator.h"
#include "allocator_std.h"
#include "allocator_drm.h" #include "allocator_drm.h"
#include "allocator_ion.h" #include "allocator_ion.h"
#include "mpp_mem.h"
#include "mpp_log.h"
/* /*
* Linux only support MPP_BUFFER_TYPE_NORMAL so far * Linux only support MPP_BUFFER_TYPE_NORMAL so far
* we can support MPP_BUFFER_TYPE_V4L2 later * we can support MPP_BUFFER_TYPE_V4L2 later
*/ */
typedef struct {
size_t alignment;
RK_S32 fd_count;
} allocator_ctx;
MPP_RET os_allocator_normal_open(void **ctx, size_t alignment)
{
MPP_RET ret = MPP_OK;
allocator_ctx *p = NULL;
if (NULL == ctx) {
mpp_err("os_allocator_open Linux do not accept NULL input\n");
return MPP_ERR_NULL_PTR;
}
p = mpp_malloc(allocator_ctx, 1);
if (NULL == p) {
mpp_err("os_allocator_open Linux failed to allocate context\n");
ret = MPP_ERR_MALLOC;
} else
p->alignment = alignment;
p->fd_count = 0;
*ctx = p;
return ret;
}
MPP_RET os_allocator_normal_alloc(void *ctx, MppBufferInfo *info)
{
allocator_ctx *p = NULL;
if (NULL == ctx) {
mpp_err("os_allocator_alloc Linux found NULL context input\n");
return MPP_ERR_NULL_PTR;
}
p = (allocator_ctx *)ctx;
info->fd = p->fd_count++;
return os_malloc(&info->ptr, p->alignment, info->size);
}
MPP_RET os_allocator_normal_free(void *ctx, MppBufferInfo *info)
{
(void) ctx;
if (info->ptr)
os_free(info->ptr);
return MPP_OK;
}
MPP_RET os_allocator_normal_import(void *ctx, MppBufferInfo *info)
{
allocator_ctx *p = (allocator_ctx *)ctx;
mpp_assert(ctx);
mpp_assert(info->ptr);
mpp_assert(info->size);
info->hnd = NULL;
info->fd = p->fd_count++;
return MPP_OK;
}
MPP_RET os_allocator_normal_release(void *ctx, MppBufferInfo *info)
{
(void) ctx;
mpp_assert(info->ptr);
mpp_assert(info->size);
info->ptr = NULL;
info->size = 0;
info->hnd = NULL;
info->fd = -1;
return MPP_OK;
}
MPP_RET os_allocator_normal_close(void *ctx)
{
if (ctx) {
mpp_free(ctx);
return MPP_OK;
}
mpp_err("os_allocator_close Linux found NULL context input\n");
return MPP_NOK;
}
static os_allocator allocator_normal = {
os_allocator_normal_open,
os_allocator_normal_alloc,
os_allocator_normal_free,
os_allocator_normal_import,
os_allocator_normal_release,
os_allocator_normal_close,
};
static os_allocator allocator_v4l2 = {
os_allocator_normal_open,
os_allocator_normal_alloc,
os_allocator_normal_free,
os_allocator_normal_import,
os_allocator_normal_release,
os_allocator_normal_close,
};
MPP_RET os_allocator_get(os_allocator *api, MppBufferType type) MPP_RET os_allocator_get(os_allocator *api, MppBufferType type)
{ {
MPP_RET ret = MPP_OK; MPP_RET ret = MPP_OK;
switch (type) { switch (type) {
case MPP_BUFFER_TYPE_NORMAL : { case MPP_BUFFER_TYPE_NORMAL : {
*api = allocator_normal; *api = allocator_std;
} break; } break;
case MPP_BUFFER_TYPE_ION : { case MPP_BUFFER_TYPE_ION : {
#ifdef RKPLATFORM #ifdef RKPLATFORM
*api = allocator_ion; *api = allocator_ion;
#else #else
*api = allocator_normal; *api = allocator_std;
#endif #endif
} break; } break;
case MPP_BUFFER_TYPE_V4L2 : { case MPP_BUFFER_TYPE_V4L2 : {
mpp_err("os_allocator_get Linux MPP_BUFFER_TYPE_V4L2 do not implement yet\n"); mpp_err("os_allocator_get Linux MPP_BUFFER_TYPE_V4L2 do not implement yet\n");
*api = allocator_v4l2; *api = allocator_std;
} break; } break;
case MPP_BUFFER_TYPE_DRM : { case MPP_BUFFER_TYPE_DRM : {
#ifdef HAVE_DRM #ifdef HAVE_DRM
*api = allocator_drm; *api = allocator_drm;
#else #else
*api = allocator_normal; *api = allocator_std;
#endif #endif
} break; } break;
default : { default : {

View File

@@ -26,78 +26,80 @@
#define MPP_ALLOCATOR_LOCK(p) pthread_mutex_lock(&(p)->lock); #define MPP_ALLOCATOR_LOCK(p) pthread_mutex_lock(&(p)->lock);
#define MPP_ALLOCATOR_UNLOCK(p) pthread_mutex_unlock(&(p)->lock); #define MPP_ALLOCATOR_UNLOCK(p) pthread_mutex_unlock(&(p)->lock);
MPP_RET mpp_allocator_alloc(MppAllocator allocator, MppBufferInfo *info) typedef enum OsAllocatorApiId_e {
ALLOC_API_ALLOC,
ALLOC_API_FREE,
ALLOC_API_IMPORT,
ALLOC_API_RELEASE,
ALLOC_API_MMAP,
ALLOC_API_BUTT,
} OsAllocatorApiId;
static MPP_RET mpp_allocator_api_wrapper(MppAllocator allocator, MppBufferInfo *info, OsAllocatorApiId id)
{ {
if (NULL == allocator || NULL == info) { if (NULL == allocator || NULL == info || id >= ALLOC_API_BUTT) {
mpp_err_f("invalid input: allocator %p info %p\n", mpp_err_f("invalid input: allocator %p info %p id %d\n",
allocator, info); allocator, info, id);
return MPP_ERR_UNKNOW; return MPP_ERR_UNKNOW;
} }
MPP_RET ret = MPP_NOK; MPP_RET ret = MPP_NOK;
MppAllocatorImpl *p = (MppAllocatorImpl *)allocator; MppAllocatorImpl *p = (MppAllocatorImpl *)allocator;
OsAllocatorFunc func;
MPP_ALLOCATOR_LOCK(p); MPP_ALLOCATOR_LOCK(p);
if (p->os_api.alloc && p->ctx) switch (id) {
ret = p->os_api.alloc(p->ctx, info); case ALLOC_API_ALLOC : {
func = p->os_api.alloc;
} break;
case ALLOC_API_FREE : {
func = p->os_api.free;
} break;
case ALLOC_API_IMPORT : {
func = p->os_api.import;
} break;
case ALLOC_API_RELEASE : {
func = p->os_api.release;
} break;
case ALLOC_API_MMAP : {
func = p->os_api.mmap;
} break;
default : {
func = NULL;
} break;
}
if (func && p->ctx)
ret = func(p->ctx, info);
MPP_ALLOCATOR_UNLOCK(p); MPP_ALLOCATOR_UNLOCK(p);
return ret; return ret;
} }
MPP_RET mpp_allocator_alloc(MppAllocator allocator, MppBufferInfo *info)
{
return mpp_allocator_api_wrapper(allocator, info, ALLOC_API_ALLOC);
}
MPP_RET mpp_allocator_free(MppAllocator allocator, MppBufferInfo *info) MPP_RET mpp_allocator_free(MppAllocator allocator, MppBufferInfo *info)
{ {
if (NULL == allocator || NULL == info) { return mpp_allocator_api_wrapper(allocator, info, ALLOC_API_FREE);
mpp_err_f("invalid input: allocator %p info %p\n",
allocator, info);
return MPP_ERR_UNKNOW;
}
MPP_RET ret = MPP_NOK;
MppAllocatorImpl *p = (MppAllocatorImpl *)allocator;
MPP_ALLOCATOR_LOCK(p);
if (p->os_api.free && p->ctx)
ret = p->os_api.free(p->ctx, info);
MPP_ALLOCATOR_UNLOCK(p);
return ret;
} }
MPP_RET mpp_allocator_import(MppAllocator allocator, MppBufferInfo *info) MPP_RET mpp_allocator_import(MppAllocator allocator, MppBufferInfo *info)
{ {
if (NULL == info) { return mpp_allocator_api_wrapper(allocator, info, ALLOC_API_IMPORT);
mpp_err_f("invalid input: info %p\n", info);
return MPP_ERR_UNKNOW;
} }
MPP_RET ret = MPP_NOK;
MppAllocatorImpl *p = (MppAllocatorImpl *)allocator;
MPP_ALLOCATOR_LOCK(p);
if (p->os_api.import && p->ctx) {
ret = p->os_api.import(p->ctx, info);
}
MPP_ALLOCATOR_UNLOCK(p);
return ret;
}
MPP_RET mpp_allocator_release(MppAllocator allocator, MppBufferInfo *info) MPP_RET mpp_allocator_release(MppAllocator allocator, MppBufferInfo *info)
{ {
if (NULL == allocator || NULL == info) { return mpp_allocator_api_wrapper(allocator, info, ALLOC_API_RELEASE);
mpp_err_f("invalid input: allocator %p info %p\n",
allocator, info);
return MPP_ERR_UNKNOW;
} }
MPP_RET ret = MPP_NOK; MPP_RET mpp_allocator_mmap(MppAllocator allocator, MppBufferInfo *info)
MppAllocatorImpl *p = (MppAllocatorImpl *)allocator; {
MPP_ALLOCATOR_LOCK(p); return mpp_allocator_api_wrapper(allocator, info, ALLOC_API_MMAP);
if (p->os_api.release && p->ctx) {
ret = p->os_api.release(p->ctx, info);
}
MPP_ALLOCATOR_UNLOCK(p);
return ret;
} }
static MppAllocatorApi mpp_allocator_api = { static MppAllocatorApi mpp_allocator_api = {
@@ -107,7 +109,7 @@ static MppAllocatorApi mpp_allocator_api = {
mpp_allocator_free, mpp_allocator_free,
mpp_allocator_import, mpp_allocator_import,
mpp_allocator_release, mpp_allocator_release,
NULL, mpp_allocator_mmap,
}; };
MPP_RET mpp_allocator_get(MppAllocator *allocator, MppAllocatorApi **api, MppBufferType type) MPP_RET mpp_allocator_get(MppAllocator *allocator, MppAllocatorApi **api, MppBufferType type)

View File

@@ -19,13 +19,17 @@
#include "mpp_allocator.h" #include "mpp_allocator.h"
typedef MPP_RET (*OsAllocatorFunc)(void *ctx, MppBufferInfo *info);
typedef struct os_allocator_t { typedef struct os_allocator_t {
MPP_RET (*open)(void **ctx, size_t alignment); MPP_RET (*open)(void **ctx, size_t alignment);
MPP_RET (*alloc)(void *ctx, MppBufferInfo *info);
MPP_RET (*free)(void *ctx, MppBufferInfo *info);
MPP_RET (*import)(void *ctx, MppBufferInfo *info);
MPP_RET (*release)(void *ctx, MppBufferInfo *info);
MPP_RET (*close)(void *ctx); MPP_RET (*close)(void *ctx);
OsAllocatorFunc alloc;
OsAllocatorFunc free;
OsAllocatorFunc import;
OsAllocatorFunc release;
OsAllocatorFunc mmap;
} os_allocator; } os_allocator;
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -14,108 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
#include "os_mem.h"
#include "os_allocator.h" #include "os_allocator.h"
#include "allocator_std.h"
#include "mpp_mem.h"
#include "mpp_log.h"
/* /*
* window only support MPP_BUFFER_TYPE_NORMAL * window only support MPP_BUFFER_TYPE_NORMAL
*/ */
typedef struct {
size_t alignment;
RK_S32 fd_count;
} allocator_ctx;
MPP_RET os_allocator_open(void **ctx, size_t alignment)
{
MPP_RET ret = MPP_OK;
allocator_ctx *p = NULL;
if (NULL == ctx) {
mpp_err("os_allocator_open Window do not accept NULL input\n");
return MPP_ERR_NULL_PTR;
}
p = mpp_malloc(allocator_ctx, 1);
if (NULL == p) {
mpp_err("os_allocator_open Window failed to allocate context\n");
ret = MPP_ERR_MALLOC;
} else
p->alignment = alignment;
p->fd_count = 0;
*ctx = p;
return ret;
}
MPP_RET os_allocator_alloc(void *ctx, MppBufferInfo *info)
{
allocator_ctx *p = NULL;
if (NULL == ctx) {
mpp_err("os_allocator_alloc Window found NULL context input\n");
return MPP_ERR_NULL_PTR;
}
p = (allocator_ctx *)ctx;
info->fd = p->fd_count++;
return (MPP_RET)os_malloc(&info->ptr, p->alignment, info->size);
}
MPP_RET os_allocator_free(void *ctx, MppBufferInfo *info)
{
(void) ctx;
if (info->ptr)
os_free(info->ptr);
return MPP_OK;
}
MPP_RET os_allocator_import(void *ctx, MppBufferInfo *info)
{
allocator_ctx *p = (allocator_ctx *)ctx;
mpp_assert(ctx);
mpp_assert(info->ptr);
mpp_assert(info->size);
info->hnd = NULL;
info->fd = p->fd_count++;
return MPP_OK;
}
MPP_RET os_allocator_release(void *ctx, MppBufferInfo *info)
{
(void) ctx;
mpp_assert(info->ptr);
mpp_assert(info->size);
info->ptr = NULL;
info->size = 0;
info->hnd = NULL;
info->fd = -1;
return MPP_OK;
}
MPP_RET os_allocator_close(void *ctx)
{
if (ctx) {
mpp_free(ctx);
return MPP_OK;
}
mpp_err("os_allocator_close Window found NULL context input\n");
return MPP_NOK;
}
static os_allocator allocator_window = {
os_allocator_open,
os_allocator_alloc,
os_allocator_free,
os_allocator_import,
os_allocator_release,
os_allocator_close,
};
MPP_RET os_allocator_get(os_allocator *api, MppBufferType type) MPP_RET os_allocator_get(os_allocator *api, MppBufferType type)
{ {
MPP_RET ret = MPP_OK; MPP_RET ret = MPP_OK;
@@ -123,7 +28,7 @@ MPP_RET os_allocator_get(os_allocator *api, MppBufferType type)
case MPP_BUFFER_TYPE_NORMAL : case MPP_BUFFER_TYPE_NORMAL :
case MPP_BUFFER_TYPE_ION : case MPP_BUFFER_TYPE_ION :
case MPP_BUFFER_TYPE_V4L2 : { case MPP_BUFFER_TYPE_V4L2 : {
*api = allocator_window; *api = allocator_std;
} break; } break;
default : { default : {
ret = MPP_NOK; ret = MPP_NOK;