I\'ve written C++ wrapper for each Gstreamer types. They\'re simple and intuitive, so I don\'t think their implementation needs to be posted here (though I could post them (
Do you have queue elements on each branch that comes off the tee? One for the file and one for the decode? You could also try messing around with the "sync" property on the filesink. Maybe set it to true.
Edited by Nawaz.
Since this answer first gave me few directions and almost a very-near-to-the-solution direction, it deserves the bounty I've set for this question. But before that, here is the solution (explanation is in my answer - Nawaz).
gst::element filesink("filesink", "file-sink");
filesink.set("async", gboolean(FALSE));
Hope that helps other as well.
I found the answer myself. I tried to print the status of all the elements as:
void print_status_of_all()
{
auto it = gst_bin_iterate_elements(GST_BIN(_pipeline.raw()));
GValue value = G_VALUE_INIT;
for(GstIteratorResult r = gst_iterator_next(it, &value); r != GST_ITERATOR_DONE; r = gst_iterator_next(it, &value))
{
if ( r == GST_ITERATOR_OK )
{
GstElement *e = static_cast<GstElement*>(g_value_peek_pointer(&value));
GstState current, pending;
auto ret = gst_element_get_state(e, ¤t, &pending, 100000);
g_print("%s(%s), status = %s, pending = %s\n", G_VALUE_TYPE_NAME(&value), gst_element_get_name(e), gst_element_state_get_name(current), gst_element_state_get_name(pending));
}
}
}
And then it helped me figured out that the status of all the elements were changing from PLAYING to PAUSED and PAUSED to PLAYING, without any pending state, except filesink
element whose state remains at PLAYING and a pending PAUSED state (which is because it attempts to change it asynchronously) — that eventually led me to the async property of the GstBaseSink which is the base class of filesink
. I just set it to FALSE
as:
gst::element filesink("filesink", "file-sink");
filesink.set("async", gboolean(FALSE));
That's it. Now pause and resume works great — status of all the elements change to PLAYING to PAUSED and PAUSED to PLAYING, without any pending state!