bakaid commented on a change in pull request #612: MINIFICPP-854: Capture RTSP 
Frame
URL: https://github.com/apache/nifi-minifi-cpp/pull/612#discussion_r304338948
 
 

 ##########
 File path: extensions/opencv/CaptureRTSPFrame.cpp
 ##########
 @@ -73,6 +73,11 @@ void CaptureRTSPFrame::initialize() {
   relationships.insert(Success);
   relationships.insert(Failure);
   setSupportedRelationships(std::move(relationships));
+  // By default in OpenCV, ffmpeg capture is hardcoded to use TCP and this is 
a workaround
+  // also if UDP timeout, ffmpeg will retry with TCP
+  // Note:
+  // 1. OpenCV community are trying to find a better approach than setenv.
+  setenv("OPENCV_FFMPEG_CAPTURE_OPTIONS", "rtsp_transport;udp", 1);
 
 Review comment:
   setenv is unfortunately not thread-safe. Not only setting the same 
environment variable from two threads is unsafe, but so is setting anything 
from two threads at once.
   That being said, I know no good solution to this other than a framework for 
the global synchronization of setenvs and getenvs, and even that does not 
account from potential setenvs/getenvs called by third parties.
   I don't think that there is a high probability of this causing issues, but 
if we see unexplainable crashes or issues around environment variables, then we 
should think of this as a cause.
   I would like this comment to be extended with this caveat.

----------------------------------------------------------------
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

Reply via email to