Commit 56fcdd824b4c8d61e45b16e0b0eaa4f003e2fe2d

Authored by Hu Chunming
1 parent 79b0c737

代码优化,未修改逻辑

src/decoder/dvpp/DvppDecoder.cpp
@@ -232,7 +232,7 @@ AVCodecContext* DvppDecoder::init_FFmpeg(FFDecConfig config){ @@ -232,7 +232,7 @@ AVCodecContext* DvppDecoder::init_FFmpeg(FFDecConfig config){
232 } 232 }
233 233
234 #ifdef USE_VILLAGE 234 #ifdef USE_VILLAGE
235 - bool bRet = m_recoderManager.init2(frame_width, frame_height, m_fps, avctx->bit_rate); 235 + bool bRet = m_recoderManager.init(frame_width, frame_height, m_fps, avctx->bit_rate);
236 if (!bRet){ 236 if (!bRet){
237 LOG_ERROR("[{}]- m_recoderManager 初始化失败!", m_dec_name); 237 LOG_ERROR("[{}]- m_recoderManager 初始化失败!", m_dec_name);
238 } 238 }
@@ -640,31 +640,21 @@ void DvppDecoder::read_thread() { @@ -640,31 +640,21 @@ void DvppDecoder::read_thread() {
640 640
641 } while (0); 641 } while (0);
642 642
643 - LOG_DEBUG("[{}]- 1", m_dec_name);  
644 -  
645 if (vdecChannelDesc) { 643 if (vdecChannelDesc) {
646 CHECK_NOT_RETURN(aclvdecDestroyChannel(vdecChannelDesc), "aclvdecDestroyChannel failed"); 644 CHECK_NOT_RETURN(aclvdecDestroyChannel(vdecChannelDesc), "aclvdecDestroyChannel failed");
647 CHECK_NOT_RETURN(aclvdecDestroyChannelDesc(vdecChannelDesc), "aclvdecDestroyChannelDesc failed"); 645 CHECK_NOT_RETURN(aclvdecDestroyChannelDesc(vdecChannelDesc), "aclvdecDestroyChannelDesc failed");
648 vdecChannelDesc = nullptr; 646 vdecChannelDesc = nullptr;
649 } 647 }
650 648
651 - LOG_DEBUG("[{}]- 2", m_dec_name);  
652 -  
653 m_bRunning=false; 649 m_bRunning=false;
654 650
655 m_bExitReportThd = true; 651 m_bExitReportThd = true;
656 CHECK_NOT_RETURN(pthread_join(report_thread, nullptr), "report_thread join failed"); 652 CHECK_NOT_RETURN(pthread_join(report_thread, nullptr), "report_thread join failed");
657 653
658 - LOG_DEBUG("[{}]- 3", m_dec_name);  
659 -  
660 m_bExitDisplayThd = true; 654 m_bExitDisplayThd = true;
661 display_thread.join(); 655 display_thread.join();
662 656
663 - LOG_DEBUG("[{}]- 4", m_dec_name);  
664 -  
665 m_recoderManager.close(); 657 m_recoderManager.close();
666 -  
667 - LOG_DEBUG("[{}]- 5", m_dec_name);  
668 658
669 release_ffmpeg(); 659 release_ffmpeg();
670 release_dvpp(); 660 release_dvpp();
src/decoder/dvpp/FFRecoderTaskManager.cpp
@@ -44,7 +44,7 @@ FFRecoderTaskManager::~FFRecoderTaskManager(){ @@ -44,7 +44,7 @@ FFRecoderTaskManager::~FFRecoderTaskManager(){
44 LOG_DEBUG("~FFRecoderTaskManager()"); 44 LOG_DEBUG("~FFRecoderTaskManager()");
45 } 45 }
46 46
47 -bool FFRecoderTaskManager::init2(int w, int h, int fps, int bit_rate) { 47 +bool FFRecoderTaskManager::init(int w, int h, int fps, int bit_rate) {
48 m_width = w; 48 m_width = w;
49 m_height = h; 49 m_height = h;
50 m_bit_rate = bit_rate; 50 m_bit_rate = bit_rate;
@@ -173,7 +173,7 @@ void FFRecoderTaskManager::pkt_cache_thread() { @@ -173,7 +173,7 @@ void FFRecoderTaskManager::pkt_cache_thread() {
173 [](void* arg) { 173 [](void* arg) {
174 FFRecoderTaskManager* _this=(FFRecoderTaskManager*)arg; 174 FFRecoderTaskManager* _this=(FFRecoderTaskManager*)arg;
175 if(_this != nullptr) { 175 if(_this != nullptr) {
176 - _this->recode_thread2(); 176 + _this->recode_thread();
177 }else{ 177 }else{
178 LOG_ERROR("recode 线程启动失败 !"); 178 LOG_ERROR("recode 线程启动失败 !");
179 } 179 }
@@ -231,7 +231,7 @@ void FFRecoderTaskManager::pkt_cache_thread() { @@ -231,7 +231,7 @@ void FFRecoderTaskManager::pkt_cache_thread() {
231 LOG_INFO("pkt_cache_thread end."); 231 LOG_INFO("pkt_cache_thread end.");
232 } 232 }
233 233
234 -void FFRecoderTaskManager::recode_thread2() { 234 +void FFRecoderTaskManager::recode_thread() {
235 LOG_INFO("recode_thread2 start..."); 235 LOG_INFO("recode_thread2 start...");
236 while(true) { 236 while(true) {
237 if(m_bExitRecoderThread) { 237 if(m_bExitRecoderThread) {
src/decoder/dvpp/FFRecoderTaskManager.h
@@ -27,7 +27,7 @@ public: @@ -27,7 +27,7 @@ public:
27 27
28 void cache_pkt(AVPacket* pkt, long long frame_nb, string dec_name); 28 void cache_pkt(AVPacket* pkt, long long frame_nb, string dec_name);
29 29
30 - bool init2(int w, int h, int fps, int bit_rate); 30 + bool init(int w, int h, int fps, int bit_rate);
31 void create_recode_task(RecoderInfo& recoderInfo); 31 void create_recode_task(RecoderInfo& recoderInfo);
32 32
33 void close(); 33 void close();
@@ -35,7 +35,7 @@ public: @@ -35,7 +35,7 @@ public:
35 void set_mq_callback(mq_callback_t cb); 35 void set_mq_callback(mq_callback_t cb);
36 36
37 public: 37 public:
38 - void recode_thread2(); 38 + void recode_thread();
39 void pkt_cache_thread(); 39 void pkt_cache_thread();
40 40
41 private: 41 private: