From 91c3b892e976ecf33819c0c2664e4dfcfd88e434 Mon Sep 17 00:00:00 2001
From: chenshijun <csj_sky@126.com>
Date: 星期六, 30 三月 2019 17:45:59 +0800
Subject: [PATCH] 添加新版本的GB28181代码

---
 QiaoJiaSystem/GB28181DecoderModel/VideoCaptureElementWithRtp.cpp |   29 +++++++++++++++++++++++------
 1 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/QiaoJiaSystem/GB28181DecoderModel/VideoCaptureElementWithRtp.cpp b/QiaoJiaSystem/GB28181DecoderModel/VideoCaptureElementWithRtp.cpp
index b2acfc4..8859d91 100644
--- a/QiaoJiaSystem/GB28181DecoderModel/VideoCaptureElementWithRtp.cpp
+++ b/QiaoJiaSystem/GB28181DecoderModel/VideoCaptureElementWithRtp.cpp
@@ -111,14 +111,30 @@
                 p_this->m_running = true;
                 //鍚姩ffmpeg瑙g爜妯″潡
                 p_this->m_fFmpegDecoderJPG.startThd(p_this->m_chanPubID, p_this->m_fps, p_this->m_gpuIdx);
+                usleep(1000000);
                 //闃诲绾跨▼锛岀瓑寰呭閮ㄨЕ鍙戝叧闂偣鎾�
                 while (p_this->m_running) {
-//                    if(p_this->m_fFmpegDecoderJPG.getRunning()) {
-                    usleep(300000);
-//                    }else{
-//                        p_this->m_running = false;
-//                        break;
-//                    }
+                    if(p_this->m_fFmpegDecoderJPG.getRunning()) {
+                        usleep(300000);
+                    } else {
+
+                        // 鏍规嵁reopenTime鍒ゆ柇鏄惁闇�瑕侀噸鍚�
+                        if (reopenTime < 0) {
+                            p_this->m_running = false;
+                            stop();
+                            INFO("grabFrame faild, element stopping");
+                        } else {
+                            //todo 涓氬姟姝婚攣
+                            usleep((6 - reopenTime--) * 1000000);
+                            INFO("grabFrame faild, try reopen video: ");
+
+                            //鍏抽棴ffmpeg瑙g爜妯″潡
+                            p_this->m_fFmpegDecoderJPG.stopThd();
+                            //鍚姩ffmpeg瑙g爜妯″潡
+                            p_this->m_fFmpegDecoderJPG.startThd(p_this->m_chanPubID, p_this->m_fps, p_this->m_gpuIdx);
+                            continue;
+                        }
+                    }
                 }
                 DBG("videoCaptureElementThd stop ...");
                 //鍋滄鐐规挱
@@ -187,6 +203,7 @@
             INFO("grabFrame faild, element stopping");
             return;
         } else {
+            //todo 涓氬姟姝婚攣
             usleep(reopenTime * 1000);
             INFO("grabFrame faild, try reopen video: ");
             startRtpStream(m_streamTransType);

--
Gitblit v1.8.0