pansen
2019-04-09 00f7c180ceedecab842ce2a05308f435f9f54718
# Type(<scope>): <subject>

# <body>

# <footer>

# type 字段包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
# scope用于说明 commit 影响的范围,比如数据层、控制层、视图层等等。
# subject是 commit 目的的简短描述,不超过50个字符
# Body 部分是对本次 commit 的详细描述,可以分成多行
# Footer用来关闭 Issue或以BREAKING CHANGE开头,后面是对变动的描述、
# 以及变动理由和迁移方法

# 英文版详细例子,请看这里
# https://github.com/sparkbox/how_to/tree/master/style/git
# 中文版介绍,请看这里
# http://www.ruanyifeng.com/blog/2016/01/commit_message_change_log.html
3个文件已修改
50 ■■■■ 已修改文件
QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/GB28181DecoderModel/VideoCaptureElementWithRtp.cpp 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/GB28181DecoderModel/VideoCaptureElementWithRtp.h 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/GB28181DecoderModel/FFmpegDecoderJPG.cpp
@@ -5,6 +5,7 @@
#include <zconf.h>
#include <opencv2/opencv.hpp>
#include "FFmpegDecoderJPG.h"
#include <cstring>
void BASICGB28181::initFFmpeg() {
    av_register_all();
@@ -278,6 +279,20 @@
//        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 << "frame.data.len" << strlen(p_this->frame->data[0]));
                continue;
            }
//            else {
//                static int count =0;
//                count ++;
//                if(count > 100){
//                    ERR("camID:" << p_this->m_camIdx << " cols:" << p_this->m_image.cols <<\
//        " rows:" << p_this->m_image.rows << " channels:" << p_this->m_image.channels());
//                    count = 0;
//                }
//
//            }
//            将i帧保存为快照
            if (p_this->m_SnapshotNotSaveRet && (p_this->pkt.flags & AV_PKT_FLAG_KEY)) {
                try {
@@ -317,6 +332,7 @@
#endif
            //触发上层信号
            gSignalLock.emitSigal(p_this->m_camIdx + "DecoderImageOK");
//            DBG("emitSigal: " << p_this->m_camIdx);
//#ifdef TestCode
//        DBG("emitSigal(\"DecoderImageOK\") after");
//#endif
@@ -536,7 +552,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;
    }
}
QiaoJiaSystem/GB28181DecoderModel/VideoCaptureElementWithRtp.cpp
@@ -49,10 +49,32 @@
                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
//            从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
@@ -61,16 +83,11 @@
                } else {
                    p_this->m_picCount.store(0);
                }
//            从ffmpeg解码类中获取图片
                p_this->m_fFmpegDecoderJPG.getImage().copyTo(p_this->m_image);
                {
                    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);
QiaoJiaSystem/GB28181DecoderModel/VideoCaptureElementWithRtp.h
@@ -73,7 +73,7 @@
        std::atomic<bool> m_running;
        std::atomic<bool> m_waitSignal;
        std::atomic<bool> m_waitSignalrunning;
        std::atomic<bool> m_waitSignalrunning{false};
        //用来保存录像视频的路径
        std::string m_cutPath;