[WORKAROUND INCLUDED] ofVideoGrabber freezes with gstreamer


if anybody is having the same issue of video input freezing after a few minutes of running (only video input, rest of the program runs normally), then perhaps this will help.

After testing different pipelines with gst-launch I found out that forcing the use of additional threads via the queue element helps. Once the right pipeline was found I used gstUtils directly to replace the ofVideoGrabber

ofGstUtils gst;  
gst.setPipeline("v4l2src ! video/x-raw-rgb,width="+ofToString(VIDEO_WIDTH)+  
                    ",height="+ofToString(VIDEO_HEIGHT)+" ! queue ! ffmpegcolorspace"  
                    , 24, false, VIDEO_WIDTH, VIDEO_HEIGHT);  
// ...  
// inside update  
if(gst.isFrameNew()) {  
    yourOwnOFImage.setFromPixels(gst.getPixels(), VIDEO_WIDTH, VIDEO_HEIGHT);  

I’m testing this on other machines currently and it seems that it might be related to hardware/64bit vs. 32bit/gstreamer version or something other equally mystical, as I can only reproduce it on my laptop running 64bit ubuntu 10.04 using the integrated webcam.