Why calling methods on gstreamer sometimes is blocking forever ?

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

Why calling methods on gstreamer sometimes is blocking forever ?

Nicolas Castillejos

Hello,


I met problems using Gstreamer with Java, when I want to stop the pipeline, sometimes the call to pipe.stop() is blocking for ever. I've tryed others calls like setState() and it is blocking forever too.
I think there is informations I don't know about gstreamer mechanisms.
Could you explain how it works internally, why is it blocking ?
For information I use Appsrc to feed the pipeline with HLS stream. I use Gstreamer 1.6.4 and gst1-java-core mapping.

Cordially,

Nicolas Castillejos

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

Re: Why calling methods on gstreamer sometimes is blocking forever ?

Nicolas Dufresne-4
Le vendredi 09 décembre 2016 à 17:29 +0100, Nicolas Castillejos a
écrit :
> I met problems using Gstreamer with Java, when I want to stop the
> pipeline, sometimes the call to pipe.stop() is blocking for ever.
> I've tryed others calls like setState() and it is blocking forever
> too.
> I think there is informations I don't know about gstreamer
> mechanisms.
> Could you explain how it works internally, why is it blocking ?
> For information I use Appsrc to feed the pipeline with HLS stream. I
> use Gstreamer 1.6.4 and gst1-java-core mapping.

This should not happen. This indicate that you have reached a deadlock
situation, hence a software bug. You didn't provide enough information
to distinguish between GStreamer/JavaBinding/YouApp as the cause.

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

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

Re: Why calling methods on gstreamer sometimes is blocking forever ?

Krutskikh Ivan
I faced the same behavior when using gstreamer with python in multi threaded solution. Solved it using multiple processes.

2016-12-10 2:04 GMT+03:00 Nicolas Dufresne <[hidden email]>:
Le vendredi 09 décembre 2016 à 17:29 +0100, Nicolas Castillejos a
écrit :
> I met problems using Gstreamer with Java, when I want to stop the
> pipeline, sometimes the call to pipe.stop() is blocking for ever.
> I've tryed others calls like setState() and it is blocking forever
> too.
> I think there is informations I don't know about gstreamer
> mechanisms.
> Could you explain how it works internally, why is it blocking ?
> For information I use Appsrc to feed the pipeline with HLS stream. I
> use Gstreamer 1.6.4 and gst1-java-core mapping.

This should not happen. This indicate that you have reached a deadlock
situation, hence a software bug. You didn't provide enough information
to distinguish between GStreamer/JavaBinding/YouApp as the cause.

Nicolas

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Why calling methods on gstreamer sometimes is blocking forever ?

Nicolas Castillejos
In reply to this post by Nicolas Castillejos
Hello,

Thank you for your answers, I put my java code in attachment .
I don't really think it comes from my application.
As you can see, my code is really simple. I fill the appsrc with a byte
array. There is no possible deadlock I can see.
I understand the multi-process solution, but it is a pain to do this as
I have to display video pictures in my java application.
Do you think it can be a problem with the java mapping ? it is not the
first time I met problems with it so....

Nicolas Castillejos



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

