Android is strutting for Real Time Stream

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

Android is strutting for Real Time Stream

Azure1 Sureale
Hello, I'm trying to have an Android Player receiving a RTSP stream from the internet and play it with very low latency. 
I'm using Tutorial 5 from the GStreamer home. Without any change my stream has a latency about 2 seconds (worst than Vitamio that I was using previously).

With futher investigation we realized we could change the latency to 0 in the pipeline using this code:

****************************************************************
data->pipeline = gst_parse_launch("playbin", &error);
    gst_pipeline_set_latency(data->pipeline,0); //This is what I wrote

    if (error) {
    gchar *message = g_strdup_printf("Unable to build pipeline: %s", error->message);
    g_clear_error (&error);
    set_ui_message(message, data);
    g_free (message);
    return NULL;
  }

****************************************************************

Now the stream is strutting, alas dropping frames. However the stream is faster than the base code.
Based on other questions, I tried to add rtpjitterbuffer into the pipeline but seems that is not that simple.

How can I construct or change the pipeline to have low latency and no strutting?

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Android is strutting for Real Time Stream

Olivier Crête-3
Hi,

The two seconds are from rtspsrc, you can set the "latency" property to something reasonable like 200ms by connecting to the "source-setup" signal on playbin and setting the latency property to 200 if it's rtspsrc.

You can verify the automatically calculated latency by setting GST_DEBUG=bin:4

Setting the pipeline latency manually will indeed produce problems if you set a lower value than the minimal one.

Olivier

On Wed, 2017-09-20 at 14:13 -0300, Azure1 Sureale wrote:
Hello, I'm trying to have an Android Player receiving a RTSP stream from the internet and play it with very low latency. 
I'm using Tutorial 5 from the GStreamer home. Without any change my stream has a latency about 2 seconds (worst than Vitamio that I was using previously).

With futher investigation we realized we could change the latency to 0 in the pipeline using this code:

****************************************************************
data->pipeline = gst_parse_launch("playbin", &error);
    gst_pipeline_set_latency(data->pipeline,0); //This is what I wrote

    if (error) {
    gchar *message = g_strdup_printf("Unable to build pipeline: %s", error->message);
    g_clear_error (&error);
    set_ui_message(message, data);
    g_free (message);
    return NULL;
  }

****************************************************************

Now the stream is strutting, alas dropping frames. However the stream is faster than the base code.
Based on other questions, I tried to add rtpjitterbuffer into the pipeline but seems that is not that simple.

How can I construct or change the pipeline to have low latency and no strutting?
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-- 
Olivier Crête [hidden email]

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Android is strutting for Real Time Stream

Azure1 Sureale
Hello again.

Tim's solutions have worked great when we were using FFSERVER to re-stream the video.
However we now are implementing GST_RTPS_SERVER and the Android Player is the only one not playing the video. FFPlay, VLC, and a Windows Gstreamer player can all reproduce  the stream that is represented by the uri rtsp://127.0.0.1:8554/test (the FFSERVER uri had a .sdp )

I can see the Android Player requisition on the RTSP Server terminal:

(lt-test-launch:28849): GLib-GObject-WARNING **: g_object_get_valist: object class 'GstIdentity' has no property named 'pt'

But still no playing...

Should I add another parameter to the android player? Or should I change the way the RTSP Server builds the URI?

Thank you.

On Tue, Sep 26, 2017 at 10:28 AM, Olivier Crête <[hidden email]> wrote:
Hi,

The two seconds are from rtspsrc, you can set the "latency" property to something reasonable like 200ms by connecting to the "source-setup" signal on playbin and setting the latency property to 200 if it's rtspsrc.

You can verify the automatically calculated latency by setting GST_DEBUG=bin:4

Setting the pipeline latency manually will indeed produce problems if you set a lower value than the minimal one.

Olivier

On Wed, 2017-09-20 at 14:13 -0300, Azure1 Sureale wrote:
Hello, I'm trying to have an Android Player receiving a RTSP stream from the internet and play it with very low latency. 
I'm using Tutorial 5 from the GStreamer home. Without any change my stream has a latency about 2 seconds (worst than Vitamio that I was using previously).

