Commit f36a280ad911ba7872cc410b45cab0620d880288

Authored by Hu Chunming
1 parent b1f5dd81

代码优化

src/decoder/dvpp/DvppDataMemory.hpp
@@ -30,8 +30,6 @@ public: @@ -30,8 +30,6 @@ public:
30 pHwRgb = pHwData; 30 pHwRgb = pHwData;
31 } 31 }
32 32
33 -  
34 -  
35 DvppDataMemory(DvppDataMemory* pSrc):DeviceMemory(-1, pSrc->getWidth(), pSrc->getWidthStride(), pSrc->getHeight(), pSrc->getHeightStride(), pSrc->getId(), pSrc->getDeviceId(), pSrc->isKeyFrame(), pSrc->getFrameNb(), false){ 33 DvppDataMemory(DvppDataMemory* pSrc):DeviceMemory(-1, pSrc->getWidth(), pSrc->getWidthStride(), pSrc->getHeight(), pSrc->getHeightStride(), pSrc->getId(), pSrc->getDeviceId(), pSrc->isKeyFrame(), pSrc->getFrameNb(), false){
36 if(pSrc == nullptr) { 34 if(pSrc == nullptr) {
37 LOG_ERROR("[{}]- pSrc is nullptr", pSrc->getId()); 35 LOG_ERROR("[{}]- pSrc is nullptr", pSrc->getId());
src/decoder/dvpp/FFRecoderTaskManager.cpp
@@ -25,7 +25,6 @@ static bool is_key_frame(AVPacket *pkt) { @@ -25,7 +25,6 @@ static bool is_key_frame(AVPacket *pkt) {
25 } 25 }
26 26
27 FFRecoderTaskManager::FFRecoderTaskManager(){ 27 FFRecoderTaskManager::FFRecoderTaskManager(){
28 - m_recoder_thread = nullptr;  
29 m_cache_thread = nullptr; 28 m_cache_thread = nullptr;
30 29
31 m_bExit = false; 30 m_bExit = false;
@@ -127,7 +126,7 @@ void FFRecoderTaskManager::create_recode_task(RecoderInfo& recoderInfo) { @@ -127,7 +126,7 @@ void FFRecoderTaskManager::create_recode_task(RecoderInfo& recoderInfo) {
127 void FFRecoderTaskManager::pkt_cache_thread() { 126 void FFRecoderTaskManager::pkt_cache_thread() {
128 LOG_INFO("pkt_cache_thread start..."); 127 LOG_INFO("pkt_cache_thread start...");
129 128
130 - m_recoder_thread = new std::thread( 129 + thread* recoder_thread = new std::thread(
131 [](void* arg) { 130 [](void* arg) {
132 FFRecoderTaskManager* _this=(FFRecoderTaskManager*)arg; 131 FFRecoderTaskManager* _this=(FFRecoderTaskManager*)arg;
133 if(_this != nullptr) { 132 if(_this != nullptr) {
@@ -172,10 +171,10 @@ void FFRecoderTaskManager::pkt_cache_thread() { @@ -172,10 +171,10 @@ void FFRecoderTaskManager::pkt_cache_thread() {
172 171
173 m_bExitRecoderThread = true; 172 m_bExitRecoderThread = true;
174 173
175 - if (m_recoder_thread) {  
176 - m_recoder_thread->join();  
177 - delete m_recoder_thread;  
178 - m_recoder_thread = nullptr; 174 + if (recoder_thread) {
  175 + recoder_thread->join();
  176 + delete recoder_thread;
  177 + recoder_thread = nullptr;
179 } 178 }
180 179
181 // 清空数据 180 // 清空数据
@@ -253,7 +252,7 @@ void FFRecoderTaskManager::recode_thread() { @@ -253,7 +252,7 @@ void FFRecoderTaskManager::recode_thread() {
253 end_frame_nb = (*it_save)->frame_nb; 252 end_frame_nb = (*it_save)->frame_nb;
254 } 253 }
255 254
256 - ffrecoder.flush(); 255 + // ffrecoder.flush();
257 ffrecoder.uninit(); 256 ffrecoder.uninit();
258 257
259 // 发送mq消息 258 // 发送mq消息
src/decoder/dvpp/FFRecoderTaskManager.h
@@ -55,7 +55,6 @@ private: @@ -55,7 +55,6 @@ private:
55 AVCodecContext* m_avctx; 55 AVCodecContext* m_avctx;
56 AVStream* m_inStream; 56 AVStream* m_inStream;
57 57
58 - thread* m_recoder_thread{nullptr};  
59 thread* m_cache_thread{nullptr}; 58 thread* m_cache_thread{nullptr};
60 59
61 mq_callback_t mq_publish_func; 60 mq_callback_t mq_publish_func;