zoukankan      html  css  js  c++  java
  • 项目中使用到的算法

    收到告警之后开始录像,恢复正常超过5s之后,停止录像。正常异常来回切换在5s之内,继续录像。

    void WidgetGeneral::warnRecord(qint64 time_data, const XKT_SDKServer_EmotionDataNotify& info)
    {
        int int_degree = (int)(info.degree);
    
        if (int_degree <= 0)
        {
            int_degree = -int_degree;
            int_degree = 50 - int_degree;
        }
        else
        {
            int_degree += 50;
        }
    
        if (int_degree > 50)
        {
            if (m_firstWarn == 0)
            {
                m_firstWarn = time_data;
                m_bBackToNormal = false;
    
                //截图,并且录制视频
                streamMediaToFile("", "", time_data);
    
            }
        }
    
        if (m_firstWarn != 0)
        {
            //出现异常之后,恢复成正常
            if (int_degree < 51)
            {
                m_bBackToNormal = true;
                //异常时间超过5秒钟,结束视频录制
                if ((time_data- m_firstWarn) >= 5000)
                {
                    m_bBackToNormal = false;
                    m_firstWarn = 0;
                    this->stopMakeFile();
                }
            }
    
            //对长视频进行切分,暂定最长时长为30分钟,超过30分钟就重新录视频
            if (int_degree > 50)
            {
                if ((time_data - m_firstWarn) >= 1800000)
                {
                    m_firstWarn = time_data;
                    m_bBackToNormal = false;
    
                    this->stopMakeFile();
    
                    //截图,并且录制视频
                    streamMediaToFile("", "", time_data);
    
                }
    
            }
    
        }
    
        //有正常转变成了异常,跟新m_firstWarn的时间戳
        if (m_bBackToNormal && int_degree>50)
        {
            m_firstWarn = time_data;
        }
    
    
    }
  • 相关阅读:
    第02组 团队项目-需求分析报告
    团队项目-选题报告
    第二次结对编程作业
    第2组 团队展示
    Alapha冲刺(3/6)
    Alpha(2/6)
    Alpha冲刺(1/6)
    第2组 团队Git现场编程实战
    团队项目-需求分析报告
    团队项目-选题报告
  • 原文地址:https://www.cnblogs.com/zhangxuan/p/10439107.html
Copyright © 2011-2022 走看看