With futher investigation we realized we could change the latency to 0 in the pipeline using this code:

****************************************************************
data->pipeline = gst_parse_launch("playbin", &error);
    gst_pipeline_set_latency(data->pipeline,0); //This is what I wrote

    if (error) {
    gchar *message = g_strdup_printf("Unable to build pipeline: %s", error->message);
    g_clear_error (&error);
    set_ui_message(message, data);
    g_free (message);
    return NULL;
  }

****************************************************************

Now the stream is strutting, alas dropping frames. However the stream is faster than the base code.
Based on other questions, I tried to add rtpjitterbuffer into the pipeline but seems that is not that simple.

How can I construct or change the pipeline to have low latency and no strutting?
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-- 
Olivier Crête [hidden email]

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



_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Android is strutting for Real Time Stream

Nicolas Dufresne-5
In reply to this post by Azure1 Sureale
Le mercredi 20 septembre 2017 à 14:13 -0300, Azure1 Sureale a écrit :
> Hello, I'm trying to have an Android Player receiving a RTSP stream
> from the internet and play it with very low latency.
> I'm using Tutorial 5 from the GStreamer home. Without any change my
> stream has a latency about 2 seconds (worst than Vitamio that I was
> using previously).

This is the default configuration on rtpsrc. Connect to "source-setup"
signal on playbin, and then setup a lower latency. Here's a code
snipet:

static void
source_setup_cb (GstElement *playbin, GstElement *source, gpointer
user_data)
{
  if (g_str_equal ("GstRTSPSrc", g_type_name (source)))
    g_object_set (source, "latency", 50, NULL); /* in ms */
}

{
  ...
  g_signal_connect (pipeline, "source-setup", G_CALLBACK (source_setup_cb), NULL, NULL);
  ...
}



> With futher investigation we realized we could change the latency to
> 0 in the pipeline using this code:
>
> ****************************************************************
> data->pipeline = gst_parse_launch("playbin", &error);
>     gst_pipeline_set_latency(data->pipeline,0); //This is what I
> wrote

That's won't work, since you'll have to display the frame before you
even have started decoding them, it make no sense. It's better to
configure the element, and let the normal latency workflow run.

>
>     if (error) {
>     gchar *message = g_strdup_printf("Unable to build pipeline: %s",
> error->message);
>     g_clear_error (&error);
>     set_ui_message(message, data);
>     g_free (message);
>     return NULL;
>   }
>
> ****************************************************************
>
> Now the stream is strutting, alas dropping frames. However the stream
> is faster than the base code.
> Based on other questions, I tried to add rtpjitterbuffer into the
> pipeline but seems that is not that simple.
>
> How can I construct or change the pipeline to have low latency and no
> strutting?
The configuration depends on your network, GStreamer don't implement
dynamic latency, though you may implement it yourself by warning QoS
event about dropped frame (to detect too low latency) and do some
adjustment.

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

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

Re: Android is strutting for Real Time Stream

Azure1 Sureale
Thank you Nicolas. Tim has given a similar solution last week.

We are now facing a new problem. We moved from ffserver to gst-rtps-server. I explained the issue in a previous email.

On Thu, Sep 28, 2017 at 2:39 PM, Nicolas Dufresne <[hidden email]> wrote:
Le mercredi 20 septembre 2017 à 14:13 -0300, Azure1 Sureale a écrit :
> Hello, I'm trying to have an Android Player receiving a RTSP stream
> from the internet and play it with very low latency.
> I'm using Tutorial 5 from the GStreamer home. Without any change my
> stream has a latency about 2 seconds (worst than Vitamio that I was
> using previously).

This is the default configuration on rtpsrc. Connect to "source-setup"
signal on playbin, and then setup a lower latency. Here's a code
snipet:

