| | |
| | | #ifdef TestCode |
| | | DBG("waitSignal(\"DecoderImageOK\") after"); |
| | | #endif |
| | | { |
| | | if (p_this->m_publishVideoRet) { |
| | | if (p_this->videoPublishElement == nullptr) { |
| | | string path = appConfig.getStringProperty("srsAddr") + "cam" + p_this->m_chanPubID + ".flv"; |
| | | cv::Size size_(appConfig.getIntProperty("pulish.width"), appConfig.getIntProperty("pulish.height")); |
| | | int gupIdx = appPref.getIntData("gpu.index"); |
| | | DBG("videoPublishpath: " << p_this->m_chanPubID << path << " h:" << size_.height); |
| | | p_this->videoPublishElement = new ffmpeg::VideoPublishElement(path, size_, "flv", 25, gupIdx); |
| | | p_this->videoPublishElement->start(); |
| | | } else { |
| | | DBG("videoPublishElement->setImage() : " << p_this->m_chanPubID); |
| | | if (!p_this->m_image.empty()) { |
| | | p_this->videoPublishElement->setImage(p_this->m_image); |
| | | } else { |
| | | ERR("m_image.empty()"); |
| | | } |
| | | } |
| | | } else { |
| | | if (p_this->videoPublishElement != nullptr) { |
| | | DBG("videoPublishElement->stop() :" << p_this->m_chanPubID); |
| | | p_this->videoPublishElement->stop(); |
| | | p_this->videoPublishElement->wait(); |
| | | delete p_this->videoPublishElement; |
| | | p_this->videoPublishElement = nullptr; |
| | | }else{ |
| | | DBG("videoPublishElement null :" << p_this->m_chanPubID); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /****录像模块代码*****/ |
| | | p_this->m_picCount++; |
| | | //几张选一张放入Redis |
| | |
| | | } |
| | | |
| | | void BASICGB28181::VideoCaptureElementWithRtp::threadFunc() { |
| | | |
| | | if (m_publishVideoRet) { |
| | | if (videoPublishElement == nullptr) { |
| | | string path = appConfig.getStringProperty("srsAddr") + "cam" + m_chanPubID + ".flv"; |
| | | cv::Size size_(appConfig.getIntProperty("pulish.width"), appConfig.getIntProperty("pulish.height")); |
| | | int gupIdx = appPref.getIntData("gpu.index"); |
| | | videoPublishElement = new ffmpeg::VideoPublishElement(path, size_, "flv", 25, gupIdx); |
| | | } else { |
| | | videoPublishElement->stop(); |
| | | videoPublishElement->wait(); |
| | | delete videoPublishElement; |
| | | videoPublishElement = nullptr; |
| | | } |
| | | } |
| | | // { |
| | | // if (m_publishVideoRet) { |
| | | // if (videoPublishElement == nullptr) { |
| | | // string path = appConfig.getStringProperty("srsAddr") + "cam" + m_chanPubID + ".flv"; |
| | | // cv::Size size_(appConfig.getIntProperty("pulish.width"), appConfig.getIntProperty("pulish.height")); |
| | | // int gupIdx = appPref.getIntData("gpu.index"); |
| | | // DBG("videoPublishpath:" << path << " h:" << size_.height << " w:" << size_.width); |
| | | // videoPublishElement = new ffmpeg::VideoPublishElement(path, size_, "flv", 25, gupIdx); |
| | | // videoPublishElement->start(); |
| | | // } else { |
| | | // if (!m_image.empty()) { |
| | | // videoPublishElement->setImage(m_image); |
| | | // } else { |
| | | // ERR("m_image.empty()"); |
| | | // } |
| | | // } |
| | | // } else { |
| | | // if (videoPublishElement != nullptr) { |
| | | // DBG("videoPublishElement->stop()"); |
| | | // videoPublishElement->stop(); |
| | | // videoPublishElement->wait(); |
| | | // delete videoPublishElement; |
| | | // videoPublishElement = nullptr; |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | fireConnectors(); |
| | | } |