iOS: pausing video streaming pipeline before dispose graphical context

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

iOS: pausing video streaming pipeline before dispose graphical context

elio.francesconi
Hi all,
I'm facing a crash with my iOS application. It seems the pipeline tries to draw video when graphical context is already disposed and the application crashes.
I solved executing in applicationWillResignActive (immediately before the graphical context is destroyed gst_element_set_state (pPipeline, GST_STATE_PAUSED);
This is the pseudocode:

- (void)applicationWillResignActive:(UIApplication *)application {
gst_element_set_state (pPipeline, GST_STATE_PAUSED);
}

It is not the best solution to solve the issue because sometimes my pipeline hangs pausing and the iOS application crashes due to WATCHDOG in the main thread..

How can I solve this issue?

Is there a best way to stop immediately the pipeline?

Thanks
Elio

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

Re: iOS: pausing video streaming pipeline before dispose graphical context

Sebastian Dröge-3
On Sa, 2016-03-05 at 18:24 +0100, elio francesconi wrote:

> Hi all,
> I'm facing a crash with my iOS application. It seems the pipeline
> tries to draw video when graphical context is already disposed and
> the application crashes.
> I solved executing in applicationWillResignActive (immediately before
> the graphical context is destroyed gst_element_set_state (pPipeline,
> GST_STATE_PAUSED);
> This is the pseudocode:
> - (void)applicationWillResignActive:(UIApplication *)application {
> gst_element_set_state (pPipeline, GST_STATE_PAUSED);
> }
> It is not the best solution to solve the issue because sometimes my
> pipeline hangs pausing and the iOS application crashes due to
> WATCHDOG in the main thread..
>
> How can I solve this issue?
>
> Is there a best way to stop immediately the pipeline?
Setting it to NULL state. If that hangs, you found a bug and should
report that. It should never ever hang :)

Setting the pipeline to NULL state also generally seems the right thing
to do when the application shuts down (I assume that's what "will
resign active" means?). Independent of that there are also similar
problems if the application goes into the background, suspend, etc.
These things need to be handled currently in the application to prevent
crashes and it's not clear yet how we should handle that from GStreamer
as AFAIU you need to install application callbacks to get notified
about these things.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com

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

signature.asc (968 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: iOS: pausing video streaming pipeline before dispose graphical context

elio.francesconi
Ok, I replaced PAUSED with NULL I hope to solve the issue. Thanks!

Yes I was referring to problems when the application goes in background, suspend, etc... and according with Apple documentation:
applicationWillResignActive:  is called  when leaving the foreground state(before the application is suspended.. ),
Usually the right callback to use is applicationDidEnterBackground (Tells the delegate that the app is now in the background.) , but IMHO it's too late because the EGLContext is already disposed and it's too late to stop the pipeline. 
So I'm using the callback applicationWillResignActive: where the EGLContext is still valid.
What do you think?
Elio

2016-03-06 9:05 GMT+01:00 Sebastian Dröge <[hidden email]>:
On Sa, 2016-03-05 at 18:24 +0100, elio francesconi wrote:
> Hi all,
> I'm facing a crash with my iOS application. It seems the pipeline
> tries to draw video when graphical context is already disposed and
> the application crashes.
> I solved executing in applicationWillResignActive (immediately before
> the graphical context is destroyed gst_element_set_state (pPipeline,
> GST_STATE_PAUSED);
> This is the pseudocode:
> - (void)applicationWillResignActive:(UIApplication *)application {
> gst_element_set_state (pPipeline, GST_STATE_PAUSED);
> }
> It is not the best solution to solve the issue because sometimes my
> pipeline hangs pausing and the iOS application crashes due to
> WATCHDOG in the main thread..
>
> How can I solve this issue?
>
> Is there a best way to stop immediately the pipeline?

Setting it to NULL state. If that hangs, you found a bug and should
report that. It should never ever hang :)

Setting the pipeline to NULL state also generally seems the right thing
to do when the application shuts down (I assume that's what "will
resign active" means?). Independent of that there are also similar
problems if the application goes into the background, suspend, etc.
These things need to be handled currently in the application to prevent
crashes and it's not clear yet how we should handle that from GStreamer
as AFAIU you need to install application callbacks to get notified
about these things.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com

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



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