pansen
2019-04-09 00f7c180ceedecab842ce2a05308f435f9f54718
QiaoJiaSystem/GB28181DecoderModel/VideoCaptureElementWithRtp.cpp
@@ -49,28 +49,45 @@
                DBG("waitSignal(\"DecoderImageOK\") begin");
#endif
                //等待信号触发
//                DBG("waitSignal before: " << p_this->m_chanPubID);
                gSignalLock.waitSignal(p_this->m_chanPubID + "DecoderImageOK");
//                DBG("waitSignal: " << p_this->m_chanPubID);
#ifdef TestCode
                DBG("waitSignal(\"DecoderImageOK\") after");
#endif
                /****录像模块代码*****/
                p_this->m_picCount++;
                //几张选一张放入Redis
                if (p_this->m_picCount % m_nPicsPickOne != 0) {
                    continue;
                } else {
                    p_this->m_picCount.store(0);
                }
//            从ffmpeg解码类中获取图片
                p_this->m_fFmpegDecoderJPG.getImage().copyTo(p_this->m_image);
                /****debug*****///todo
                if (p_this->m_image.empty()) {
                    ERR("camID:" << p_this->m_chanPubID);
                    continue;
                }
//                else {
//                    static int count =0;
//                    count ++;
//                    if(count > 100){
//                        ERR("camID:" << p_this->m_chanPubID << " cols:" << p_this->m_image.cols <<\
//        " rows:" << p_this->m_image.rows << " channels:" << p_this->m_image.channels());
//                        count = 0;
//                    }
//                }
                {
                    /****录像模块代码*****/
                    p_this->m_picCount++;
                    //几张选一张放入Redis
                    if (p_this->m_picCount % m_nPicsPickOne != 0) {
                        continue;
                    } else {
                        p_this->m_picCount.store(0);
                    }
                    cv::Mat copyMat;
                    std::string imageName = p_this->m_fFmpegDecoderJPG.GetImageName();
                    p_this->m_image.copyTo(copyMat);
                    m_pManager->SaveImageToRedis(p_this->m_chanPubID, imageName, copyMat);
                    p_this->m_pManager->SaveImageToRedis(p_this->m_chanPubID, imageName, copyMat);
                }
                /*********/
                p_this->submit();
            }
@@ -129,6 +146,7 @@
                            p_this->m_running = false;
                            stop();
                            INFO("grabFrame faild, element stopping");
                            break;
                        } else {
                            //todo 业务死锁
                            usleep((6 - reopenTime--) * 1000000);