diff --git a/libs/openFrameworks/video/ofGstUtils.cpp b/libs/openFrameworks/video/ofGstUtils.cpp index 4ab125d692f..c7dd974e8ac 100644 --- a/libs/openFrameworks/video/ofGstUtils.cpp +++ b/libs/openFrameworks/video/ofGstUtils.cpp @@ -507,6 +507,12 @@ void ofGstUtils::setLoopState(ofLoopType state){ void ofGstUtils::setSpeed(float _speed){ if(_speed == speed) return; + if (updated_in_frame) { + ofLogVerbose("ofGstUtils") << "setSpeed(): prevented multiple changes within a frame"; + return; + } + updated_in_frame = true; + GstFormat format = GST_FORMAT_TIME; GstSeekFlags flags = (GstSeekFlags) (GST_SEEK_FLAG_ACCURATE | GST_SEEK_FLAG_FLUSH); @@ -910,6 +916,7 @@ ofTexture * ofGstVideoUtils::getTexture(){ void ofGstVideoUtils::update(){ if (isLoaded()){ + updated_in_frame = false; if(!isFrameByFrame()){ std::unique_lock lock(mutex); bHavePixelsChanged = bBackPixelsChanged; diff --git a/libs/openFrameworks/video/ofGstUtils.h b/libs/openFrameworks/video/ofGstUtils.h index f01347a64fe..0e751f0e81e 100644 --- a/libs/openFrameworks/video/ofGstUtils.h +++ b/libs/openFrameworks/video/ofGstUtils.h @@ -73,6 +73,8 @@ class ofGstUtils{ void setSinkListener(ofGstAppSink * appsink); + bool updated_in_frame { false }; + // callbacks to get called from gstreamer #if GST_VERSION_MAJOR==0 virtual GstFlowReturn preroll_cb(std::shared_ptr buffer); @@ -112,6 +114,7 @@ class ofGstUtils{ std::mutex eosMutex; guint busWatchID; + class ofGstMainLoopThread: public ofThread{ public: ofGstMainLoopThread()