From 080afae264fe7ff89a54886f28dff208fe5a06c4 Mon Sep 17 00:00:00 2001
From: chenshijun <csj_sky@126.com>
Date: 星期二, 16 四月 2019 22:01:35 +0800
Subject: [PATCH] 整合代码

---
 QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp b/QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp
index 27a837d..7787821 100644
--- a/QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp
+++ b/QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp
@@ -145,7 +145,8 @@
  * @param p_this
  */
 void BASICGB28181::FFmpegDecoderJPG::BareFlowDecoderThd(FFmpegDecoderJPG *p_this) {
-    DBG(p_this->m_camIdx << "  BareFlowDecoderThd ok ... gpuIdx is " << p_this->m_gpuIdx);
+    DBG(p_this->m_camIdx <<  "  BareFlowDecoderThd ok ... gpuIdx is " << p_this->m_gpuIdx);
+    DBG("p_thisADDR:" << p_this << "p_this->m_running" << p_this->m_running);
     while (!p_this->m_running) {
 
         p_this->m_running = true;
@@ -277,6 +278,10 @@
 
 //        BASICGB28181::avframe_to_cvmat(frame).copyTo(p_this->m_image);
             p_this->m_image = std::move(BASICGB28181::avframe_to_cvmat(p_this->frame));
+            if(p_this->m_image.empty()) {
+                ERR("camID:" << p_this->m_camIdx << " frameW:" << p_this->frame->width);
+                continue;
+            }
 //            灏唅甯т繚瀛樹负蹇収
             if (p_this->m_SnapshotNotSaveRet && (p_this->pkt.flags & AV_PKT_FLAG_KEY)) {
                 try {
@@ -368,7 +373,7 @@
 
 bool BASICGB28181::FFmpegDecoderJPG::stopThd() {
     TryCath(
-        DBG(m_camIdx << "  FFmpegDecoderJPG stopThd ... " << m_camIdx);
+        DBG("FFmpegDecoderJPG stopThd ... " << m_camIdx);
         m_running = false;
     );
     return true;
@@ -433,7 +438,7 @@
         if (!m_packetsVec.empty()) {
             auto iter = m_packetsVec.begin();
             while (iter->m_frameId < lastFrameId) {
-                INFO("DropFrame: " << iter->m_frameId);
+//                INFO("DropFrame: " << iter->m_frameId);
                 delete iter->m_packet.data;
                 iter = m_packetsVec.erase(iter);
             }
@@ -463,7 +468,7 @@
 
 bool BASICGB28181::FFmpegDecoderJPG::SaveVideo(std::string path, int64_t lastFrameId) {
     std::lock_guard<std::mutex> lock(g_mutex);
-    INFO("SaveVideo: " << path << "m_packetsVec.size : " << m_packetsVec.size());
+//    INFO("SaveVideo: " << path << "m_packetsVec.size : " << m_packetsVec.size());
     if (!m_packetsVec.empty()) {
         startWrite(path.c_str());
         int64_t firstKeyFramePts = m_packetsVec[0].m_packet.pts;
@@ -471,7 +476,7 @@
         unsigned long int frame_index = 0;
         for (const auto &item:m_packetsVec) {
             if (item.m_frameId < lastFrameId) {
-                DBG("item.m_frameId < lastFrameId   " << item.m_frameId << "  " << lastFrameId);
+//                DBG("item.m_frameId < lastFrameId   " << item.m_frameId << "  " << lastFrameId);
                 conversion(const_cast<AVPacket *> (&item.m_packet), firstKeyFramePts, firstKeyFrameDts, video_st,
                            frame_index);
                 frame_index++;
@@ -535,7 +540,7 @@
     m_frameIndex++;
     m_packetsVec.push_back({m_frameIndex, newPacket});
     if (newPacket.flags & AV_PKT_FLAG_KEY) {
-        DBG("newPacket.flags & AV_PKT_FLAG_KEY   ");
+//        DBG("newPacket.flags & AV_PKT_FLAG_KEY   ");
         m_last_I_FrameId = m_frameIndex;
     }
 }
@@ -617,7 +622,7 @@
         AVPacket *pkg = static_cast<AVPacket *>(packet);
 
 
-        DBG("frame_index==%d\n" << frame_index);
+//        DBG("frame_index==\n" << frame_index);
         //Write PTS
         AVRational time_base1 = inStream->time_base;
         //Duration between 2 frames (us)

--
Gitblit v1.8.0