timeoverlay: Add time-line property options "clock-time" and "render-time"
Submitted by Will Manley
Link to original bug (#767105)
Description
Created attachment 328880
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);
}
Patch 328880, "patch 1/3":
0001-basetextoverlay-Add-src_event-vmethod.patch