arturoc / ofxGStreamer

openFrameworks addon to use gstreamer under osx and windows. This addon has no code and instead uses the addon_config.mk file to add the needed files from the core + the flags needed to compile using gstreamer
56 stars 28 forks source link

gst_element_get_state freezes the app #26

Closed Hperigo closed 5 years ago

Hperigo commented 5 years ago

Hi, I'm currently working on a large installation that has to load and play multiple 4k videos along the day. So far ofxGStreamer was the best player that we tested.

But, when closing the video player the hole app freezes for a bit. As you can see on this graph: image

the solution I found was to set all the gst_element_get_state inside pause, close timeout to 0 (it's originally 2*GST_SECOND ).

Now, I'm not sure if this is the best way to solve this issue or if it can have any unwanted behaviour as I'm not very familiar with gstreamer. Would be great to have your opinion on this.

As a side note, looks like cinder set's the timeout to 0 ( https://github.com/cinder/Cinder/blob/58be82d140bc2f6be723a0177d4cb001a43a3bac/src/cinder/linux/GstPlayer.cpp#L1045 )

arturoc commented 5 years ago

Not sure about the possible consequences of this, i would look out for memory leaks, if you try it and closing videos repeatedly doesn't seem to cause memory leaks please send a pull request.

Be aware that this addon doesn't really contain the code for the gstreamer utils, it's just a config wrapper for the gstreamer code that it's actually in the core so you would need to send the PR there.

Hperigo commented 5 years ago

thanks for the reply / comments!