arpadboda commented on a change in pull request #612: MINIFICPP-854: Capture
RTSP Frame
URL: https://github.com/apache/nifi-minifi-cpp/pull/612#discussion_r303822479
##########
File path: extensions/opencv/CaptureRTSPFrame.cpp
##########
@@ -116,17 +118,27 @@ 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);
+ } catch (...) {
+ logger_->log_error("Unable to open RTSP stream: unhandled exception");
+ session->transfer(flow_file, Failure);
Review comment:
I think we should return in failure cases, capture would fail anyway.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services