stbt.Display: Add clock on each frame's left top corner

While recording a video with this commit there will be visible clock
on left top corner. Clock displays time when given frame was
processed. In addition when calling a function 'press' we will draw not
only an information that button was pressed but as well time when it was
pressed. This should provide accurate information that will let us find
relation between actions registered in logs and what happened on screen.
stbt.py: Change video text font to HERSHEY_DUPLEX

I'm convinced that this font looks a lot better. At least it doesn't
look like a headline in a traditional newspaper.
Merge branch 'add-clock-to-each-frame' into stbt-0.18-youview
stbt.py: Stop sink pipeline while the source pipeline is restarting

The VidiU capture device restarts its encoder every time the video
resolution changes. It results in an EOS message sent to the source bus
that triggers restarting the source pipeline, as implemented in
6b7ba0a3.

However, if the video saving pipeline is active (--save-video option),
the tests fail with one of the following errors:
1. GStreamer raises a general stream error: "streaming task paused,
   reason not-negotiated (-4)".
2. No EOS message is sent after an encoder restart, therefore the source
   pipeline never gets restarted, and the test hangs forever or times
   out with NoVideo.

If we stop video encoding when the source pipeline sends the EOS
message, and don't restart it until the source pipeline is successfully
restarted, we can avoid the above failures.

Note that it's not enough to set the sink pipeline to STATE_PAUSED.
When we restart video recording, the video encoder raises an error
because video timestamps are getting inconsistent after a source
pipeline restart. We have to restart the encoder in order to
successfully resume video recording; we simply append the new video
stream to the existing video file.

This fix has a side-effect with xvimagesink. As the entire sink pipeline
is stopped during source pipeline restart, the video output window gets
closed for this duration. However as we don't see any video during
pipeline restart anyway, only a black or blue screen, it's not a
blocking issue.
stbt.py: Create a new video file each time video recording is restarted

The previous commit modified stbt.py to restart the source pipeline
every time the source pipeline is restarted. It required us to use
filesink in "append" mode to avoid overwriting the video file after each
restart.

Unfortunately the video saved this way is not seekable. A workaround
for this issue is to save video to a new file after every video encoder
restart. The resulting files are all error-free and seekable.

Running
    stbt run --save-video video.webm test.py
with a test that involves 2 source pipeline restarts will create
3 files: video.webm, video1.webm and video2.webm.
stbt.py: Make decodebin2 handle asynchronous state changes

Even with the fix "Stop sink pipeline while the source pipeline is
restarting", we get occasional GStreamer errors during source pipeline
restarts. decodebin2 raises "The stream is of a different type than
handled by this element.: No valid frames found before end of stream".

The solution is to set the "async-handling" parameter of decodebin2 to
true. As decodebin2 is in the user-defined source pipeline, we have to
check whether this element exists and set the parameter dynamically.
stbt.py: Avoid race condition in restarting source pipeline

stb-tester doesn't restart the source pipeline immediately after
receiving an EOS message; it starts a 5-second timer. However, if it
receives another EOS message from the source bus within 5 seconds, it
has two competing restart procedures.

As the first procedure deletes the source pipeline (sets it to None),
the second one raises "AttributeError: 'NoneType' object has no
attribute 'set_state'". This error is not raised in the main thread and
therefore it has no effect, but it's confusing to see in the log file.
stbt.py: Do not keep empty video files

The commit "Create a new video file each time video recording is
restarted" modified the save video functionality to create a new video
file every time the video encoder is restarted to avoid having corrupted
video files.

The video encoder is restarted every time the source pipeline is
successfully restarted. During a VidiU encoder restart the source
pipeline gets restarted multiple times successfully even though we don't
receive any data, resulting in multiple empty video files.

Discard the empty video files during the next encoder restart.
Merge branch 'vidiu-fixes-0.18' into stbt-0.18-youview