Is there any way to check rtp stream coming from source over udp?

602 views
Skip to first unread message

abdurrah...@gmail.com

unread,
Jan 20, 2021, 2:19:26 AM1/20/21
to gstreamer-java

I've implemented the code to get video stream from camera source over UDP. I need to check whether the source (camera) sending data or alive. Is there any way to check in using Gstreamer?

end-of-stream notification is not working to check udp source pipeline state. 


SimpleVideoComponent vc = new SimpleVideoComponent();

Pipeline pipeline = new Pipeline("monitoring-pipe");

pipeline.getBus().connect((Bus.ERROR) this);

pipeline.getBus().connect((Bus.WARNING) this);

pipeline.getBus().connect((Bus.STATE_CHANGED) this);

pipeline.getBus().connect((Bus.EOS) this);

Element udpsrc = ElementFactory.make("udpsrc", "udpsrc");

udpsrc.set("port", monitoringPort);

vc.getElement().set("sync", false);


udpsrc.setCaps(Caps

.fromString("application/x-rtp, media=(string)video, encoding-name=(string)H264, payload=(int)101"));


Bin bin = Gst.parseBinFromDescription(

"rtph264depay ! video/x-h264, stream-format=byte-stream, profile=high ! h264parse ! queue ! avdec_h264 ! queue2 ! videoconvert",

true);

pipeline.addMany(udpsrc, bin, vc.getElement());

Element.linkMany(udpsrc, bin, vc.getElement());

pipeline.play();

pipeline.setState(State.PLAYING);

Neil C Smith

unread,
Jan 20, 2021, 6:51:20 AM1/20/21
to gstream...@googlegroups.com
On Wed, 20 Jan 2021 at 07:19, abdurrah...@gmail.com
<abdurrah...@gmail.com> wrote:
> I've implemented the code to get video stream from camera source over UDP. I need to check whether the source (camera) sending data or alive. Is there any way to check in using Gstreamer?

The best thing is usually to look in upstream documentation, and
possibly ask there if you can't find what you need. I doubt you'll
get an EOS. You can set a timeout property on udpsrc but you'll have
to listen for a different message. You can also add a MESSAGE
listener for every message on the bus and log them for experimenting
until you know exactly what you need.

However, there is one thing specific to the bindings that you want to
be wary of - don't put Pipeline in a local variable, which is what it
looks like you have here? Doing that will break when the garbage
collector runs. It might explain things going down without any
notification too.

Out of interest, why set the pipeline up manually rather than relying
on a PlayBin or URIDecodeBin here?

Best wishes,

Neil


--
Neil C Smith
Codelerity Ltd.
www.codelerity.com

Codelerity Ltd. is a company registered in England and Wales
Registered company number : 12063669
Registered office address : Office 4 219 Kensington High Street,
Kensington, London, England, W8 6BD

abdurrah...@gmail.com

unread,
Jan 21, 2021, 6:16:43 AM1/21/21
to gstreamer-java
Hi Neil, 

In my opinion, Pipeline which is created manually works perfectly, and it is realiable and easy to implement. I have tried playbin before and faced some difficulties. 
The code which posted above is just part of the whole code.  Thank you for indicating vulnerabilities you have seen. 

I've implemented all Bus listener methods includes EOS and log them but nothing happened when killed the outsource Pipeline .
I'm looking the doc about upstream but could not find a forum to ask question. 

Thanks.

20 Ocak 2021 Çarşamba tarihinde saat 14:51:20 UTC+3 itibarıyla neil şunları yazdı:

Neil C Smith

unread,
Jan 21, 2021, 6:39:26 AM1/21/21
to gstream...@googlegroups.com
On Thu, 21 Jan 2021 at 11:16, abdurrah...@gmail.com
<abdurrah...@gmail.com> wrote:
> In my opinion, Pipeline which is created manually works perfectly, and it is realiable and easy to implement. I have tried playbin before and faced some difficulties.

What difficulties? I added signals support for PlayBin source-setup
and element-setup in 1.4, which does allow for a lot of configuration
of how PlayBin sets itself up. It was feasible, but awkward, to do
that in earlier versions of the bindings.

> I've implemented all Bus listener methods includes EOS and log them but nothing happened when killed the outsource Pipeline .

Have you tried configuring the timeout property on the source and
seeing what messages you get then?

> I'm looking the doc about upstream but could not find a forum to ask question.

https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

abdurrah...@gmail.com

unread,
Jan 21, 2021, 7:15:04 AM1/21/21
to gstreamer-java
When I change the Pipeline with PlayBin, even displaying the video on the screen disappear. 

I've set the timeout property like
incomingUdpSrc.set("timeout", 1000);
 that , unfortunaltely nothing changed.

Thank you for your time .
21 Ocak 2021 Perşembe tarihinde saat 14:39:26 UTC+3 itibarıyla neil şunları yazdı:

Neil C Smith

unread,
Jan 21, 2021, 7:28:00 AM1/21/21
to gstream...@googlegroups.com
On Thu, 21 Jan 2021 at 12:15, abdurrah...@gmail.com
<abdurrah...@gmail.com> wrote:
> When I change the Pipeline with PlayBin, even displaying the video on the screen disappear.

Might be down to choice of URI then.

> I've set the timeout property like
> incomingUdpSrc.set("timeout", 1000);
> that , unfortunaltely nothing changed.

That property is in nanoseconds, so you probably don't want 1000!

You should get something over Bus.MESSAGE if it times out, although
what exactly you'll have to look up.

abdurrah...@gmail.com

unread,
Jan 21, 2021, 8:47:46 AM1/21/21
to gstreamer-java
I'm getting a message which has ELEMENT Type and source "BaseSrc" udpsrc. It only comes when timeout reachs. 
I am trying to make use of this listener.

Thank you. 

21 Ocak 2021 Perşembe tarihinde saat 15:28:00 UTC+3 itibarıyla neil şunları yazdı:
Reply all
Reply to author
Forward
0 new messages