ofVideoPlayer > GStreamer-CRITICAL **: gst_mini_object_unref: assertion

of v0.8, Ubuntu 12.04, gstreamer 0.1

I have ofVideoPlayer instances that create critical GStreamer unref errors on two occasions. The errors don’t crash my program, but cause small hickups in the processing.

The error >>

GStreamer-CRITICAL **: gst_mini_object_unref: assertion `GST_IS_MINI_OBJECT (mini_object)’ failed

It comes up when loading a new video into a ofVideoPlayer instance, that already had a previous movie. Both movies (the first, and the second) play and display fine, just when i call the loadMovie() function for the second movie, the error pops up.

  videoElement::videoElement(string filename) {
    movie = ofPtr<ofVideoPlayer>( new ofVideoPlayer() );
    this->loadMovie(filename);
}

void videoElement::loadMovie(string filename) {
    movie->loadMovie(filename);            /////// GStreamer-CRITICAL ERROR on 2nd call
}

Then i added movie->stop(), movie->close(), and reinitialization of the movie ofPtr, to trace better at what location the error happens. And turns out it happens when calling movie->close();

void videoElement::loadMovie(string filename) {
    movie->stop();
    movie->close();                         /////// GStreamer-CRITICAL ERROR on 2nd call
    movie = ofPtr<ofVideoPlayer>();
    movie = ofPtr<ofVideoPlayer>( new ofVideoPlayer() );
    movie->loadMovie(filename);
}

I get the same error when erasing the parent instance that includes the ofVideoPlayer instance.

Any chance someone has encountered this error before?

Yes i know where this comes from but the solution is kind of complex, since it involves waiting for the gstreamer pipeline to close properly which can take up to a second while which the application would freeze unless the closing is done in a background thread so since the application doesn’t crash i’ve found it better to have a couple of glitches than really long freezes by now.

Also if by hicups you mean visual glitches in the video it’s probably because textures are not initialized when they are created. Usually you load an play the video in setup, update it and draw it but when reloading it you are probably not updating it again before drawing so the texture has noise in it. If you call update on the video after loading it again and before drawing the glitches should mostly go away.

I would also update to gstreamer 1.0 which is more robust and it’s the version being actively mantained in OF so it will have less bugs, you can install it in 12.04 with a ppa: http://askubuntu.com/questions/279509/how-can-i-install-gstreamer-1-0-in-ubuntu-12-04

Ok. Thanks for the info and tips!

I think i’ll try to build my video-object handling so that i avoid reloading and erasing. It feels too late in the project timeline to switch to gstreamer 1.0, but i definitely will do so next time around.