The problem about gst_element_set_state.

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

The problem about gst_element_set_state.

forestzhu
Hi all,
I met trouble in gsteamer program.
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)
        {
            DEBUG_LOG("pipeline=>%p ...",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;
        }

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


Reply | Threaded
Open this post in threaded view
|

Re:The problem about gst_element_set_state.

hcpwll
I think the code maybe looks like,

     GstStateChangeReturn ret_get_state;
     GstState state;
       if (player->pipeline)
        {
gst_element_set_state (player->pipeline, GST_STATE_NULL);
while (ret_get_state = gst_element_get_state(bin, &state, NULL, 1
* GST_SECOND) != GST_STATE_CHANGE_FAILURE)
{
if ( GST_STATE_NULL == state)
{
break;
}
}

            g_object_unref (player->pipeline);
            player->pipeline = NULL;
     ;    }
At 2011-12-28 17:29:24,forestzhu <[hidden email]> wrote: >Hi all, >I met trouble in gsteamer program. >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) >        { >            DEBUG_LOG("pipeline=>%p ...",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; >        } > >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 >[hidden email] >http://lists.freedesktop.org/mailman/listinfo/gstreamer-dev



_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Re:The problem about gst_element_set_state.

forestzhu
Hi hcpwll,

Nice to see your reply.
I have tried your code.
Unfortunately ,it seems useless.
The program crashed before the "gst_element_set_state" like my code.

Regards,
forest
Reply | Threaded
Open this post in threaded view
|

Re:The problem about gst_element_set_state.

hcpwll
I think, You need to check state_change, finalize and dispose function.

At 2011-12-29 10:23:13,forestzhu <[hidden email]> wrote:

>Hi hcpwll,
>
>Nice to see your reply.
>I have tried your code.
>Unfortunately ,it seems useless.
>The program crashed before the "gst_element_set_state" like my code.
>
>Regards,
>forest
>
>
>--
>View this message in context: http://gstreamer-devel.966125.n4.nabble.com/The-problem-about-gst-element-set-state-tp4239421p4241574.html
>Sent from the GStreamer-devel mailing list archive at Nabble.com.
>_______________________________________________
>gstreamer-devel mailing list
>[hidden email]
>http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: The problem about gst_element_set_state.

Stefan Sauer
In reply to this post by forestzhu
On 12/28/2011 10:29 AM, forestzhu wrote:

> Hi all,
> I met trouble in gsteamer program.
> 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)
>         {
>             DEBUG_LOG("pipeline=>%p ...",player->pipeline);
> while(GST_STATE_CHANGE_FAILURE == gst_element_set_state (player->pipeline,
> GST_STATE_NULL))
>             DEBUG_LOG("fail to change pipeline state...");
there is no need to do this in a while loop. If it failed once, it will
fail again and agin as you don't do anything to make it work again.

Stefan

> DEBUG_LOG("after set state");
>             sleep(1);
>
>             g_object_unref (player->pipeline);
>             player->pipeline = NULL;
>         }
>
> 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
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: The problem about gst_element_set_state.

forestzhu
Hi Stefan ,
Nice to see you again!
Can you give some information for this issue?
My program crashed about every 4 hours.
Maybe this problem does not reappear with very high frequency ,
but it is very troublesome.

Eager for your reply!

Regards !
forrest
 
Reply | Threaded
Open this post in threaded view
|

Re: The problem about gst_element_set_state.

Stefan Sauer
On 01/06/2012 04:12 AM, forestzhu wrote:
> Hi Stefan ,
> Nice to see you again!
> Can you give some information for this issue?
> My program crashed about every 4 hours.
run the programm with G_DEBUG="fatal_warnings" gdb ./my-prog
when t crashed check with the "bt" command where it crashed. If this is
in gstreamer code, file a bug and include the backtrace info.

Stefan

> Maybe this problem does not reappear with very high frequency ,
> but it is very troublesome.
>
> Eager for your reply!
>
> Regards !
> forrest
>  
>
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/The-problem-about-gst-element-set-state-tp4239421p4268088.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: The problem about gst_element_set_state.

Tim-Philipp Müller-2
In reply to this post by forestzhu
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
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel