trying to achieve playbin2 gapless transition

Tim-Philipp Müller t.i.m at zen.co.uk
Fri Jul 13 02:09:14 PDT 2012


On Thu, 2012-07-12 at 13:23 -0700, Captian Ham wrote:

> To get acquainted with gstreamer I'm writing (what I would assume to be) a
> very simple program to play a succession of media files (pictures and
> videos); when I transition between files I'd like the frame of the last file
> to freeze in place until the next file starts playing. I'm using playbin2
> with an xvimagesink linked to a gtk window to display the output. My
> understanding of the process is to handle the transition like this:
> 
> gst_element_set_locked_state( xvimagesink_, TRUE );
> gst_element_set_state( playbin2_, GST_STATE_READY );
> g_object_set( G_OBJECT( playbin2_ ), "uri", newfile_.c_str(), NULL );
> gst_element_set_state( playbin2_, GST_STATE_PLAYING );
> gst_element_set_locked_state( xvimagesink_, FALSE );
> 
> (snip backtrace)
> No deadlock occurs if I don't lock xvimagesink first. I'd appreciate some
> guidance on; why locking a child element might cause a state change to a
> parent to fail? Why does locking in this way produce a volatile outcome that
> fails every now and then? Is this the most sensible approach to simple
> "gapless" transition between media with using a playbin2 pipeline.

Have you tried using the "about-to-finish" signal and just setting the
next URI to play from there? Then you shouldn't have to lock the
videosink or even change playbin's state. It should pre-load the next
file so it's ready to play immediately after the previous one finishes.
(Having said that, there's bug #673305, so I don't know if there major
issues with that or not).

 Cheers
  -Tim



More information about the gstreamer-devel mailing list