HLSMosaicPlayer.java (14K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Why calling methods on gstreamer sometimes is blocking forever ?

Krutskikh Ivan
Btw, another issue that I had huge problems with is using gobject.mainloop for managing bus messaging bus.pop_timed_filtered works way better when working with 20+ gstreamer pipelines

2016-12-12 12:47 GMT+03:00 Nicolas Castillejos <[hidden email]>:
Hello,

Thank you for your answers, I put my java code in attachment .
I don't really think it comes from my application.
As you can see, my code is really simple. I fill the appsrc with a byte array. There is no possible deadlock I can see.
I understand the multi-process solution, but it is a pain to do this as I have to display video pictures in my java application.
Do you think it can be a problem with the java mapping ? it is not the first time I met problems with it so....

Nicolas Castillejos



_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Why calling methods on gstreamer sometimes is blocking forever ?

Nicolas Castillejos
In reply to this post by Nicolas Castillejos

I've found more informations :
It only hangs when the return of the stop() method (setState(NULL)) is ASYNC !
When it is success it doesn't hangs .
How does it works when it is async ?
where can I define a method/listener/handler to receive async results ?

You can see here the gstreamer "GST_STATES"  logs, you can see that it finishes by 

0:00:11.890189502  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<source> final: setting state from PLAYING to PAUSED

0:00:11.905778577  8208   15E4AAE0 DEBUG             GST_STATES gstelement.c:2020:gst_element_get_state_func:<source> getting state, timeout 99:99:99.999999999

0:00:11.905801989  8208   15E4AAE0 DEBUG             GST_STATES gstelement.c:2025:gst_element_get_state_func:<source> RETURN is ASYNC

0:00:11.905814176  8208   15E4AAE0 INFO              GST_STATES gstelement.c:2048:gst_element_get_state_func:<source> waiting for element to commit state


It seems that is it waiting for ever (timeout 99:99:99.999999999) an element state change but it nevers happends why ?

Here are full logs starting from the call of stop() method on pipeline object :

0:00:11.888218377  8208   224AE280 DEBUG             GST_STATES gstelement.c:2481:gst_element_set_state_func:<main pipeline> set_state to NULL

0:00:11.888247883  8208   224AE280 DEBUG             GST_STATES gstelement.c:2506:gst_element_set_state_func:<main pipeline> setting target state to NULL

0:00:11.888261353  8208   224AE280 DEBUG             GST_STATES gstelement.c:2519:gst_element_set_state_func:<main pipeline> current PLAYING, old_pending VOID_PENDING, next VOID_PENDING, old return SUCCESS

0:00:11.888279955  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<main pipeline> intermediate: setting state from PLAYING to PAUSED

0:00:11.888302084  8208   224AE280 DEBUG             GST_STATES gstbin.c:2591:gst_bin_change_state_func:<main pipeline> changing state of children from PLAYING to PAUSED

0:00:11.888395092  8208   224AE280 INFO              GST_STATES gstbin.c:2243:gst_bin_element_set_state:<Video Bin> current PLAYING pending VOID_PENDING, desired next PAUSED

0:00:11.888413694  8208   224AE280 DEBUG             GST_STATES gstelement.c:2481:gst_element_set_state_func:<Video Bin> set_state to PAUSED

0:00:11.888425560  8208   224AE280 DEBUG             GST_STATES gstelement.c:2506:gst_element_set_state_func:<Video Bin> setting target state to PAUSED

0:00:11.888441917  8208   224AE280 DEBUG             GST_STATES gstelement.c:2519:gst_element_set_state_func:<Video Bin> current PLAYING, old_pending VOID_PENDING, next VOID_PENDING, old return SUCCESS

0:00:11.888463084  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<Video Bin> final: setting state from PLAYING to PAUSED

0:00:11.888478479  8208   224AE280 DEBUG             GST_STATES gstbin.c:2591:gst_bin_change_state_func:<Video Bin> changing state of children from PLAYING to PAUSED

0:00:11.888503815  8208   224AE280 INFO              GST_STATES gstbin.c:2243:gst_bin_element_set_state:<GstVideoComponent> current PLAYING pending VOID_PENDING, desired next PAUSED

0:00:11.888517285  8208   224AE280 DEBUG             GST_STATES gstelement.c:2481:gst_element_set_state_func:<GstVideoComponent> set_state to PAUSED

0:00:11.888527869  8208   224AE280 DEBUG             GST_STATES gstelement.c:2506:gst_element_set_state_func:<GstVideoComponent> setting target state to PAUSED

0:00:11.888570204  8208   224AE280 DEBUG             GST_STATES gstelement.c:2519:gst_element_set_state_func:<GstVideoComponent> current PLAYING, old_pending VOID_PENDING, next VOID_PENDING, old return SUCCESS

0:00:11.888584636  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<GstVideoComponent> final: setting state from PLAYING to PAUSED

0:00:11.888607407  8208   224AE280 DEBUG             GST_STATES gstbin.c:3124:bin_handle_async_start:<Video Bin> state change busy

0:00:11.888622160  8208   224AE280 DEBUG             GST_STATES gstelement.c:2620:gst_element_change_state:<GstVideoComponent> element will change state ASYNC

0:00:11.888635951  8208   224AE280 DEBUG             GST_STATES gstelement.c:2565:gst_element_set_state_func:<GstVideoComponent> returned ASYNC

0:00:11.888650062  8208   224AE280 INFO              GST_STATES gstbin.c:2713:gst_bin_change_state_func:<Video Bin> child 'GstVideoComponent' is changing state asynchronously to PAUSED

0:00:11.888668022  8208   224AE280 INFO              GST_STATES gstbin.c:2243:gst_bin_element_set_state:<capsfilter> current PLAYING pending VOID_PENDING, desired next PAUSED

0:00:11.888681492  8208   224AE280 DEBUG             GST_STATES gstelement.c:2481:gst_element_set_state_func:<capsfilter> set_state to PAUSED

0:00:11.888695283  8208   224AE280 DEBUG             GST_STATES gstelement.c:2506:gst_element_set_state_func:<capsfilter> setting target state to PAUSED

0:00:11.888709074  8208   224AE280 DEBUG             GST_STATES gstelement.c:2519:gst_element_set_state_func:<capsfilter> current PLAYING, old_pending VOID_PENDING, next VOID_PENDING, old return SUCCESS

0:00:11.888723185  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<capsfilter> final: setting state from PLAYING to PAUSED

0:00:11.888738259  8208   224AE280 DEBUG             GST_STATES gstelement.c:2638:gst_element_change_state:<capsfilter> element changed state SUCCESS

0:00:11.888753012  8208   224AE280 INFO              GST_STATES gstelement.c:2330:gst_element_continue_state:<capsfilter> completed state change to PAUSED

0:00:11.888768086  8208   224AE280 INFO              GST_STATES gstelement.c:2235:_priv_gst_element_state_changed:<capsfilter> notifying about state-changed PLAYING to PAUSED (VOID_PENDING pending)

0:00:11.888987456  8208   224AE280 DEBUG             GST_STATES gstelement.c:2565:gst_element_set_state_func:<capsfilter> returned SUCCESS

0:00:11.889003813  8208   224AE280 INFO              GST_STATES gstbin.c:2707:gst_bin_change_state_func:<Video Bin> child 'capsfilter' changed state to 3(PAUSED) successfully

0:00:11.889020169  8208   224AE280 INFO              GST_STATES gstbin.c:2243:gst_bin_element_set_state:<videoconvert> current PLAYING pending VOID_PENDING, desired next PAUSED

0:00:11.889036846  8208   224AE280 DEBUG             GST_STATES gstelement.c:2481:gst_element_set_state_func:<videoconvert> set_state to PAUSED

0:00:11.889049675  8208   224AE280 DEBUG             GST_STATES gstelement.c:2506:gst_element_set_state_func:<videoconvert> setting target state to PAUSED

0:00:11.889063145  8208   224AE280 DEBUG             GST_STATES gstelement.c:2519:gst_element_set_state_func:<videoconvert> current PLAYING, old_pending VOID_PENDING, next VOID_PENDING, old return SUCCESS

0:00:11.889077898  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<videoconvert> final: setting state from PLAYING to PAUSED

0:00:11.889097783  8208   224AE280 DEBUG             GST_STATES gstelement.c:2638:gst_element_change_state:<videoconvert> element changed state SUCCESS

0:00:11.889109970  8208   224AE280 INFO              GST_STATES gstelement.c:2330:gst_element_continue_state:<videoconvert> completed state change to PAUSED

0:00:11.889122478  8208   224AE280 INFO              GST_STATES gstelement.c:2235:_priv_gst_element_state_changed:<videoconvert> notifying about state-changed PLAYING to PAUSED (VOID_PENDING pending)

0:00:11.889230880  8208   224AE280 DEBUG             GST_STATES gstelement.c:2565:gst_element_set_state_func:<videoconvert> returned SUCCESS

0:00:11.889245954  8208   224AE280 INFO              GST_STATES gstbin.c:2707:gst_bin_change_state_func:<Video Bin> child 'videoconvert' changed state to 3(PAUSED) successfully

0:00:11.889261027  8208   224AE280 INFO              GST_STATES gstbin.c:2243:gst_bin_element_set_state:<H264 Decoder> current PLAYING pending VOID_PENDING, desired next PAUSED

0:00:11.889273856  8208   224AE280 DEBUG             GST_STATES gstelement.c:2481:gst_element_set_state_func:<H264 Decoder> set_state to PAUSED

0:00:11.889289571  8208   224AE280 DEBUG             GST_STATES gstelement.c:2506:gst_element_set_state_func:<H264 Decoder> setting target state to PAUSED

0:00:11.889302400  8208   224AE280 DEBUG             GST_STATES gstelement.c:2519:gst_element_set_state_func:<H264 Decoder> current PLAYING, old_pending VOID_PENDING, next VOID_PENDING, old return SUCCESS

0:00:11.889320039  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<H264 Decoder> final: setting state from PLAYING to PAUSED

0:00:11.889334471  8208   224AE280 DEBUG             GST_STATES gstelement.c:2638:gst_element_change_state:<H264 Decoder> element changed state SUCCESS

0:00:11.889346659  8208   224AE280 INFO              GST_STATES gstelement.c:2330:gst_element_continue_state:<H264 Decoder> completed state change to PAUSED

0:00:11.889359487  8208   224AE280 INFO              GST_STATES gstelement.c:2235:_priv_gst_element_state_changed:<H264 Decoder> notifying about state-changed PLAYING to PAUSED (VOID_PENDING pending)

0:00:11.889468852  8208   224AE280 DEBUG             GST_STATES gstelement.c:2565:gst_element_set_state_func:<H264 Decoder> returned SUCCESS

0:00:11.889483605  8208   224AE280 INFO              GST_STATES gstbin.c:2707:gst_bin_change_state_func:<Video Bin> child 'H264 Decoder' changed state to 3(PAUSED) successfully

0:00:11.889497716  8208   224AE280 INFO              GST_STATES gstbin.c:2243:gst_bin_element_set_state:<h264parse> current PLAYING pending VOID_PENDING, desired next PAUSED

0:00:11.889514393  8208   224AE280 DEBUG             GST_STATES gstelement.c:2481:gst_element_set_state_func:<h264parse> set_state to PAUSED

0:00:11.889526581  8208   224AE280 DEBUG             GST_STATES gstelement.c:2506:gst_element_set_state_func:<h264parse> setting target state to PAUSED

0:00:11.889540372  8208   224AE280 DEBUG             GST_STATES gstelement.c:2519:gst_element_set_state_func:<h264parse> current PLAYING, old_pending VOID_PENDING, next VOID_PENDING, old return SUCCESS

0:00:11.889553842  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<h264parse> final: setting state from PLAYING to PAUSED

0:00:11.889566991  8208   224AE280 DEBUG             GST_STATES gstelement.c:2638:gst_element_change_state:<h264parse> element changed state SUCCESS

0:00:11.889579178  8208   224AE280 INFO              GST_STATES gstelement.c:2330:gst_element_continue_state:<h264parse> completed state change to PAUSED

0:00:11.889594252  8208   224AE280 INFO              GST_STATES gstelement.c:2235:_priv_gst_element_state_changed:<h264parse> notifying about state-changed PLAYING to PAUSED (VOID_PENDING pending)

0:00:11.889692391  8208   224AE280 DEBUG             GST_STATES gstelement.c:2565:gst_element_set_state_func:<h264parse> returned SUCCESS

0:00:11.889707144  8208   224AE280 INFO              GST_STATES gstbin.c:2707:gst_bin_change_state_func:<Video Bin> child 'h264parse' changed state to 3(PAUSED) successfully

0:00:11.889719652  8208   224AE280 DEBUG             GST_STATES gstbin.c:2766:gst_bin_change_state_func:<Video Bin> iterator done

0:00:11.889729594  8208   224AE280 DEBUG             GST_STATES gstbin.c:2784:gst_bin_change_state_func:<Video Bin> we have ASYNC elements SUCCESS -> ASYNC

0:00:11.889741782  8208   224AE280 DEBUG             GST_STATES gstbin.c:2835:gst_bin_change_state_func:<Video Bin> done changing bin's state from PLAYING to PAUSED, now in PLAYING, ret ASYNC

0:00:11.889806887  8208   224AE280 DEBUG             GST_STATES gstelement.c:2620:gst_element_change_state:<Video Bin> element will change state ASYNC

0:00:11.889821640  8208   224AE280 DEBUG             GST_STATES gstelement.c:2565:gst_element_set_state_func:<Video Bin> returned ASYNC

0:00:11.889837997  8208   224AE280 INFO              GST_STATES gstbin.c:2713:gst_bin_change_state_func:<main pipeline> child 'Video Bin' is changing state asynchronously to PAUSED

0:00:11.889855636  8208   224AE280 INFO              GST_STATES gstbin.c:2243:gst_bin_element_set_state:<tsdemux> current PLAYING pending VOID_PENDING, desired next PAUSED

0:00:11.889870389  8208   224AE280 DEBUG             GST_STATES gstelement.c:2481:gst_element_set_state_func:<tsdemux> set_state to PAUSED

0:00:11.889882576  8208   224AE280 DEBUG             GST_STATES gstelement.c:2506:gst_element_set_state_func:<tsdemux> setting target state to PAUSED

0:00:11.889895405  8208   224AE280 DEBUG             GST_STATES gstelement.c:2519:gst_element_set_state_func:<tsdemux> current PLAYING, old_pending VOID_PENDING, next VOID_PENDING, old return SUCCESS

0:00:11.889908875  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<tsdemux> final: setting state from PLAYING to PAUSED

0:00:11.889920741  8208   224AE280 DEBUG             GST_STATES gstelement.c:2638:gst_element_change_state:<tsdemux> element changed state SUCCESS

0:00:11.889932287  8208   224AE280 INFO              GST_STATES gstelement.c:2330:gst_element_continue_state:<tsdemux> completed state change to PAUSED

0:00:11.889943192  8208   224AE280 INFO              GST_STATES gstelement.c:2235:_priv_gst_element_state_changed:<tsdemux> notifying about state-changed PLAYING to PAUSED (VOID_PENDING pending)

0:00:11.890091042  8208   224AE280 DEBUG             GST_STATES gstelement.c:2565:gst_element_set_state_func:<tsdemux> returned SUCCESS

0:00:11.890107078  8208   224AE280 INFO              GST_STATES gstbin.c:2707:gst_bin_change_state_func:<main pipeline> child 'tsdemux' changed state to 3(PAUSED) successfully

0:00:11.890121189  8208   224AE280 INFO              GST_STATES gstbin.c:2243:gst_bin_element_set_state:<source> current PLAYING pending VOID_PENDING, desired next PAUSED

0:00:11.890133377  8208   224AE280 DEBUG             GST_STATES gstelement.c:2481:gst_element_set_state_func:<source> set_state to PAUSED

0:00:11.890143319  8208   224AE280 DEBUG             GST_STATES gstelement.c:2506:gst_element_set_state_func:<source> setting target state to PAUSED

0:00:11.890172183  8208   224AE280 DEBUG             GST_STATES gstelement.c:2519:gst_element_set_state_func:<source> current PLAYING, old_pending VOID_PENDING, next VOID_PENDING, old return SUCCESS

0:00:11.890189502  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<source> final: setting state from PLAYING to PAUSED

0:00:11.905778577  8208   15E4AAE0 DEBUG             GST_STATES gstelement.c:2020:gst_element_get_state_func:<source> getting state, timeout 99:99:99.999999999

0:00:11.905801989  8208   15E4AAE0 DEBUG             GST_STATES gstelement.c:2025:gst_element_get_state_func:<source> RETURN is ASYNC

0:00:11.905814176  8208   15E4AAE0 INFO              GST_STATES gstelement.c:2048:gst_element_get_state_func:<source> waiting for element to commit state






Le 12/12/2016 à 10:47, Nicolas Castillejos a écrit :
Hello,

Thank you for your answers, I put my java code in attachment .
I don't really think it comes from my application.
As you can see, my code is really simple. I fill the appsrc with a byte array. There is no possible deadlock I can see.
I understand the multi-process solution, but it is a pain to do this as I have to display video pictures in my java application.
Do you think it can be a problem with the java mapping ? it is not the first time I met problems with it so....

Nicolas Castillejos




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

Re: Why calling methods on gstreamer sometimes is blocking forever ?

Krutskikh Ivan
Oh yeah, this... Try inserting get_state with timeout after sending pipeline to NULL

2016-12-12 16:14 GMT+03:00 Nicolas Castillejos <[hidden email]>:

I've found more informations :
It only hangs when the return of the stop() method (setState(NULL)) is ASYNC !
When it is success it doesn't hangs .
How does it works when it is async ?
where can I define a method/listener/handler to receive async results ?

You can see here the gstreamer "GST_STATES"  logs, you can see that it finishes by 

0:00:11.890189502  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<source> final: setting state from PLAYING to PAUSED

0:00:11.905778577  8208   15E4AAE0 DEBUG             GST_STATES gstelement.c:2020:gst_element_get_state_func:<source> getting state, timeout 99:99:99.999999999

0:00:11.905801989  8208   15E4AAE0 DEBUG             GST_STATES gstelement.c:2025:gst_element_get_state_func:<source> RETURN is ASYNC

0:00:11.905814176  8208   15E4AAE0 INFO              GST_STATES gstelement.c:2048:gst_element_get_state_func:<source> waiting for element to commit state


It seems that is it waiting for ever (timeout 99:99:99.999999999) an element state change but it nevers happends why ?

Here are full logs starting from the call of stop() method on pipeline object :

0:00:11.888218377  8208   224AE280 DEBUG             GST_STATES gstelement.c:2481:gst_element_set_state_func:<main pipeline> set_state to NULL

0:00:11.888247883  8208   224AE280 DEBUG             GST_STATES gstelement.c:2506:gst_element_set_state_func:<main pipeline> setting target state to NULL

0:00:11.888261353  8208   224AE280 DEBUG             GST_STATES gstelement.c:2519:gst_element_set_state_func:<main pipeline> current PLAYING, old_pending VOID_PENDING, next VOID_PENDING, old return SUCCESS

0:00:11.888279955  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<main pipeline> intermediate: setting state from PLAYING to PAUSED

0:00:11.888302084  8208   224AE280 DEBUG             GST_STATES gstbin.c:2591:gst_bin_change_state_func:<main pipeline> changing state of children from PLAYING to PAUSED

0:00:11.888395092  8208   224AE280 INFO              GST_STATES gstbin.c:2243:gst_bin_element_set_state:<Video Bin> current PLAYING pending VOID_PENDING, desired next PAUSED

0:00:11.888413694  8208   224AE280 DEBUG             GST_STATES gstelement.c:2481:gst_element_set_state_func:<Video Bin> set_state to PAUSED

0:00:11.888425560  8208   224AE280 DEBUG             GST_STATES gstelement.c:2506:gst_element_set_state_func:<Video Bin> setting target state to PAUSED

0:00:11.888441917  8208   224AE280 DEBUG             GST_STATES gstelement.c:2519:gst_element_set_state_func:<Video Bin> current PLAYING, old_pending VOID_PENDING, next VOID_PENDING, old return SUCCESS

0:00:11.888463084  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<Video Bin> final: setting state from PLAYING to PAUSED

0:00:11.888478479  8208   224AE280 DEBUG             GST_STATES gstbin.c:2591:gst_bin_change_state_func:<Video Bin> changing state of children from PLAYING to PAUSED

0:00:11.888503815  8208   224AE280 INFO              GST_STATES gstbin.c:2243:gst_bin_element_set_state:<GstVideoComponent> current PLAYING pending VOID_PENDING, desired next PAUSED

0:00:11.888517285  8208   224AE280 DEBUG             GST_STATES gstelement.c:2481:gst_element_set_state_func:<GstVideoComponent> set_state to PAUSED

0:00:11.888527869  8208   224AE280 DEBUG             GST_STATES gstelement.c:2506:gst_element_set_state_func:<GstVideoComponent> setting target state to PAUSED

0:00:11.888570204  8208   224AE280 DEBUG             GST_STATES gstelement.c:2519:gst_element_set_state_func:<GstVideoComponent> current PLAYING, old_pending VOID_PENDING, next VOID_PENDING, old return SUCCESS

0:00:11.888584636  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<GstVideoComponent> final: setting state from PLAYING to PAUSED

0:00:11.888607407  8208   224AE280 DEBUG             GST_STATES gstbin.c:3124:bin_handle_async_start:<Video Bin> state change busy

0:00:11.888622160  8208   224AE280 DEBUG             GST_STATES gstelement.c:2620:gst_element_change_state:<GstVideoComponent> element will change state ASYNC

0:00:11.888635951  8208   224AE280 DEBUG             GST_STATES gstelement.c:2565:gst_element_set_state_func:<GstVideoComponent> returned ASYNC

0:00:11.888650062  8208   224AE280 INFO              GST_STATES gstbin.c:2713:gst_bin_change_state_func:<Video Bin> child 'GstVideoComponent' is changing state asynchronously to PAUSED

0:00:11.888668022  8208   224AE280 INFO              GST_STATES gstbin.c:2243:gst_bin_element_set_state:<capsfilter> current PLAYING pending VOID_PENDING, desired next PAUSED

0:00:11.888681492  8208   224AE280 DEBUG             GST_STATES gstelement.c:2481:gst_element_set_state_func:<capsfilter> set_state to PAUSED

0:00:11.888695283  8208   224AE280 DEBUG             GST_STATES gstelement.c:2506:gst_element_set_state_func:<capsfilter> setting target state to PAUSED

0:00:11.888709074  8208   224AE280 DEBUG             GST_STATES gstelement.c:2519:gst_element_set_state_func:<capsfilter> current PLAYING, old_pending VOID_PENDING, next VOID_PENDING, old return SUCCESS

0:00:11.888723185  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<capsfilter> final: setting state from PLAYING to PAUSED

0:00:11.888738259  8208   224AE280 DEBUG             GST_STATES gstelement.c:2638:gst_element_change_state:<capsfilter> element changed state SUCCESS

0:00:11.888753012  8208   224AE280 INFO              GST_STATES gstelement.c:2330:gst_element_continue_state:<capsfilter> completed state change to PAUSED

0:00:11.888768086  8208   224AE280 INFO              GST_STATES gstelement.c:2235:_priv_gst_element_state_changed:<capsfilter> notifying about state-changed PLAYING to PAUSED (VOID_PENDING pending)

0:00:11.888987456  8208   224AE280 DEBUG             GST_STATES gstelement.c:2565:gst_element_set_state_func:<capsfilter> returned SUCCESS

0:00:11.889003813  8208   224AE280 INFO              GST_STATES gstbin.c:2707:gst_bin_change_state_func:<Video Bin> child 'capsfilter' changed state to 3(PAUSED) successfully

0:00:11.889020169  8208   224AE280 INFO              GST_STATES gstbin.c:2243:gst_bin_element_set_state:<videoconvert> current PLAYING pending VOID_PENDING, desired next PAUSED

0:00:11.889036846  8208   224AE280 DEBUG             GST_STATES gstelement.c:2481:gst_element_set_state_func:<videoconvert> set_state to PAUSED

0:00:11.889049675  8208   224AE280 DEBUG             GST_STATES gstelement.c:2506:gst_element_set_state_func:<videoconvert> setting target state to PAUSED

0:00:11.889063145  8208   224AE280 DEBUG             GST_STATES gstelement.c:2519:gst_element_set_state_func:<videoconvert> current PLAYING, old_pending VOID_PENDING, next VOID_PENDING, old return SUCCESS

0:00:11.889077898  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<videoconvert> final: setting state from PLAYING to PAUSED

0:00:11.889097783  8208   224AE280 DEBUG             GST_STATES gstelement.c:2638:gst_element_change_state:<videoconvert> element changed state SUCCESS

0:00:11.889109970  8208   224AE280 INFO              GST_STATES gstelement.c:2330:gst_element_continue_state:<videoconvert> completed state change to PAUSED

0:00:11.889122478  8208   224AE280 INFO              GST_STATES gstelement.c:2235:_priv_gst_element_state_changed:<videoconvert> notifying about state-changed PLAYING to PAUSED (VOID_PENDING pending)

0:00:11.889230880  8208   224AE280 DEBUG             GST_STATES gstelement.c:2565:gst_element_set_state_func:<videoconvert> returned SUCCESS

0:00:11.889245954  8208   224AE280 INFO              GST_STATES gstbin.c:2707:gst_bin_change_state_func:<Video Bin> child 'videoconvert' changed state to 3(PAUSED) successfully

0:00:11.889261027  8208   224AE280 INFO              GST_STATES gstbin.c:2243:gst_bin_element_set_state:<H264 Decoder> current PLAYING pending VOID_PENDING, desired next PAUSED

0:00:11.889273856  8208   224AE280 DEBUG             GST_STATES gstelement.c:2481:gst_element_set_state_func:<H264 Decoder> set_state to PAUSED

0:00:11.889289571  8208   224AE280 DEBUG             GST_STATES gstelement.c:2506:gst_element_set_state_func:<H264 Decoder> setting target state to PAUSED

0:00:11.889302400  8208   224AE280 DEBUG             GST_STATES gstelement.c:2519:gst_element_set_state_func:<H264 Decoder> current PLAYING, old_pending VOID_PENDING, next VOID_PENDING, old return SUCCESS

0:00:11.889320039  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<H264 Decoder> final: setting state from PLAYING to PAUSED

0:00:11.889334471  8208   224AE280 DEBUG             GST_STATES gstelement.c:2638:gst_element_change_state:<H264 Decoder> element changed state SUCCESS

0:00:11.889346659  8208   224AE280 INFO              GST_STATES gstelement.c:2330:gst_element_continue_state:<H264 Decoder> completed state change to PAUSED

0:00:11.889359487  8208   224AE280 INFO              GST_STATES gstelement.c:2235:_priv_gst_element_state_changed:<H264 Decoder> notifying about state-changed PLAYING to PAUSED (VOID_PENDING pending)

0:00:11.889468852  8208   224AE280 DEBUG             GST_STATES gstelement.c:2565:gst_element_set_state_func:<H264 Decoder> returned SUCCESS

0:00:11.889483605  8208   224AE280 INFO              GST_STATES gstbin.c:2707:gst_bin_change_state_func:<Video Bin> child 'H264 Decoder' changed state to 3(PAUSED) successfully

0:00:11.889497716  8208   224AE280 INFO              GST_STATES gstbin.c:2243:gst_bin_element_set_state:<h264parse> current PLAYING pending VOID_PENDING, desired next PAUSED

0:00:11.889514393  8208   224AE280 DEBUG             GST_STATES gstelement.c:2481:gst_element_set_state_func:<h264parse> set_state to PAUSED

0:00:11.889526581  8208   224AE280 DEBUG             GST_STATES gstelement.c:2506:gst_element_set_state_func:<h264parse> setting target state to PAUSED

0:00:11.889540372  8208   224AE280 DEBUG             GST_STATES gstelement.c:2519:gst_element_set_state_func:<h264parse> current PLAYING, old_pending VOID_PENDING, next VOID_PENDING, old return SUCCESS

0:00:11.889553842  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<h264parse> final: setting state from PLAYING to PAUSED

0:00:11.889566991  8208   224AE280 DEBUG             GST_STATES gstelement.c:2638:gst_element_change_state:<h264parse> element changed state SUCCESS

0:00:11.889579178  8208   224AE280 INFO              GST_STATES gstelement.c:2330:gst_element_continue_state:<h264parse> completed state change to PAUSED

0:00:11.889594252  8208   224AE280 INFO              GST_STATES gstelement.c:2235:_priv_gst_element_state_changed:<h264parse> notifying about state-changed PLAYING to PAUSED (VOID_PENDING pending)

0:00:11.889692391  8208   224AE280 DEBUG             GST_STATES gstelement.c:2565:gst_element_set_state_func:<h264parse> returned SUCCESS

0:00:11.889707144  8208   224AE280 INFO              GST_STATES gstbin.c:2707:gst_bin_change_state_func:<Video Bin> child 'h264parse' changed state to 3(PAUSED) successfully

0:00:11.889719652  8208   224AE280 DEBUG             GST_STATES gstbin.c:2766:gst_bin_change_state_func:<Video Bin> iterator done

0:00:11.889729594  8208   224AE280 DEBUG             GST_STATES gstbin.c:2784:gst_bin_change_state_func:<Video Bin> we have ASYNC elements SUCCESS -> ASYNC

0:00:11.889741782  8208   224AE280 DEBUG             GST_STATES gstbin.c:2835:gst_bin_change_state_func:<Video Bin> done changing bin's state from PLAYING to PAUSED, now in PLAYING, ret ASYNC

0:00:11.889806887  8208   224AE280 DEBUG             GST_STATES gstelement.c:2620:gst_element_change_state:<Video Bin> element will change state ASYNC

0:00:11.889821640  8208   224AE280 DEBUG             GST_STATES gstelement.c:2565:gst_element_set_state_func:<Video Bin> returned ASYNC

0:00:11.889837997  8208   224AE280 INFO              GST_STATES gstbin.c:2713:gst_bin_change_state_func:<main pipeline> child 'Video Bin' is changing state asynchronously to PAUSED

0:00:11.889855636  8208   224AE280 INFO              GST_STATES gstbin.c:2243:gst_bin_element_set_state:<tsdemux> current PLAYING pending VOID_PENDING, desired next PAUSED

0:00:11.889870389  8208   224AE280 DEBUG             GST_STATES gstelement.c:2481:gst_element_set_state_func:<tsdemux> set_state to PAUSED

0:00:11.889882576  8208   224AE280 DEBUG             GST_STATES gstelement.c:2506:gst_element_set_state_func:<tsdemux> setting target state to PAUSED

0:00:11.889895405  8208   224AE280 DEBUG             GST_STATES gstelement.c:2519:gst_element_set_state_func:<tsdemux> current PLAYING, old_pending VOID_PENDING, next VOID_PENDING, old return SUCCESS

0:00:11.889908875  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<tsdemux> final: setting state from PLAYING to PAUSED

0:00:11.889920741  8208   224AE280 DEBUG             GST_STATES gstelement.c:2638:gst_element_change_state:<tsdemux> element changed state SUCCESS

0:00:11.889932287  8208   224AE280 INFO              GST_STATES gstelement.c:2330:gst_element_continue_state:<tsdemux> completed state change to PAUSED

0:00:11.889943192  8208   224AE280 INFO              GST_STATES gstelement.c:2235:_priv_gst_element_state_changed:<tsdemux> notifying about state-changed PLAYING to PAUSED (VOID_PENDING pending)

0:00:11.890091042  8208   224AE280 DEBUG             GST_STATES gstelement.c:2565:gst_element_set_state_func:<tsdemux> returned SUCCESS

0:00:11.890107078  8208   224AE280 INFO              GST_STATES gstbin.c:2707:gst_bin_change_state_func:<main pipeline> child 'tsdemux' changed state to 3(PAUSED) successfully

0:00:11.890121189  8208   224AE280 INFO              GST_STATES gstbin.c:2243:gst_bin_element_set_state:<source> current PLAYING pending VOID_PENDING, desired next PAUSED

0:00:11.890133377  8208   224AE280 DEBUG             GST_STATES gstelement.c:2481:gst_element_set_state_func:<source> set_state to PAUSED

0:00:11.890143319  8208   224AE280 DEBUG             GST_STATES gstelement.c:2506:gst_element_set_state_func:<source> setting target state to PAUSED

0:00:11.890172183  8208   224AE280 DEBUG             GST_STATES gstelement.c:2519:gst_element_set_state_func:<source> current PLAYING, old_pending VOID_PENDING, next VOID_PENDING, old return SUCCESS

0:00:11.890189502  8208   224AE280 DEBUG             GST_STATES gstelement.c:2553:gst_element_set_state_func:<source> final: setting state from PLAYING to PAUSED

0:00:11.905778577  8208   15E4AAE0 DEBUG             GST_STATES gstelement.c:2020:gst_element_get_state_func:<source> getting state, timeout 99:99:99.999999999

0:00:11.905801989  8208   15E4AAE0 DEBUG             GST_STATES gstelement.c:2025:gst_element_get_state_func:<source> RETURN is ASYNC

0:00:11.905814176  8208   15E4AAE0 INFO              GST_STATES gstelement.c:2048:gst_element_get_state_func:<source> waiting for element to commit state






Le 12/12/2016 à 10:47, Nicolas Castillejos a écrit :
Hello,

Thank you for your answers, I put my java code in attachment .
I don't really think it comes from my application.
As you can see, my code is really simple. I fill the appsrc with a byte array. There is no possible deadlock I can see.
I understand the multi-process solution, but it is a pain to do this as I have to display video pictures in my java application.
Do you think it can be a problem with the java mapping ? it is not the first time I met problems with it so....

Nicolas Castillejos




_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Need Help to send GStreamer H264/AAC packets to Wowza Streaming Engine

Nicolas Castillejos
In reply to this post by Nicolas Castillejos
Hello everyone,

I'm trying to start a stream on Wowza programmaticaly by feeding the stream myself with packets comming from GStreamer.
Wowza provides an API called "Publisher API" : (http://www.wowza.com/resources/serverapi/4.5.0/com/wowza/wms/stream/publish/Publisher.html)
it enables you to publish a stream on Wowza with Java Code by feeding the stream with byte[] (packets).
What I'm trying to do is to read a mkv file on disk with gstreamer and send packets to Wowza using this API.
My Problem is that Wowza seems to doesn't recognize what's inside the packet I'm sending, see logs :

Audio codec:PCM_BE isCompatible:false
Video codec:UNKNOWN[0] isCompatible:false

For information my video and audio packets are in h264 and aac codecs. it is 2 format that Wowza knows to read.
I Think, maybe the packets coming from GStreamer can't be sent to Wowza directly without some king of transformation or adaptation.
On the Publisher API page, there is the format of the packets for aac and h264 that is described. I don't know if GStreamer is already sending me the video and audio packets
respecting this format or if I have to do something myself with gstreamer packets before giving it to Wowza.

For more detail, this is the GStreamer Pipeline I'm using :


 

I've tryed with and without h264parse & aacparse and it is the same result.

This is my code that read gstreamer video/audio buffer and transmit it to Wowza using the Publisher API. I think there is something to work here to make this works :

private class VIDEO_BUFFER_LISTENER implements AppSink.NEW_BUFFER{

  @Override
  public void newBuffer(AppSink elem) {
           
    Buffer buffer = elem.pullBuffer();
           
    ByteBuffer bb =buffer.getByteBuffer();
           
        byte[] bytes = toArray(bb);
                   
    AMFPacket amfPacket = new AMFPacket(IVHost.CONTENTTYPE_VIDEO,1,bytes);
           
    publisher.addVideoData(amfPacket.getData(), amfPacket.getSize(), amfPacket.getTimecode());   
           
    buffer.dispose();
  }
       
}

private class AUDIO_BUFFER_LISTENER implements AppSink.NEW_BUFFER{

  @Override
  public void newBuffer(AppSink elem) {
           
        Buffer buffer = elem.pullBuffer();
       
    ByteBuffer bb =buffer.getByteBuffer();
           
           
    byte[] bytes = toArray(bb);
           
    AMFPacket amfPacket = new AMFPacket(IVHost.CONTENTTYPE_AUDIO,1,bytes);
           
    publisher.addAudioData(amfPacket.getData(), amfPacket.getSize(), amfPacket.getTimecode());
                   
    buffer.dispose();
  }
   
}

private byte[] toArray(ByteBuffer bb){
    byte[] b = new byte[bb.remaining()];
    bb.get(b);
    return b;
}

This is the format described by wowza on the page http://www.wowza.com/resources/serverapi/4.5.0/com/wowza/wms/stream/publish/Publisher.html:

_____________________________________________________________________________________________________________________________________________
Basic packet format:

Audio:

AAC
[1-byte header]
[1-byte codec config indicator (1 - audio data, 0 - codec config packet)]
[n-bytes audio content or codec config data]

All others
[1-byte header]
[n-bytes audio content]

Below is the bit
layout of the header byte of data (table goes from least significant bit to most significant bit):

1 bit Number of channels:  
  0    mono
  1    stereo

1 bit Sample size:  
  0    8 bits per sample
  1    16 bits per sample

2 bits Sample rate:  
  0    special or 8KHz
  1    11KHz
  2    22KHz
  3    44KHz

4 bits Audio type:  
  0    PCM (big endian)
  1    PCM (swf - ADPCM)
  2    MP3
  3    PCM (little endian)
  4    Nelly Moser ASAO 16KHz Mono
  5    Nelly Moser ASAO 8KHz Mono
  6    Nelly Moser ASAO
  7    G.711 ALaw
  8    G.711 MULaw
  9    Reserved
  a    AAC
  b    Speex
  f    MP3 8Khz

Note: For AAC the codec config data is generally a two byte packet that describes the stream. It must
be published first. Here is the basic code to fill in the codec config data.

AACFrame frame = new AACFrame();
int sampleRate = 22100;
int channels = 2;
frame.setSampleRate(sampleRate);
frame.setRateIndex(AACUtils.sampleRateToIndex(sampleRate));
frame.setChannels(channels);
frame.setChannelIndex(AACUtils.channelCountToIndex(sampleRate));
byte[] codecConfig = new byte[2];
AACUtils.encodeAACCodecConfig(frame, codecConfig, 0);

Note: For AAC the header byte is always 0xaf

Note: For Speex the audio data must be encoded as 16000Hz wide band

Video:

H.264
[1-byte header]
[1-byte codec config indicator (1 - video data, 0 - codec config packet)]
[3-byte time difference between dts and pts in milliseconds]
[n-bytes video content or codec config data]

All others
[1-byte header]
[n-bytes audio content]

Below is the bit layout of the header byte of data (table goes from least significant bit to most significant bit):

4 bits Video type:  
  2    Sorenson Spark (H.263)
  3    Screen
  4    On2 VP6
  5    On2 VP6A
  6    Screen2
  7    H.264

2 bit Frame type:  
  1    K frame (key frame)
  2    P frame
  3    B frame

Note: H.264 codec config data is the same as the AVCc packet in a QuickTime container.

Note: All timecode data is in milliseconds
_____________________________________________________________________________________________________________________________________________

Do you know what is the problem in my code and what do I have to do to make this work ?


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