Different performance of same gstreamer pipeline on LInux/WIndows/Osx

Torstein Dybdahl torstein.dybdahl at fxitech.com
Mon Oct 17 06:05:39 PDT 2011


Dear gstream list members,

Is there known performance problems with displaying h264 vidoes with
variable frame rate on OS X?
With the same gstreamer pipeline we are experiencing different performance
on windows, linux and os x. We are experiencing latency problems using both
glimagesink and osxvideosink on OS X. (Following below is a description of
the system)

Our company is developing a device which is producing a h264 video stream
with variable framerate(10-100fps) and fixed bit rate. The requirement is
for a low latency system, where the video decode needs to be as fast and
with lowest possible latency.

We are using Gstreamer for decode and display the decoded video data on
Linux, windows and mac os x.
The whole application is written in QT, the code base is share for the
windows, linux and mac platform. Only OS specific part is the

On Linux and windows there is non noticeable latency for decode and
displaying of the image regardless of fps.

On OSX the gstreamer pipeline instroduces 1-5 seconds of image latency. It
seams that the gstreamer pipeline is not able to cope with the variable
framerate stream. The effect is more visible with periods with high
framerate. (40-80fps)  The decoder becomes more and more unsynchronized to
the data provided by the video source when displaying periods with high
frame rates, when returning to low framerates  (less than 20fps) the delay
is again back to 1-2 seconds.

The Linux pipeline is a following:

appsrc->h264parse->ffdec_h264->videoflip->xvimagesink
(ubuntu 11.04)

Windows pipeline is following:
appsrc->h264parse->ffdec_h264->ffmpegcolorspace->directdrawsink
(windows vista)

Mac osx pipeline is following:
appsrc->h264parse->ffdec_h264->colorspace->osxvideosink
(OS X 10.6, gstreamer from macports)
(there is similar problem and performance with the glimagesink)

Attached is the code for the init and setup of the various streams.

Regards
Torstein Dybdahl
Fxi Technologies AS


---------
#ifdef WIN32
void SlaveView::initGStreamerAVC() {
  printf ("Init gstreamer for AVC (h264)\n");

  gst_init (NULL, NULL);

  pipeline = gst_pipeline_new ("mpeg");
  source   = gst_element_factory_make ("appsrc", "app-source");
  demux  = gst_element_factory_make ("h264parse", "demuxer");
  decoder  = gst_element_factory_make ("ffdec_h264", "decoder");
  color    = gst_element_factory_make ("ffmpegcolorspace", "color");
  sink     = gst_element_factory_make ("directdrawsink", "ddraw");

  if (!pipeline || !source || !demux || !decoder || !color || !sink) {
    g_printerr ("An element could not be created. Exiting.\n");
    exit (1);
  }

  gst_bin_add_many (GST_BIN (pipeline),
                    source, demux, decoder, color, sink, NULL);

  // link elements
  gst_element_link (source, demux);
  gst_element_link (demux, decoder);
  gst_element_link (decoder, color);
  gst_element_link (color, sink);

  // element parameters
  g_object_set (G_OBJECT (sink),
                "qos", (gboolean)false,
                "sync", (gboolean)false,
"max-lateness", (gint)-1,
                NULL);

  // qt overlay
  gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink),
GPOINTER_TO_INT(winId()));

  // start pipeline
  gst_element_set_state (pipeline, GST_STATE_PLAYING);
}
#elif __APPLE__
void SlaveView::initGStreamerAVC() {
  printf ("Init gstreamer for AVC (h264)\n");

  gst_init (NULL, NULL);

  pipeline = gst_pipeline_new ("mpeg");
  source   = gst_element_factory_make ("appsrc", "app-source");
  demux    = gst_element_factory_make ("h264parse", "demuxer");
  decoder  = gst_element_factory_make ("ffdec_h264", "decoder");
  color    = gst_element_factory_make ("colorspace", "color");
  sink     = gst_element_factory_make ("osxvideosink", "embed");
  if (!pipeline || !source || !demux || !decoder || !color || !sink) {
    g_printerr ("An element could not be created. Exiting.\n");
    exit (1);
  }

  // element parameters
  g_object_set (G_OBJECT (sink),
                "qos", (gboolean)false,
                "sync", (gboolean)false,
  //              "embed", (gboolean)true,
                "max-lateness", (gint)-1,
  //              "framerate" , (gint) 50,
                NULL);

  g_object_set (G_OBJECT (decoder),
                "skip-frame", (gint) 0,
                "direct-rendering", (gboolean)false,
    //            "framerate", (gint) 25,
                NULL);


  // add to pipeline
  gst_bin_add_many (GST_BIN (pipeline),
                    source, demux, decoder, color,sink, NULL);

  // link elements
  gst_element_link (source, demux);
  gst_element_link (demux, decoder);
  gst_element_link (decoder,color);
  gst_element_link (color, sink);

  // qt overlay
  gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), winId());

  // start pipeline
  gst_element_set_state (pipeline, GST_STATE_PLAYING);
}
#else
void SlaveView::initGStreamerAVC() {
  printf ("Init gstreamer for AVC (h264)\n");

  gst_init (NULL, NULL);

  pipeline = gst_pipeline_new ("mpeg");
  source   = gst_element_factory_make ("appsrc", "app-source");
  demux    = gst_element_factory_make ("h264parse", "demuxer");
  decoder  = gst_element_factory_make ("ffdec_h264", "decoder");
  flip    = gst_element_factory_make ("videoflip", "flip");
  sink     = gst_element_factory_make ("xvimagesink", NULL);
  if (!pipeline || !source || !demux || !decoder || !flip || !sink) {
    g_printerr ("An element could not be created. Exiting.\n");
    exit (1);
  }

  // element parameters
  g_object_set (G_OBJECT (sink),
                "qos", (gboolean)false,
                "sync", (gboolean)false,
                NULL);

  g_object_set (G_OBJECT (decoder),
                "direct-rendering", (gboolean)false,
                NULL);

  g_object_set (G_OBJECT (flip),
  "method", (guint)0,
  NULL);

  // add to pipeline
  gst_bin_add_many (GST_BIN (pipeline),
                    source, demux, decoder, flip,sink, NULL);

  // link elements
  gst_element_link (source, demux);
  gst_element_link (demux, decoder);
  gst_element_link (decoder,flip);
  gst_element_link (flip, sink);

  // qt overlay
  gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink),
GPOINTER_TO_INT(winId()));

  // start pipeline
  gst_element_set_state (pipeline, GST_STATE_PLAYING);
}

#endif
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20111017/1d9b98b0/attachment.html>


More information about the gstreamer-devel mailing list