Commit f36a280ad911ba7872cc410b45cab0620d880288

Authored by Hu Chunming
1 parent b1f5dd81

代码优化

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