[Bug 767105] New: timeoverlay: Add time-line property options "clock-time" and "render-time"

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Wed Jun 1 11:58:14 UTC 2016


https://bugzilla.gnome.org/show_bug.cgi?id=767105

            Bug ID: 767105
           Summary: timeoverlay: Add time-line property options
                    "clock-time" and "render-time"
    Classification: Platform
           Product: GStreamer
           Version: git master
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gst-plugins-base
          Assignee: gstreamer-bugs at lists.freedesktop.org
          Reporter: gnome at williammanley.net
        QA Contact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---

Created attachment 328880
  --> https://bugzilla.gnome.org/attachment.cgi?id=328880&action=edit
patch 1/3

timeoverlay: Add time-line property options "clock-time" and "render-time"

These are useful for debugging and latency measurements:

* clock-time is the time on the `GstPipeline` clock.
* render-time is the clock time at which the frame will actually be
  displayed taking into account the latency of the pipeline.  This is
  relevant for live pipelines.

My use-case for this is measuring the latency of video-capture devices and
TVs.  By using a `GstSystemClock` with a `CLOCK_REALTIME` clock running on
a Raspberry Pi I'm hoping to take latency measurements.

I couldn't think of a way to create an automated test for this without
introducing a bunch of unacceptable dependencies (in stb-tester we would use
OCR), so I've tested manually with the below program:

    int main(int argc, char* argv[])
    {
      GstElement * epipeline;
      GstPipeline * pipeline;
      GstClock* clock;
      struct timespec ts;
      int res;

      gst_init(&argc, &argv);

      epipeline = gst_parse_launch(
          "videotestsrc is-live=true pattern=white "
          "! video/x-raw,width=1280,height=720 "
          "! timeoverlay time-mode=render-time "
          "! timeoverlay deltay=30 time-mode=clock-time "
          "! xvimagesink", NULL);

      g_return_val_if_fail (epipeline != NULL, 1);
      pipeline = GST_PIPELINE(epipeline);

      gst_element_set_state(epipeline, GST_STATE_READY);

      clock = g_object_new (GST_TYPE_SYSTEM_CLOCK, "clock-type",
          GST_CLOCK_TYPE_REALTIME, NULL);
      gst_pipeline_use_clock(pipeline, clock);
      gst_pipeline_set_latency(pipeline, GST_SECOND);

      res = clock_gettime(CLOCK_REALTIME, &ts);
      g_return_val_if_fail (res == 0, 1);

      printf("Start time: %i:%02i:%02i.%03i\n", ts.tv_sec / 60 / 60,
          ts.tv_sec / 60 % 60, ts.tv_sec % 60, ts.tv_nsec / 1000000);
      gst_element_set_state(epipeline, GST_STATE_PLAYING);

      usleep(30*1000000);
      gst_element_set_state(epipeline, GST_STATE_NULL);
    }

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list