Setting gstreamer latency for RTSP feeds with the Java Client

598 views
Skip to first unread message

kc7b...@gmail.com

unread,
Feb 3, 2016, 3:02:35 PM2/3/16
to kurento
I am playing with the kurento-player java tutorial to test and experiment with Kurento. My goal is to take RTSP video from an IP camera and play it in a browser with minimal delay. I am seeing several seconds of delay between the live video and the displayed video. It appears that it is related to the default latency by the gsreamer rtsp source. I found the following examples of how to set the latency in gstreamer:

public class GstPlayBin2Test {
 
public static void main(String [] args) throws Exception {
 
Gst.init("GstPlayBin2Test", args);
 
 URI uri
= new URI("rtsp://127.0.0.1:8551/test");
 
PlayBin2 playbin2 = new PlayBin2("GstPlayBin2Test", uri);
 
 
Element videoSink = ElementFactory.make("autovideosink", "videosink");
 playbin2
.setVideoSink(videoSink);
 
 playbin2
.connect("notify::source", Object.class, null, new NotifySourceCallback());
 
 playbin2
.play();
 
 
Gst.main();
 
 playbin2
.stop();
 
}
 
 
static class NotifySourceCallback implements GstAPI.GstCallback {
 
public void callback(Element element, GParamSpec spec, Pointer user_data) {
 
Element source = (Element) element.get("source");
 
String sourceFactory = source.getFactory().getName();
 
if ("rtspsrc".equals(sourceFactory)) {
 source
.set("latency", 10000);
 
}
 
}
 
}
}




public class PipelineLauncher {
   
public static void main(String[] args) {
        args
= Gst.init("PipelineLauncher", args);
 
String def = "rtspsrc location=xxx name=src ! fakesink";
       
Pipeline pipe = Pipeline.launch(def);
 
Element rtsp = pipe.getElementByName("src");
 rtsp
.set("latency", 6000);
        pipe
.play();
       
Gst.main();
        pipe
.stop();
   
}




Is there a way to do this with the Kurento Java client API? If not, how would I go about making the changes to support this feature?

Thanks, David

Jose Antonio Santos Cadenas

unread,
Feb 3, 2016, 3:40:55 PM2/3/16
to kurento
There is an open issue about this. A patch is almost done, but is missing of an interface. It is not in our short-term roadmap, but contributions are welcome.


--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Robison

unread,
Feb 3, 2016, 4:41:50 PM2/3/16
to kur...@googlegroups.com
Thanks. I am new to Kurento. Can you give me some pointers as how I would do this? Maybe a brief out line how one of the existing interfaces is coded. Thanks, David

--
You received this message because you are subscribed to a topic in the Google Groups "kurento" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kurento/vjjgAM47cH0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kurento+u...@googlegroups.com.

kc7b...@gmail.com

unread,
Feb 9, 2016, 2:53:19 PM2/9/16
to kurento
I am looking at providing this interface. However, I am new to Kurento and am quite unfamiliar with the code and it's layout. I'm hoping you or someone else can give me some pointers. I am looking at the solution provided here: https://gist.github.com/hunternet93/a7b4a791ce8bf2c29ccf.

Looking at the code, my best guess is that I would

1) Add a BastRtpEndpoint property in kms-core/src/server/interface/core.kmd.json
2) Add the corresponding methods in kurento-java/kurento-client/target/generated-sources/kmd/org/kurento/client/BaseRtpEndpoint.java

I'm not sure if there is anything else I need to do to define the interface. 

Finally, once in the kms-elements/src/gst-plugins/kmsplayerendpoint.c how do I get the variable that was passed in?

Any guidance, insight, or tutorial would be greatly appreciated.
Thanks, David

Jose Antonio Santos Cadenas

unread,
Feb 10, 2016, 4:38:33 PM2/10/16
to kur...@googlegroups.com
Responses inline

El mar., 9 feb. 2016 a las 20:53, <kc7b...@gmail.com> escribió:
I am looking at providing this interface. However, I am new to Kurento and am quite unfamiliar with the code and it's layout. I'm hoping you or someone else can give me some pointers. I am looking at the solution provided here: https://gist.github.com/hunternet93/a7b4a791ce8bf2c29ccf.

Looking at the code, my best guess is that I would

1) Add a BastRtpEndpoint property in kms-core/src/server/interface/core.kmd.json

Not here but in Playendpoint.kmd.json in project kms-elements 

2) Add the corresponding methods in kurento-java/kurento-client/target/generated-sources/kmd/org/kurento/client/BaseRtpEndpoint.java


Java is autogenerated, you don't need to modify it.
 
I'm not sure if there is anything else I need to do to define the interface. 


Just define the interface in kmd.json file 

Finally, once in the kms-elements/src/gst-plugins/kmsplayerendpoint.c how do I get the variable that was passed in?

Using a gobject property from PlayerEndpointImpl.cpp
 

Any guidance, insight, or tutorial would be greatly appreciated.
Thanks, David

Hope that helps.

Cheers. 

kc7b...@gmail.com

unread,
Feb 12, 2016, 10:10:30 AM2/12/16
to kurento
Where is the "Java is autogenerated, you don't need to modify it."? In which project is it generated? David

Jose Antonio Santos Cadenas

unread,
Feb 12, 2016, 10:15:27 AM2/12/16
to kurento
in the project that contains the kmd, it is not upladed to git but directly to maven during compilation in ci system. When kurento-client-java is build the source is generated using the dependencies that were updated to maven.

kc7b...@gmail.com

unread,
Feb 12, 2016, 10:51:38 AM2/12/16
to kurento, kc7b...@gmail.com
I made the changes to the kmd.json file but java does not seem to be generating its source from the new file. Any idea what I may be doing wrong? David

Jose Antonio Santos Cadenas

unread,
Feb 13, 2016, 9:46:38 AM2/13/16
to kurento, kc7b...@gmail.com
Reply all
Reply to author
Forward
0 new messages