Fixes for issues with restarting the device under test

A number of fixes for issues that occur when the video stream is restarted or the video resulution changes during a set-top-box restart.

I've validated the fixes by running 2000 iterations of a test that reboots the set-top-box, but more thorough testing with various test scripts is still in progress.

The last two commits (https://github.com/szemate/stb-tester/commit/283bfed226b819abf76558d747140573b297fd1f and https://github.com/szemate/stb-tester/commit/c60415a1dba87250b7831ef3a5ba3b05f9432da7) are alternative solutions for the same problem and I'm not happy with either one; I would be glad if you could propose a better one.