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 |
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 |
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 _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
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 |
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, _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
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_ 0:00:11.905778577 8208
15E4AAE0 DEBUG GST_STATES
gstelement.c:2020:gst_element_ 0:00:11.905801989 8208
15E4AAE0 DEBUG GST_STATES
gstelement.c:2025:gst_element_ 0:00:11.905814176 8208
15E4AAE0 INFO GST_STATES
gstelement.c:2048:gst_element_
It seems that is it
waiting for ever (timeout 99:99:99.999999999) an element
state change but it nevers happends why ? 0:00:11.888218377 8208
224AE280 DEBUG GST_STATES
gstelement.c:2481:gst_element_ 0:00:11.888247883 8208
224AE280 DEBUG GST_STATES
gstelement.c:2506:gst_element_ 0:00:11.888261353 8208
224AE280 DEBUG GST_STATES
gstelement.c:2519:gst_element_ 0:00:11.888279955 8208
224AE280 DEBUG GST_STATES
gstelement.c:2553:gst_element_ 0:00:11.888302084 8208
224AE280 DEBUG GST_STATES
gstbin.c:2591:gst_bin_change_ 0:00:11.888395092 8208
224AE280 INFO GST_STATES
gstbin.c:2243:gst_bin_element_ 0:00:11.888413694 8208
224AE280 DEBUG GST_STATES
gstelement.c:2481:gst_element_ 0:00:11.888425560 8208
224AE280 DEBUG GST_STATES
gstelement.c:2506:gst_element_ 0:00:11.888441917 8208
224AE280 DEBUG GST_STATES
gstelement.c:2519:gst_element_ 0:00:11.888463084 8208
224AE280 DEBUG GST_STATES
gstelement.c:2553:gst_element_ 0:00:11.888478479 8208
224AE280 DEBUG GST_STATES
gstbin.c:2591:gst_bin_change_ 0:00:11.888503815 8208
224AE280 INFO GST_STATES
gstbin.c:2243:gst_bin_element_ 0:00:11.888517285 8208
224AE280 DEBUG GST_STATES
gstelement.c:2481:gst_element_ 0:00:11.888527869 8208
224AE280 DEBUG GST_STATES
gstelement.c:2506:gst_element_ 0:00:11.888570204 8208
224AE280 DEBUG GST_STATES
gstelement.c:2519:gst_element_ 0:00:11.888584636 8208
224AE280 DEBUG GST_STATES
gstelement.c:2553:gst_element_ 0:00:11.888607407 8208
224AE280 DEBUG GST_STATES
gstbin.c:3124:bin_handle_ 0:00:11.888622160 8208
224AE280 DEBUG GST_STATES
gstelement.c:2620:gst_element_ 0:00:11.888635951 8208
224AE280 DEBUG GST_STATES
gstelement.c:2565:gst_element_ 0:00:11.888650062 8208
224AE280 INFO GST_STATES
gstbin.c:2713:gst_bin_change_ 0:00:11.888668022 8208
224AE280 INFO GST_STATES
gstbin.c:2243:gst_bin_element_ 0:00:11.888681492 8208
224AE280 DEBUG GST_STATES
gstelement.c:2481:gst_element_ 0:00:11.888695283 8208
224AE280 DEBUG GST_STATES
gstelement.c:2506:gst_element_ 0:00:11.888709074 8208
224AE280 DEBUG GST_STATES
gstelement.c:2519:gst_element_ 0:00:11.888723185 8208
224AE280 DEBUG GST_STATES
gstelement.c:2553:gst_element_ 0:00:11.888738259 8208
224AE280 DEBUG GST_STATES
gstelement.c:2638:gst_element_ 0:00:11.888753012 8208
224AE280 INFO GST_STATES
gstelement.c:2330:gst_element_ 0:00:11.888768086 8208
224AE280 INFO GST_STATES
gstelement.c:2235:_priv_gst_ 0:00:11.888987456 8208
224AE280 DEBUG GST_STATES
gstelement.c:2565:gst_element_ 0:00:11.889003813 8208
224AE280 INFO GST_STATES
gstbin.c:2707:gst_bin_change_ 0:00:11.889020169 8208
224AE280 INFO GST_STATES
gstbin.c:2243:gst_bin_element_ 0:00:11.889036846 8208
224AE280 DEBUG GST_STATES
gstelement.c:2481:gst_element_ 0:00:11.889049675 8208
224AE280 DEBUG GST_STATES
gstelement.c:2506:gst_element_ 0:00:11.889063145 8208
224AE280 DEBUG GST_STATES
gstelement.c:2519:gst_element_ 0:00:11.889077898 8208
224AE280 DEBUG GST_STATES
gstelement.c:2553:gst_element_ 0:00:11.889097783 8208
224AE280 DEBUG GST_STATES
gstelement.c:2638:gst_element_ 0:00:11.889109970 8208
224AE280 INFO GST_STATES
gstelement.c:2330:gst_element_ 0:00:11.889122478 8208
224AE280 INFO GST_STATES
gstelement.c:2235:_priv_gst_ 0:00:11.889230880 8208
224AE280 DEBUG GST_STATES
gstelement.c:2565:gst_element_ 0:00:11.889245954 8208
224AE280 INFO GST_STATES
gstbin.c:2707:gst_bin_change_ 0:00:11.889261027 8208
224AE280 INFO GST_STATES
gstbin.c:2243:gst_bin_element_ 0:00:11.889273856 8208
224AE280 DEBUG GST_STATES
gstelement.c:2481:gst_element_ 0:00:11.889289571 8208
224AE280 DEBUG GST_STATES
gstelement.c:2506:gst_element_ 0:00:11.889302400 8208
224AE280 DEBUG GST_STATES
gstelement.c:2519:gst_element_ 0:00:11.889320039 8208
224AE280 DEBUG GST_STATES
gstelement.c:2553:gst_element_ 0:00:11.889334471 8208
224AE280 DEBUG GST_STATES
gstelement.c:2638:gst_element_ 0:00:11.889346659 8208
224AE280 INFO GST_STATES
gstelement.c:2330:gst_element_ 0:00:11.889359487 8208
224AE280 INFO GST_STATES
gstelement.c:2235:_priv_gst_ 0:00:11.889468852 8208
224AE280 DEBUG GST_STATES
gstelement.c:2565:gst_element_ 0:00:11.889483605 8208
224AE280 INFO GST_STATES
gstbin.c:2707:gst_bin_change_ 0:00:11.889497716 8208
224AE280 INFO GST_STATES
gstbin.c:2243:gst_bin_element_ 0:00:11.889514393 8208
224AE280 DEBUG GST_STATES
gstelement.c:2481:gst_element_ 0:00:11.889526581 8208
224AE280 DEBUG GST_STATES
gstelement.c:2506:gst_element_ 0:00:11.889540372 8208
224AE280 DEBUG GST_STATES
gstelement.c:2519:gst_element_ 0:00:11.889553842 8208
224AE280 DEBUG GST_STATES
gstelement.c:2553:gst_element_ 0:00:11.889566991 8208
224AE280 DEBUG GST_STATES
gstelement.c:2638:gst_element_ 0:00:11.889579178 8208
224AE280 INFO GST_STATES
gstelement.c:2330:gst_element_ 0:00:11.889594252 8208
224AE280 INFO GST_STATES
gstelement.c:2235:_priv_gst_ 0:00:11.889692391 8208
224AE280 DEBUG GST_STATES
gstelement.c:2565:gst_element_ 0:00:11.889707144 8208
224AE280 INFO GST_STATES
gstbin.c:2707:gst_bin_change_ 0:00:11.889719652 8208
224AE280 DEBUG GST_STATES
gstbin.c:2766:gst_bin_change_ 0:00:11.889729594 8208
224AE280 DEBUG GST_STATES
gstbin.c:2784:gst_bin_change_ 0:00:11.889741782 8208
224AE280 DEBUG GST_STATES
gstbin.c:2835:gst_bin_change_ 0:00:11.889806887 8208
224AE280 DEBUG GST_STATES
gstelement.c:2620:gst_element_ 0:00:11.889821640 8208
224AE280 DEBUG GST_STATES
gstelement.c:2565:gst_element_ 0:00:11.889837997 8208
224AE280 INFO GST_STATES
gstbin.c:2713:gst_bin_change_ 0:00:11.889855636 8208
224AE280 INFO GST_STATES
gstbin.c:2243:gst_bin_element_ 0:00:11.889870389 8208
224AE280 DEBUG GST_STATES
gstelement.c:2481:gst_element_ 0:00:11.889882576 8208
224AE280 DEBUG GST_STATES
gstelement.c:2506:gst_element_ 0:00:11.889895405 8208
224AE280 DEBUG GST_STATES
gstelement.c:2519:gst_element_ 0:00:11.889908875 8208
224AE280 DEBUG GST_STATES
gstelement.c:2553:gst_element_ 0:00:11.889920741 8208
224AE280 DEBUG GST_STATES
gstelement.c:2638:gst_element_ 0:00:11.889932287 8208
224AE280 INFO GST_STATES
gstelement.c:2330:gst_element_ 0:00:11.889943192 8208
224AE280 INFO GST_STATES
gstelement.c:2235:_priv_gst_ 0:00:11.890091042 8208
224AE280 DEBUG GST_STATES
gstelement.c:2565:gst_element_ 0:00:11.890107078 8208
224AE280 INFO GST_STATES
gstbin.c:2707:gst_bin_change_ 0:00:11.890121189 8208
224AE280 INFO GST_STATES
gstbin.c:2243:gst_bin_element_ 0:00:11.890133377 8208
224AE280 DEBUG GST_STATES
gstelement.c:2481:gst_element_ 0:00:11.890143319 8208
224AE280 DEBUG GST_STATES
gstelement.c:2506:gst_element_ 0:00:11.890172183 8208
224AE280 DEBUG GST_STATES
gstelement.c:2519:gst_element_ 0:00:11.890189502 8208
224AE280 DEBUG GST_STATES
gstelement.c:2553:gst_element_ 0:00:11.905778577 8208
15E4AAE0 DEBUG GST_STATES
gstelement.c:2020:gst_element_ 0:00:11.905801989 8208
15E4AAE0 DEBUG GST_STATES
gstelement.c:2025:gst_element_ 0:00:11.905814176 8208
15E4AAE0 INFO GST_STATES
gstelement.c:2048:gst_element_ Le 12/12/2016 à 10:47, Nicolas Castillejos a écrit : Hello,
_______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
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]>:
_______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
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 |
Free forum by Nabble | Edit this page |