You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2019/07/17 13:21:35 UTC
[GitHub] [nifi-minifi-cpp] phrocker commented on a change in pull request
#612: MINIFICPP-854: Capture RTSP Frame
phrocker commented on a change in pull request #612: MINIFICPP-854: Capture RTSP Frame
URL: https://github.com/apache/nifi-minifi-cpp/pull/612#discussion_r304396759
##########
File path: extensions/opencv/CaptureRTSPFrame.cpp
##########
@@ -116,17 +121,28 @@ void CaptureRTSPFrame::onSchedule(core::ProcessContext *context, core::ProcessSe
rtspURI.append(rtsp_uri_);
}
- cv::VideoCapture capture(rtspURI.c_str());
- video_capture_ = capture;
- video_backend_driver_ = video_capture_.getBackendName();
+ rtsp_url_ = rtspURI;
+
}
void CaptureRTSPFrame::onTrigger(const std::shared_ptr<core::ProcessContext> &context,
const std::shared_ptr<core::ProcessSession> &session) {
auto flow_file = session->create();
- cv::Mat frame;
+ try {
+ video_capture_.open(rtsp_url_);
+ video_backend_driver_ = video_capture_.getBackendName();
+ } catch (const cv::Exception &e) {
+ logger_->log_error("Unable to open RTSP stream: %s", e.what());
+ session->transfer(flow_file, Failure);
Review comment:
This creates an empty FF, so that means if we can't open the URL we could potentially create many flow files that are empty. The typical approach is to yield in the context. You can still create a failure flow file ( though I would suggest exploring if this is the correct route ), but you should probably yield here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services