The problem about gst_element_set_state.
Tim-Philipp Müller
t.i.m at zen.co.uk
Sat Jan 7 04:12:09 PST 2012
On Wed, 2011-12-28 at 01:29 -0800, forestzhu wrote:
> Sometimes the program will crash
> when I use the " gst_element_set_state" to set the pipeline to NULL .
>
> my code likes below:
>
> if (player->pipeline)
> {
> while(GST_STATE_CHANGE_FAILURE == gst_element_set_state (player->pipeline,
> GST_STATE_NULL))
> DEBUG_LOG("fail to change pipeline state...");
> DEBUG_LOG("after set state");
> sleep(1);
>
> g_object_unref (player->pipeline);
> player->pipeline = NULL;
> }
Why the while loop? Just do a single _set_state (pipeline,
GST_STATE_NULL). If that fails (*extremely* unlikely), it will most
likely also fail the next time. I wouldn't bother checking the return
value of a downward _set_state() to GST_STATE_NULL. It will not be
async, and you can just assume it worked. (If it didn't work for some
reason, there's not much else you can do anyway).
Cheers
-Tim
> I confirmed before set_state the player->pipeline 's mem_address is correct
> .
> And the "DEBUG_LOG("fail to change pipeline state...");" and
> "DEBUG_LOG("after set state");" will not run.
>
> Anyone can give me some informations?
>
> Thanks for any hint!
>
> Regards!
>
>
> forest
>
>
>
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/The-problem-about-gst-element-set-state-tp4239421p4239421.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
More information about the gstreamer-devel
mailing list