static void
source_setup_cb (GstElement *playbin, GstElement *source, gpointer
user_data)
{
  if (g_str_equal ("GstRTSPSrc", g_type_name (source)))
    g_object_set (source, "latency", 50, NULL); /* in ms */
}

{
  ...
  g_signal_connect (pipeline, "source-setup", G_CALLBACK (source_setup_cb), NULL, NULL);
  ...
}



> With futher investigation we realized we could change the latency to
> 0 in the pipeline using this code:
>
> ****************************************************************
> data->pipeline = gst_parse_launch("playbin", &error);
>     gst_pipeline_set_latency(data->pipeline,0); //This is what I
> wrote

That's won't work, since you'll have to display the frame before you
even have started decoding them, it make no sense. It's better to
configure the element, and let the normal latency workflow run.

>
>     if (error) {
>     gchar *message = g_strdup_printf("Unable to build pipeline: %s",
> error->message);
>     g_clear_error (&error);
>     set_ui_message(message, data);
>     g_free (message);
>     return NULL;
>   }
>
> ****************************************************************
>
> Now the stream is strutting, alas dropping frames. However the stream
> is faster than the base code.
> Based on other questions, I tried to add rtpjitterbuffer into the
> pipeline but seems that is not that simple.
>
> How can I construct or change the pipeline to have low latency and no
> strutting?

The configuration depends on your network, GStreamer don't implement
dynamic latency, though you may implement it yourself by warning QoS
event about dropped frame (to detect too low latency) and do some
adjustment.

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

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



_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Android is strutting for Real Time Stream

Nicolas Dufresne-5
I notice afterward. Would be nice to avoid cross-post over multiple mailing list.

Nicolas

Le 29 sept. 2017 11:54 AM, "Azure1 Sureale" <[hidden email]> a écrit :
Thank you Nicolas. Tim has given a similar solution last week.

We are now facing a new problem. We moved from ffserver to gst-rtps-server. I explained the issue in a previous email.

On Thu, Sep 28, 2017 at 2:39 PM, Nicolas Dufresne <[hidden email]> wrote:
Le mercredi 20 septembre 2017 à 14:13 -0300, Azure1 Sureale a écrit :
> Hello, I'm trying to have an Android Player receiving a RTSP stream
> from the internet and play it with very low latency.
> I'm using Tutorial 5 from the GStreamer home. Without any change my
> stream has a latency about 2 seconds (worst than Vitamio that I was
> using previously).

This is the default configuration on rtpsrc. Connect to "source-setup"
signal on playbin, and then setup a lower latency. Here's a code
snipet:

static void
source_setup_cb (GstElement *playbin, GstElement *source, gpointer
user_data)
{
  if (g_str_equal ("GstRTSPSrc", g_type_name (source)))
    g_object_set (source, "latency", 50, NULL); /* in ms */
}

{
  ...
  g_signal_connect (pipeline, "source-setup", G_CALLBACK (source_setup_cb), NULL, NULL);
  ...
}



> With futher investigation we realized we could change the latency to
> 0 in the pipeline using this code:
>
> ****************************************************************
> data->pipeline = gst_parse_launch("playbin", &error);
>     gst_pipeline_set_latency(data->pipeline,0); //This is what I
> wrote

That's won't work, since you'll have to display the frame before you
even have started decoding them, it make no sense. It's better to
configure the element, and let the normal latency workflow run.

>
>     if (error) {
>     gchar *message = g_strdup_printf("Unable to build pipeline: %s",
> error->message);
>     g_clear_error (&error);
>     set_ui_message(message, data);
>     g_free (message);
>     return NULL;
>   }
>
> ****************************************************************
>
> Now the stream is strutting, alas dropping frames. However the stream
> is faster than the base code.
> Based on other questions, I tried to add rtpjitterbuffer into the
> pipeline but seems that is not that simple.
>
> How can I construct or change the pipeline to have low latency and no
> strutting?

The configuration depends on your network, GStreamer don't implement
dynamic latency, though you may implement it yourself by warning QoS
event about dropped frame (to detect too low latency) and do some
adjustment.

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

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



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


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