mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-05 17:16:50 +08:00
[osal]: add normal mode mpp_buffer path to test and fix a lot of bug
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@134 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -54,7 +54,7 @@ MPP_RET mpp_buffer_get_with_tag(const char *tag, MppBufferGroup group, MppBuffer
|
|||||||
if (NULL == buf) {
|
if (NULL == buf) {
|
||||||
// if failed try init a new buffer
|
// if failed try init a new buffer
|
||||||
mpp_buffer_create(tag, tmp->group_id, size, NULL);
|
mpp_buffer_create(tag, tmp->group_id, size, NULL);
|
||||||
mpp_buffer_get_unused(tmp, size);
|
buf = mpp_buffer_get_unused(tmp, size);
|
||||||
}
|
}
|
||||||
*buffer = buf;
|
*buffer = buf;
|
||||||
return (buf) ? (MPP_OK) : (MPP_NOK);
|
return (buf) ? (MPP_OK) : (MPP_NOK);
|
||||||
|
@@ -139,25 +139,28 @@ MPP_RET mpp_buffer_create(const char *tag, RK_U32 group_id, size_t size, MppBuff
|
|||||||
MppBufferGroupImpl *group = SEARCH_GROUP_NORMAL(group_id);
|
MppBufferGroupImpl *group = SEARCH_GROUP_NORMAL(group_id);
|
||||||
if (group) {
|
if (group) {
|
||||||
if (NULL == data) {
|
if (NULL == data) {
|
||||||
group->alloc_api->alloc(group->allocator, &data, size);
|
MppBufferData tmp;
|
||||||
|
MPP_RET ret = group->alloc_api->alloc(group->allocator, &tmp, size);
|
||||||
|
if (MPP_OK != ret) {
|
||||||
|
mpp_err("mpp_buffer_create failed to create buffer with size %d\n", size);
|
||||||
|
mpp_free(p);
|
||||||
|
MPP_BUFFER_SERVICE_UNLOCK();
|
||||||
|
return MPP_ERR_MALLOC;
|
||||||
|
}
|
||||||
|
|
||||||
|
p->data = tmp;
|
||||||
p->mode = MPP_BUFFER_MODE_NATIVE;
|
p->mode = MPP_BUFFER_MODE_NATIVE;
|
||||||
} else {
|
} else {
|
||||||
|
p->data = *data;
|
||||||
p->mode = MPP_BUFFER_MODE_COMMIT;
|
p->mode = MPP_BUFFER_MODE_COMMIT;
|
||||||
}
|
}
|
||||||
if (NULL == data) {
|
|
||||||
mpp_err("mpp_buffer_create failed to create buffer with size %d\n", size);
|
|
||||||
mpp_free(p);
|
|
||||||
MPP_BUFFER_SERVICE_UNLOCK();
|
|
||||||
return MPP_ERR_MALLOC;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NULL == tag) {
|
if (NULL == tag)
|
||||||
tag = group->tag;
|
tag = group->tag;
|
||||||
}
|
|
||||||
strncpy(p->tag, tag, sizeof(p->tag));
|
strncpy(p->tag, tag, sizeof(p->tag));
|
||||||
p->group_id = group_id;
|
p->group_id = group_id;
|
||||||
p->size = size;
|
p->size = size;
|
||||||
p->data = *data;
|
|
||||||
p->used = 0;
|
p->used = 0;
|
||||||
p->ref_count = 0;
|
p->ref_count = 0;
|
||||||
INIT_LIST_HEAD(&p->list_status);
|
INIT_LIST_HEAD(&p->list_status);
|
||||||
|
@@ -15,13 +15,34 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <ion/ion.h>
|
||||||
|
|
||||||
#include "os_mem.h"
|
#include "os_mem.h"
|
||||||
#include "os_allocator.h"
|
#include "os_allocator.h"
|
||||||
|
|
||||||
int os_allocator_open(void **ctx)
|
#include "mpp_mem.h"
|
||||||
|
#include "mpp_log.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
RK_S32 ion_client;
|
||||||
|
RK_U32 align;
|
||||||
|
} allocator_ion;
|
||||||
|
|
||||||
|
int os_allocator_open(void **ctx, size_t alignment)
|
||||||
{
|
{
|
||||||
if (ctx)
|
if (NULL == ctx) {
|
||||||
|
mpp_err("os_allocator_open Android do not accept NULL input\n");
|
||||||
|
return MPP_ERR_NULL_PTR;
|
||||||
|
}
|
||||||
|
|
||||||
|
allocator_ion *p = mpp_malloc(allocator_ion, 1);
|
||||||
|
if (NULL == p) {
|
||||||
*ctx = NULL;
|
*ctx = NULL;
|
||||||
|
mpp_err("os_allocator_open Android failed to allocate context\n");
|
||||||
|
return MPP_ERR_MALLOC;
|
||||||
|
}
|
||||||
|
p->ion_client =
|
||||||
|
*ctx = p;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -26,7 +26,7 @@ typedef struct {
|
|||||||
RK_U32 size;
|
RK_U32 size;
|
||||||
RK_U32 version;
|
RK_U32 version;
|
||||||
|
|
||||||
MPP_RET (*alloc)(MppAllocator allocator, MppBufferData **data, size_t size);
|
MPP_RET (*alloc)(MppAllocator allocator, MppBufferData *data, size_t size);
|
||||||
MPP_RET (*free)(MppAllocator allocator, MppBufferData *data);
|
MPP_RET (*free)(MppAllocator allocator, MppBufferData *data);
|
||||||
} MppAllocatorApi;
|
} MppAllocatorApi;
|
||||||
|
|
||||||
|
@@ -14,21 +14,50 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "os_mem.h"
|
#include "os_mem.h"
|
||||||
#include "os_allocator.h"
|
#include "os_allocator.h"
|
||||||
|
|
||||||
int os_allocator_open(void **ctx)
|
#include "mpp_mem.h"
|
||||||
|
#include "mpp_log.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
size_t alignment;
|
||||||
|
} allocator_impl;
|
||||||
|
|
||||||
|
int os_allocator_open(void **ctx, size_t alignment)
|
||||||
{
|
{
|
||||||
if (ctx)
|
allocator_impl *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_impl, 1);
|
||||||
|
if (NULL == p) {
|
||||||
*ctx = NULL;
|
*ctx = NULL;
|
||||||
return 0;
|
mpp_err("os_allocator_open Linux failed to allocate context\n");
|
||||||
|
return MPP_ERR_MALLOC;
|
||||||
|
}
|
||||||
|
|
||||||
|
p->alignment = alignment;
|
||||||
|
*ctx = p;
|
||||||
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int os_allocator_alloc(void *ctx, MppBufferData *data, size_t alignment, size_t size)
|
int os_allocator_alloc(void *ctx, MppBufferData *data, size_t size)
|
||||||
{
|
{
|
||||||
(void) ctx;
|
allocator_impl *p = NULL;
|
||||||
return os_malloc(&data->ptr, alignment, size);
|
|
||||||
|
if (NULL == ctx) {
|
||||||
|
mpp_err("os_allocator_alloc Linux found NULL context input\n");
|
||||||
|
return MPP_ERR_NULL_PTR;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = (allocator_impl *)ctx;
|
||||||
|
return os_malloc(&data->ptr, p->alignment, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void os_allocator_free(void *ctx, MppBufferData *data)
|
void os_allocator_free(void *ctx, MppBufferData *data)
|
||||||
@@ -39,6 +68,9 @@ void os_allocator_free(void *ctx, MppBufferData *data)
|
|||||||
|
|
||||||
void os_allocator_close(void *ctx)
|
void os_allocator_close(void *ctx)
|
||||||
{
|
{
|
||||||
(void) ctx;
|
if (ctx)
|
||||||
|
mpp_free(ctx);
|
||||||
|
else
|
||||||
|
mpp_err("os_allocator_close Linux found NULL context input\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -26,32 +26,17 @@
|
|||||||
#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, MppBufferData **data, size_t size)
|
MPP_RET mpp_allocator_alloc(MppAllocator allocator, MppBufferData *data, size_t size)
|
||||||
{
|
{
|
||||||
if (NULL == allocator || NULL == data) {
|
if (NULL == allocator || NULL == data || 0 == size) {
|
||||||
mpp_err("mpp_allocator_alloc invalid input: allocator %p data %p\n",
|
mpp_err("mpp_allocator_alloc invalid input: allocator %p data %p size %d\n",
|
||||||
allocator, data);
|
allocator, data, size);
|
||||||
return MPP_ERR_UNKNOW;
|
return MPP_ERR_UNKNOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == size) {
|
|
||||||
*data = NULL;
|
|
||||||
return MPP_NOK;
|
|
||||||
}
|
|
||||||
|
|
||||||
MppBufferData *pdata = mpp_malloc(MppBufferData, 1);
|
|
||||||
if (NULL == pdata) {
|
|
||||||
mpp_err("mpp_allocator_alloc failed to alloc MppBufferData\n");
|
|
||||||
*data = NULL;
|
|
||||||
return MPP_ERR_MALLOC;
|
|
||||||
}
|
|
||||||
|
|
||||||
MppAllocatorImpl *palloc = (MppAllocatorImpl *)allocator;
|
MppAllocatorImpl *palloc = (MppAllocatorImpl *)allocator;
|
||||||
MPP_ALLOCATOR_LOCK(palloc);
|
MPP_ALLOCATOR_LOCK(palloc);
|
||||||
|
int ret = os_allocator_alloc(palloc->allocator, data, size);
|
||||||
int ret = os_allocator_alloc(palloc->allocator, pdata, palloc->alignment, size);
|
|
||||||
*data = pdata;
|
|
||||||
|
|
||||||
MPP_ALLOCATOR_UNLOCK(palloc);
|
MPP_ALLOCATOR_UNLOCK(palloc);
|
||||||
|
|
||||||
return (0 == ret) ? (MPP_OK) : (MPP_NOK);
|
return (0 == ret) ? (MPP_OK) : (MPP_NOK);
|
||||||
@@ -70,8 +55,6 @@ MPP_RET mpp_allocator_free(MppAllocator allocator, MppBufferData *data)
|
|||||||
os_allocator_free(palloc->allocator, data);
|
os_allocator_free(palloc->allocator, data);
|
||||||
MPP_ALLOCATOR_UNLOCK(palloc);
|
MPP_ALLOCATOR_UNLOCK(palloc);
|
||||||
|
|
||||||
mpp_free(data);
|
|
||||||
|
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,14 +79,14 @@ MPP_RET mpp_alloctor_get(MppAllocator *allocator, MppAllocatorApi **api)
|
|||||||
return MPP_ERR_NULL_PTR;
|
return MPP_ERR_NULL_PTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
os_allocator_open(&palloc->allocator);
|
palloc->alignment = SZ_4K;
|
||||||
|
os_allocator_open(&palloc->allocator, palloc->alignment);
|
||||||
|
|
||||||
papi->size = sizeof(papi->size);
|
papi->size = sizeof(papi->size);
|
||||||
papi->version = 1;
|
papi->version = 1;
|
||||||
papi->alloc = mpp_allocator_alloc;
|
papi->alloc = mpp_allocator_alloc;
|
||||||
papi->free = mpp_allocator_free;
|
papi->free = mpp_allocator_free;
|
||||||
|
|
||||||
palloc->api = papi;
|
palloc->api = papi;
|
||||||
palloc->alignment = SZ_4K;
|
|
||||||
|
|
||||||
pthread_mutexattr_t attr;
|
pthread_mutexattr_t attr;
|
||||||
pthread_mutexattr_init(&attr);
|
pthread_mutexattr_init(&attr);
|
||||||
|
@@ -23,8 +23,8 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int os_allocator_open(void **ctx);
|
int os_allocator_open(void **ctx, size_t alignment);
|
||||||
int os_allocator_alloc(void *ctx, MppBufferData *data, size_t alignment, size_t size);
|
int os_allocator_alloc(void *ctx, MppBufferData *data, size_t size);
|
||||||
void os_allocator_free(void *ctx, MppBufferData *data);
|
void os_allocator_free(void *ctx, MppBufferData *data);
|
||||||
void os_allocator_close(void *ctx);
|
void os_allocator_close(void *ctx);
|
||||||
|
|
||||||
|
@@ -17,17 +17,45 @@
|
|||||||
#include "os_mem.h"
|
#include "os_mem.h"
|
||||||
#include "os_allocator.h"
|
#include "os_allocator.h"
|
||||||
|
|
||||||
int os_allocator_open(void **ctx)
|
#include "mpp_mem.h"
|
||||||
|
#include "mpp_log.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
size_t alignment;
|
||||||
|
} allocator_impl;
|
||||||
|
|
||||||
|
int os_allocator_open(void **ctx, size_t alignment)
|
||||||
{
|
{
|
||||||
if (ctx)
|
allocator_impl *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_impl, 1);
|
||||||
|
if (NULL == p) {
|
||||||
*ctx = NULL;
|
*ctx = NULL;
|
||||||
return 0;
|
mpp_err("os_allocator_open Window failed to allocate context\n");
|
||||||
|
return MPP_ERR_MALLOC;
|
||||||
|
}
|
||||||
|
|
||||||
|
p->alignment = alignment;
|
||||||
|
*ctx = p;
|
||||||
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int os_allocator_alloc(void *ctx, MppBufferData *data, size_t alignment, size_t size)
|
int os_allocator_alloc(void *ctx, MppBufferData *data, size_t size)
|
||||||
{
|
{
|
||||||
(void) ctx;
|
allocator_impl *p = NULL;
|
||||||
return os_malloc(&data->ptr, alignment, size);
|
|
||||||
|
if (NULL == ctx) {
|
||||||
|
mpp_err("os_allocator_alloc Window found NULL context input\n");
|
||||||
|
return MPP_ERR_NULL_PTR;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = (allocator_impl *)ctx;
|
||||||
|
return os_malloc(&data->ptr, p->alignment, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void os_allocator_free(void *ctx, MppBufferData *data)
|
void os_allocator_free(void *ctx, MppBufferData *data)
|
||||||
@@ -38,6 +66,9 @@ void os_allocator_free(void *ctx, MppBufferData *data)
|
|||||||
|
|
||||||
void os_allocator_close(void *ctx)
|
void os_allocator_close(void *ctx)
|
||||||
{
|
{
|
||||||
(void) ctx;
|
if (ctx)
|
||||||
|
mpp_free(ctx);
|
||||||
|
else
|
||||||
|
mpp_err("os_allocator_close Window found NULL context input\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -21,23 +21,26 @@
|
|||||||
#include "mpp_log.h"
|
#include "mpp_log.h"
|
||||||
#include "mpp_buffer.h"
|
#include "mpp_buffer.h"
|
||||||
|
|
||||||
#define MPP_BUFFER_TEST_SIZE 1024
|
#define MPP_BUFFER_TEST_SIZE (SZ_1K*4)
|
||||||
#define MPP_BUFFER_TEST_COUNT 10
|
#define MPP_BUFFER_TEST_COMMIT_COUNT 10
|
||||||
|
#define MPP_BUFFER_TEST_NORMAL_COUNT 10
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
MPP_RET ret = MPP_OK;
|
MPP_RET ret = MPP_OK;
|
||||||
MppBufferCommit commit;
|
MppBufferCommit commit;
|
||||||
MppBufferGroup group = NULL;
|
MppBufferGroup group = NULL;
|
||||||
MppBuffer buffer[MPP_BUFFER_TEST_COUNT];
|
MppBuffer commit_buffer[MPP_BUFFER_TEST_COMMIT_COUNT];
|
||||||
void *ptr[MPP_BUFFER_TEST_COUNT];
|
void *commit_ptr[MPP_BUFFER_TEST_COMMIT_COUNT];
|
||||||
|
MppBuffer normal_buffer[MPP_BUFFER_TEST_NORMAL_COUNT];
|
||||||
size_t size = MPP_BUFFER_TEST_SIZE;
|
size_t size = MPP_BUFFER_TEST_SIZE;
|
||||||
RK_S32 i;
|
RK_S32 i;
|
||||||
|
|
||||||
mpp_log("mpp_buffer_test start\n");
|
mpp_log("mpp_buffer_test start\n");
|
||||||
|
|
||||||
memset(ptr, 0, sizeof(ptr));
|
memset(commit_ptr, 0, sizeof(commit_ptr));
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(commit_buffer, 0, sizeof(commit_buffer));
|
||||||
|
memset(normal_buffer, 0, sizeof(normal_buffer));
|
||||||
|
|
||||||
ret = mpp_buffer_group_get(&group, MPP_BUFFER_TYPE_NORMAL);
|
ret = mpp_buffer_group_get(&group, MPP_BUFFER_TYPE_NORMAL);
|
||||||
if (MPP_OK != ret) {
|
if (MPP_OK != ret) {
|
||||||
@@ -45,17 +48,19 @@ int main()
|
|||||||
goto MPP_BUFFER_failed;
|
goto MPP_BUFFER_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mpp_log("mpp_buffer_test commit mode start\n");
|
||||||
|
|
||||||
commit.type = MPP_BUFFER_TYPE_NORMAL;
|
commit.type = MPP_BUFFER_TYPE_NORMAL;
|
||||||
commit.size = size;
|
commit.size = size;
|
||||||
|
|
||||||
for (i = 0; i < MPP_BUFFER_TEST_COUNT; i++) {
|
for (i = 0; i < MPP_BUFFER_TEST_COMMIT_COUNT; i++) {
|
||||||
ptr[i] = malloc(size);
|
commit_ptr[i] = malloc(size);
|
||||||
if (NULL == ptr[i]) {
|
if (NULL == commit_ptr[i]) {
|
||||||
mpp_err("mpp_buffer_test malloc failed\n");
|
mpp_err("mpp_buffer_test malloc failed\n");
|
||||||
goto MPP_BUFFER_failed;
|
goto MPP_BUFFER_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
commit.data.ptr = ptr[i];
|
commit.data.ptr = commit_ptr[i];
|
||||||
|
|
||||||
ret = mpp_buffer_commit(group, &commit);
|
ret = mpp_buffer_commit(group, &commit);
|
||||||
if (MPP_OK != ret) {
|
if (MPP_OK != ret) {
|
||||||
@@ -64,29 +69,51 @@ int main()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < MPP_BUFFER_TEST_COUNT; i++) {
|
for (i = 0; i < MPP_BUFFER_TEST_COMMIT_COUNT; i++) {
|
||||||
ret = mpp_buffer_get(group, &buffer[i], size);
|
ret = mpp_buffer_get(group, &commit_buffer[i], size);
|
||||||
if (MPP_OK != ret) {
|
if (MPP_OK != ret) {
|
||||||
mpp_err("mpp_buffer_test mpp_buffer_get failed\n");
|
mpp_err("mpp_buffer_test mpp_buffer_get commit mode failed\n");
|
||||||
goto MPP_BUFFER_failed;
|
goto MPP_BUFFER_failed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < MPP_BUFFER_TEST_COUNT; i++) {
|
for (i = 0; i < MPP_BUFFER_TEST_COMMIT_COUNT; i++) {
|
||||||
ret = mpp_buffer_put(&buffer[i]);
|
ret = mpp_buffer_put(&commit_buffer[i]);
|
||||||
if (MPP_OK != ret) {
|
if (MPP_OK != ret) {
|
||||||
mpp_err("mpp_buffer_test mpp_buffer_put failed\n");
|
mpp_err("mpp_buffer_test mpp_buffer_put commit mode failed\n");
|
||||||
goto MPP_BUFFER_failed;
|
goto MPP_BUFFER_failed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < MPP_BUFFER_TEST_COUNT; i++) {
|
for (i = 0; i < MPP_BUFFER_TEST_COMMIT_COUNT; i++) {
|
||||||
if (ptr[i]) {
|
if (commit_ptr[i]) {
|
||||||
free(ptr[i]);
|
free(commit_ptr[i]);
|
||||||
ptr[i] = NULL;
|
commit_ptr[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mpp_log("mpp_buffer_test commit mode success\n");
|
||||||
|
|
||||||
|
mpp_log("mpp_buffer_test normal mode start\n");
|
||||||
|
|
||||||
|
for (i = 0; i < MPP_BUFFER_TEST_NORMAL_COUNT; i++) {
|
||||||
|
ret = mpp_buffer_get(group, &normal_buffer[i], (i+1)*SZ_1K);
|
||||||
|
if (MPP_OK != ret) {
|
||||||
|
mpp_err("mpp_buffer_test mpp_buffer_get mode normal failed\n");
|
||||||
|
goto MPP_BUFFER_failed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < MPP_BUFFER_TEST_NORMAL_COUNT; i++) {
|
||||||
|
ret = mpp_buffer_put(&normal_buffer[i]);
|
||||||
|
if (MPP_OK != ret) {
|
||||||
|
mpp_err("mpp_buffer_test mpp_buffer_get mode normal failed\n");
|
||||||
|
goto MPP_BUFFER_failed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mpp_log("mpp_buffer_test normal mode success\n");
|
||||||
|
|
||||||
if (group)
|
if (group)
|
||||||
mpp_buffer_group_put(&group);
|
mpp_buffer_group_put(&group);
|
||||||
|
|
||||||
@@ -94,14 +121,14 @@ int main()
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
MPP_BUFFER_failed:
|
MPP_BUFFER_failed:
|
||||||
for (i = 0; i < MPP_BUFFER_TEST_COUNT; i++) {
|
for (i = 0; i < MPP_BUFFER_TEST_COMMIT_COUNT; i++) {
|
||||||
mpp_buffer_put(&buffer[i]);
|
mpp_buffer_put(&commit_buffer[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < MPP_BUFFER_TEST_COUNT; i++) {
|
for (i = 0; i < MPP_BUFFER_TEST_COMMIT_COUNT; i++) {
|
||||||
if (ptr[i]) {
|
if (commit_ptr[i]) {
|
||||||
free(ptr[i]);
|
free(commit_ptr[i]);
|
||||||
ptr[i] = NULL;
|
commit_ptr[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user