You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
os-autoinst/1059.patch

65 lines
2.4 KiB

From 5e7d1ec0f6aa3e1627bd4ee959d8470dea2159d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Wed, 7 Nov 2018 21:17:01 +0100
Subject: [PATCH] Use video captions to overlay wallclock time
Although durations and absolute time can be somewhat derived using the
framerate (it is captured with nominally 2 fps), this is cumbersome and
not always correct. There are occasional frame drops due to stalls or long
running screen matches, especially on e.g. aarch64.
Create a caption file which shows the same time stamps as the autoinst.log,
these can be overlaid over the actual video.
See poo#42050 for details.
---
backend/baseclass.pm | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/backend/baseclass.pm b/backend/baseclass.pm
index f1e4ed0ad..1330594a8 100644
--- a/backend/baseclass.pm
+++ b/backend/baseclass.pm
@@ -307,6 +307,9 @@ sub start_encoder {
$self->{encoder_pipe}->blocking(0);
+ open($self->{vtt_caption_file}, '>', "$cwd/video_time.vtt");
+ $self->{vtt_caption_file}->print("WEBVTT\n");
+
return;
}
@@ -404,6 +407,22 @@ sub cpu_stat {
return [];
}
+sub format_vtt_timestamp {
+ my ($self, $walltime) = @_;
+
+ my $frametime_ms = 1000 * $self->{video_frame_number} / 24;
+ my $caption = "\n$self->{video_frame_number}\n";
+ # presentation time span (one frame)
+ $caption .= sprintf(POSIX::strftime("%T.%%03d", gmtime($frametime_ms / 1000)), $frametime_ms % 1000);
+ $frametime_ms += 1000 / 24;
+ $caption .= " --> ";
+ $caption .= sprintf(POSIX::strftime("%T.%%03d\n", gmtime($frametime_ms / 1000)), $frametime_ms % 1000);
+ # clock value as caption text
+ $caption .= sprintf(POSIX::strftime("[%FT%T.%%03d]\n", localtime($walltime)), 1000 * ($walltime - int($walltime)));
+
+ return $caption;
+}
+
sub enqueue_screenshot {
my ($self, $image) = @_;
@@ -427,6 +446,8 @@ sub enqueue_screenshot {
$self->{min_video_similarity} -= 1;
$self->{min_video_similarity} = $sim if $sim < $self->{min_video_similarity};
+ $self->{vtt_caption_file}->print($self->format_vtt_timestamp(gettimeofday));
+
# we have two different similarity levels - one (slightly higher value, based
# t/data/user-settings-*) to determine if it's worth it to recheck needles
# and one (slightly lower as less significant) determining if we write the frame