From 56fcdd824b4c8d61e45b16e0b0eaa4f003e2fe2d Mon Sep 17 00:00:00 2001 From: Hu Chunming <2657262686@qq.com> Date: Tue, 11 Jun 2024 11:11:43 +0800 Subject: [PATCH] 代码优化,未修改逻辑 --- src/decoder/dvpp/DvppDecoder.cpp | 12 +----------- src/decoder/dvpp/FFRecoderTaskManager.cpp | 6 +++--- src/decoder/dvpp/FFRecoderTaskManager.h | 4 ++-- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/decoder/dvpp/DvppDecoder.cpp b/src/decoder/dvpp/DvppDecoder.cpp index cf14bc8..53060ed 100644 --- a/src/decoder/dvpp/DvppDecoder.cpp +++ b/src/decoder/dvpp/DvppDecoder.cpp @@ -232,7 +232,7 @@ AVCodecContext* DvppDecoder::init_FFmpeg(FFDecConfig config){ } #ifdef USE_VILLAGE - bool bRet = m_recoderManager.init2(frame_width, frame_height, m_fps, avctx->bit_rate); + bool bRet = m_recoderManager.init(frame_width, frame_height, m_fps, avctx->bit_rate); if (!bRet){ LOG_ERROR("[{}]- m_recoderManager 初始化失败!", m_dec_name); } @@ -640,31 +640,21 @@ void DvppDecoder::read_thread() { } while (0); - LOG_DEBUG("[{}]- 1", m_dec_name); - if (vdecChannelDesc) { CHECK_NOT_RETURN(aclvdecDestroyChannel(vdecChannelDesc), "aclvdecDestroyChannel failed"); CHECK_NOT_RETURN(aclvdecDestroyChannelDesc(vdecChannelDesc), "aclvdecDestroyChannelDesc failed"); vdecChannelDesc = nullptr; } - LOG_DEBUG("[{}]- 2", m_dec_name); - m_bRunning=false; m_bExitReportThd = true; CHECK_NOT_RETURN(pthread_join(report_thread, nullptr), "report_thread join failed"); - LOG_DEBUG("[{}]- 3", m_dec_name); - m_bExitDisplayThd = true; display_thread.join(); - LOG_DEBUG("[{}]- 4", m_dec_name); - m_recoderManager.close(); - - LOG_DEBUG("[{}]- 5", m_dec_name); release_ffmpeg(); release_dvpp(); diff --git a/src/decoder/dvpp/FFRecoderTaskManager.cpp b/src/decoder/dvpp/FFRecoderTaskManager.cpp index ddba14d..83a9d2d 100644 --- a/src/decoder/dvpp/FFRecoderTaskManager.cpp +++ b/src/decoder/dvpp/FFRecoderTaskManager.cpp @@ -44,7 +44,7 @@ FFRecoderTaskManager::~FFRecoderTaskManager(){ LOG_DEBUG("~FFRecoderTaskManager()"); } -bool FFRecoderTaskManager::init2(int w, int h, int fps, int bit_rate) { +bool FFRecoderTaskManager::init(int w, int h, int fps, int bit_rate) { m_width = w; m_height = h; m_bit_rate = bit_rate; @@ -173,7 +173,7 @@ void FFRecoderTaskManager::pkt_cache_thread() { [](void* arg) { FFRecoderTaskManager* _this=(FFRecoderTaskManager*)arg; if(_this != nullptr) { - _this->recode_thread2(); + _this->recode_thread(); }else{ LOG_ERROR("recode 线程启动失败 !"); } @@ -231,7 +231,7 @@ void FFRecoderTaskManager::pkt_cache_thread() { LOG_INFO("pkt_cache_thread end."); } -void FFRecoderTaskManager::recode_thread2() { +void FFRecoderTaskManager::recode_thread() { LOG_INFO("recode_thread2 start..."); while(true) { if(m_bExitRecoderThread) { diff --git a/src/decoder/dvpp/FFRecoderTaskManager.h b/src/decoder/dvpp/FFRecoderTaskManager.h index c0a583e..d30486f 100644 --- a/src/decoder/dvpp/FFRecoderTaskManager.h +++ b/src/decoder/dvpp/FFRecoderTaskManager.h @@ -27,7 +27,7 @@ public: void cache_pkt(AVPacket* pkt, long long frame_nb, string dec_name); - bool init2(int w, int h, int fps, int bit_rate); + bool init(int w, int h, int fps, int bit_rate); void create_recode_task(RecoderInfo& recoderInfo); void close(); @@ -35,7 +35,7 @@ public: void set_mq_callback(mq_callback_t cb); public: - void recode_thread2(); + void recode_thread(); void pkt_cache_thread(); private: -- libgit2 0.21.4