From e4d3871dbfc24aebd6bd68ee777eb3df36154adc Mon Sep 17 00:00:00 2001 From: ChenSiyong Date: Fri, 15 Jan 2016 09:27:07 +0000 Subject: [PATCH] [mpp_dec]:fixed destroy lock [vpu_mem]: add return fail when mallocliner buffer fail git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@529 6e48237b-75ef-9749-8fc9-41990f28c85a --- mpp/codec/mpp_dec.cpp | 12 ++++++++---- mpp/legacy/vpu_mem_legacy.c | 6 +++++- osal/mpp_thread.cpp | 3 ++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/mpp/codec/mpp_dec.cpp b/mpp/codec/mpp_dec.cpp index 5b70aa81..753dfd48 100644 --- a/mpp/codec/mpp_dec.cpp +++ b/mpp/codec/mpp_dec.cpp @@ -555,8 +555,10 @@ void *mpp_dec_parser_thread(void *data) } parser->lock(); - if (check_task_wait(dec, &task)) - parser->wait(); + if(MPP_THREAD_RUNNING == parser->get_status()){ + if (check_task_wait(dec, &task)) + parser->wait(); + } parser->unlock(); @@ -604,8 +606,10 @@ void *mpp_dec_hal_thread(void *data) * hal thread wait for dxva interface intput firt */ hal->lock(); - if (hal_task_get_hnd(tasks, TASK_PROCESSING, &task)) - hal->wait(); + if(MPP_THREAD_RUNNING == hal->get_status()){ + if (hal_task_get_hnd(tasks, TASK_PROCESSING, &task)) + hal->wait(); + } hal->unlock(); if (task) { diff --git a/mpp/legacy/vpu_mem_legacy.c b/mpp/legacy/vpu_mem_legacy.c index 53facc38..9a42e75d 100644 --- a/mpp/legacy/vpu_mem_legacy.c +++ b/mpp/legacy/vpu_mem_legacy.c @@ -189,8 +189,12 @@ RK_S32 VPUMemJudgeIommu() RK_S32 VPUMallocLinear(VPUMemLinear_t *p, RK_U32 size) { + int ret = 0; MppBuffer buffer = NULL; - mpp_buffer_get(NULL, &buffer, size); + ret = mpp_buffer_get(NULL, &buffer, size); + if(ret != MPP_OK){ + return -1; + } p->phy_addr = (RK_U32)mpp_buffer_get_fd(buffer); p->vir_addr = (RK_U32*)mpp_buffer_get_ptr(buffer); p->size = size; diff --git a/osal/mpp_thread.cpp b/osal/mpp_thread.cpp index 35987452..64b2c9eb 100644 --- a/osal/mpp_thread.cpp +++ b/osal/mpp_thread.cpp @@ -62,9 +62,10 @@ void MppThread::start() void MppThread::stop() { if (MPP_THREAD_UNINITED != mStatus) { + lock(); mStatus = MPP_THREAD_STOPPING; signal(); - + unlock(); void *dummy; pthread_join(mThread, &dummy); thread_dbg(MPP_THREAD_DBG_FUNCTION, "mThread %p mContext %p destroy success\n",