Commit c7a1f20703970383781fb9cd0a5ff076b85e2224
1 parent
e5c14c8e
优化代码,防止可能的内存泄露
Showing
2 changed files
with
3 additions
and
1 deletions
src/decoder/dvpp/DvppDecoder.cpp
@@ -587,6 +587,8 @@ void DvppDecoder::read_thread() { | @@ -587,6 +587,8 @@ void DvppDecoder::read_thread() { | ||
587 | if (m_bReal && m_DvppCacheCounter.load() > m_cache_gop){ | 587 | if (m_bReal && m_DvppCacheCounter.load() > m_cache_gop){ |
588 | // 解码器解码不过来。实时流在此处的处理会导致花屏,这是由于解码器性能问题导致,无法避免 | 588 | // 解码器解码不过来。实时流在此处的处理会导致花屏,这是由于解码器性能问题导致,无法避免 |
589 | // 实时流在这里处理是为了避免长时间不读取数据导致数据中断 | 589 | // 实时流在这里处理是为了避免长时间不读取数据导致数据中断 |
590 | + av_packet_free(&pkt); | ||
591 | + pkt = nullptr; | ||
590 | std::this_thread::sleep_for(std::chrono::milliseconds(10)); | 592 | std::this_thread::sleep_for(std::chrono::milliseconds(10)); |
591 | continue; | 593 | continue; |
592 | } | 594 | } |
src/decoder/dvpp/DvppStreamDecoder.cpp
@@ -500,7 +500,7 @@ int DvppStreamDecoder::SendData(int videoType, char* data, int len, int isKey, u | @@ -500,7 +500,7 @@ int DvppStreamDecoder::SendData(int videoType, char* data, int len, int isKey, u | ||
500 | #ifdef USE_VILLAGE | 500 | #ifdef USE_VILLAGE |
501 | //直接返回,不释放pkt,pkt在recoderManager释放 | 501 | //直接返回,不释放pkt,pkt在recoderManager释放 |
502 | return 0; | 502 | return 0; |
503 | -#elif | 503 | +#else |
504 | ret = 0; | 504 | ret = 0; |
505 | #endif | 505 | #endif |
506 | } | 506 | } |