diff --git a/src/decoder/dvpp/DvppDecoder.cpp b/src/decoder/dvpp/DvppDecoder.cpp index b34a390..5491c35 100644 --- a/src/decoder/dvpp/DvppDecoder.cpp +++ b/src/decoder/dvpp/DvppDecoder.cpp @@ -627,27 +627,25 @@ void DvppDecoder::read_thread() { av_packet_free(&pkt); pkt = nullptr; - if (vdecChannelDesc) { - sendVdecEos(vdecChannelDesc); - } - - while(m_bRunning && m_decoded_data_queue.size() > 0) { - std::this_thread::sleep_for(std::chrono::milliseconds(5)); - } - } while (0); if (vdecChannelDesc) { + sendVdecEos(vdecChannelDesc); + CHECK_NOT_RETURN(aclvdecDestroyChannel(vdecChannelDesc), "aclvdecDestroyChannel failed"); CHECK_NOT_RETURN(aclvdecDestroyChannelDesc(vdecChannelDesc), "aclvdecDestroyChannelDesc failed"); vdecChannelDesc = nullptr; } - m_bRunning=false; - m_bExitReportThd = true; CHECK_NOT_RETURN(pthread_join(report_thread, nullptr), "report_thread join failed"); + while(m_bRunning && m_decoded_data_queue.size() > 0) { + std::this_thread::sleep_for(std::chrono::milliseconds(5)); + } + + m_bRunning=false; + m_bExitDisplayThd = true; display_thread.join(); @@ -774,6 +772,12 @@ void DvppDecoder::doVdppVdecCallBack(acldvppStreamDesc *input, acldvppPicDesc *o // 内部缓存计数减1 m_DvppCacheCounter--; + CHECK_AND_RETURN_NOVALUE(aclrtSetCurrentContext(m_context), "aclrtSetCurrentContext failed"); + + void *inputDataDev = acldvppGetStreamDescData(input); + acldvppFree(inputDataDev); + inputDataDev = nullptr; + if(nullptr == pUserData){ return; } @@ -783,12 +787,6 @@ void DvppDecoder::doVdppVdecCallBack(acldvppStreamDesc *input, acldvppPicDesc *o m_out_count++; - CHECK_AND_RETURN_NOVALUE(aclrtSetCurrentContext(m_context), "aclrtSetCurrentContext failed"); - - void *inputDataDev = acldvppGetStreamDescData(input); - acldvppFree(inputDataDev); - inputDataDev = nullptr; - void *outputDataDev = acldvppGetPicDescData(output); uint32_t outputSize = acldvppGetPicDescSize(output); uint32_t width = acldvppGetPicDescWidth(output); @@ -845,6 +843,10 @@ void DvppDecoder::doVdppVdecCallBack(acldvppStreamDesc *input, acldvppPicDesc *o if(mem){ m_decoded_data_queue.push(mem); bCached = true; + } else { + // 逻辑完善 + delete mem; + mem = nullptr; } }