Loop until we find a frame with a good viewport or until we run out of retries. (#1668)
Loop until we find a frame with a good viewport or until we run out of retries. (#1668)

This patch fixes an issue that occurs when the first frame in the video is not a solid color (e.g. a webpage is shown). In those cases, the viewport width and height end up as 0 because the colors are not similar (between the middle and edge).

With this patch, we run through up to the first 5 (by default) frames until we find a good viewport. If none can be found, then we log an exception. The maximum number of frames to check can be modified with --viewportretries X. Setting X to 1 will give the same behaviour as we had prior to this patch. The minimum width/height can also be specified (by default, these are set to 0).
sitespeedio/browsertime,sitespeedio/browsertime,sitespeedio/browsertime,sitespeedio/browsertime