How to prevent latency from changing?

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

How to prevent latency from changing?

kmesbah
I'm new to GStreamer. I'm trying to stream from an IP camera using an rtsp URI. I have been using the 5th Android tutorial as a base for my code. the problem is that there were 2 seconds latency. after searching around, I managed to reduce it by replacing

data->pipeline = gst_parse_launch("playbin", &error);

with

data->pipeline = gst_parse_launch("playbin uridecodebin0::source::latency=250", &error);

the problem now is whenever the activity that has the surface view gets paused then resumed, the latency gets reset back to 2 seconds. any idea how I can prevent this from happening? I'm using GStreamer 1.7.91.

thanks!
Reply | Threaded
Open this post in threaded view
|

Re: How to prevent latency from changing?

Sebastian Dröge-3
On Mi, 2016-03-16 at 08:01 -0700, kmesbah wrote:

> I'm new to GStreamer. I'm trying to stream from an IP camera using an rtsp
> URI. I have been using the  5th Android tutorial
>   
> as a base for my code. the problem is that there were 2 seconds latency.
> after searching around, I managed to reduce it by replacing
>
> data->pipeline = gst_parse_launch("playbin", &error);
>
> with
>
> data->pipeline = gst_parse_launch("playbin
> uridecodebin0::source::latency=250", &error);
>
> the problem now is whenever the activity that has the surface view gets
> paused then resumed, the latency gets reset back to 2 seconds. any idea how
> I can prevent this from happening? I'm using GStreamer 1.7.91.
Use the source-setup signal on playbin. That will give you the source
element whenever one is created and to be set up.

You can there then set the latency. The problem in your case is most
likely that there will be an uridecodebin1, uridecodebin2, etc..

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com

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

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

Re: How to prevent latency from changing?

kmesbah
This post was updated on .
Do you mind giving code samples on how to accomplish this? if yes, any references would you recommend for a beginner to look at? thanks!
Reply | Threaded
Open this post in threaded view
|

Re: How to prevent latency from changing?

Sebastian Dröge-3
On Do, 2016-03-17 at 01:55 -0700, kmesbah wrote:
> Do you mind giving code samples on how to accomplish this? if yes,
> any references would you recommend a beginner to look at? thanks!

https://cgit.freedesktop.org/gstreamer/gst-rtsp-server/tree/examples/test-netclock-client.c#n28
https://cgit.freedesktop.org/gstreamer/gst-rtsp-server/tree/examples/test-netclock-client.c#n121

This sets other properties on rtspsrc, but the same works with latency.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com


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

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

Re: How to prevent latency from changing?

SamJ
This post was updated on .
In reply to this post by kmesbah
Hi,

Please create one callback using below line in app_function where another callback are there..
  g_signal_connect(G_OBJECT(data->pipeline), "source-setup",
                   (GCallback) source_setup_cb, data);

And Put below callback function in your C Code and try now.

static void source_setup_cb(GstElement *pipeline, GstElement *source,
                            CustomData *data) {
  gint latency = 0; //data->latency;
  GValue val = G_VALUE_INIT;

  g_value_init(&val, G_TYPE_INT);
  g_value_set_int(&val, latency);

  g_object_set_property(source, "latency", &val);
}

I have solved 2 to 3 Second latency to 800 ms using above function.