Set buffer size in RTP streaming

2,011 views
Skip to first unread message

dulceangustia

unread,
Mar 23, 2009, 5:40:23 AM3/23/09
to gstreamer-java
Hi,

I would like to know how I can set/change the buffering size of an RTP
streaming (VoD/RTSP session). I have take a look at the Gstreamer-java
javadoc but I can't guess how to implement it.

Any idea would be much appreciated.


Thank you,
Javi

Tal Shalif (talos)

unread,
Mar 23, 2009, 9:07:45 PM3/23/09
to gstreamer-java
I have not used RTSP processing pipelines myself, but have you tried
looking at possible element properties (using gst-inspect) - such as
'latency' on the rtspsrc element?

On Mar 23, 11:40 am, dulceangustia <javier.galvez.guerr...@gmail.com>
wrote:

dulceangustia

unread,
Mar 24, 2009, 9:25:44 AM3/24/09
to gstreamer-java
Thanks for your answer, Tal.

Indeed, there is a 'latency' property of the rtspsrc element which
default value is 3000 ms, I suppose this is related to the RTP
streaming buffering and not to the RTSP, isn't it? However, I don't
know how to set this up in my Java code. Could you please give me any
clue about how to set/get (change) element properties with the
gstreamer-java framework?

I'm trying to change this buffer size because when seeking an RTP
content within an RTSP session the video jumps smoothly but the audio
disappears for a while (3 seconds?) and then it starts playing quickly
till it synchronizes with the video stream. I don't know if I could
set the same buffer sizes for both video and audio streams or do
something useful with this. Any idea will be welcome.

Thank you,
Javi

Tal Shalif

unread,
Mar 24, 2009, 10:29:37 AM3/24/09
to gstream...@googlegroups.com
Here is an example of how to create a pipeline and access its elements by name:

import org.gstreamer.Gst;
import org.gstreamer.Pipeline;


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();
    }
}


2009/3/24 dulceangustia <javier.galv...@gmail.com>

thomas....@gmail.com

unread,
Mar 12, 2013, 12:29:23 PM3/12/13
to gstream...@googlegroups.com
Hello,

the quoted code below shows how to set the latency when used a PipeLine constructor. How can this be achieved with a PlayBin2 factory?

Thanks
Thomas

Michael Esemplare

unread,
Jun 18, 2013, 1:24:54 AM6/18/13
to gstream...@googlegroups.com
A brief precursor to the solution:

Since gst-plugins-base 0.10.33, the playbin2 element has a "source-setup" signal. 


Either way, you can connect a "notify::source" signal to the playbin2 element and find out when the source element was created. In this callback you can then do checking if it is in fact an rtspsrc, and you can set its properties.

Here is a working example (same as attached):

import java.net.URI;

import org.gstreamer.Bin;
import org.gstreamer.Element;
import org.gstreamer.ElementFactory;
import org.gstreamer.Gst;
import org.gstreamer.Bin.ELEMENT_ADDED;
import org.gstreamer.elements.PlayBin2;
import org.gstreamer.lowlevel.GObjectAPI.GParamSpec;
import org.gstreamer.lowlevel.GstAPI;

import com.sun.jna.Pointer;

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());
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);
}
}
}
}
GstPlayBin2Test.java

Farkas Levente

unread,
Jun 19, 2013, 7:50:31 AM6/19/13
to gstream...@googlegroups.com, Michael Esemplare
r603 add it to playbin2
> <http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/gst/playback/gstplaybin2.c?h=0.10&id=c48c193b56480d286935a6d97071ad8caa19b99e>
> --
> You received this message because you are subscribed to the Google
> Groups "gstreamer-java" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to gstreamer-jav...@googlegroups.com.
> To post to this group, send email to gstream...@googlegroups.com.
> Visit this group at http://groups.google.com/group/gstreamer-java.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
Levente "Si vis pacem para bellum!"
Reply all
Reply to author
Forward
0 new messages