Only optimize background video after a timeout.

After some further testing, I concur that it's super annoying for
background tab optimizations to kick in and out if you happen to
be moving between tabs relatively frequently. Say for watching a
live stream, it may take a second or so to resume even though you
just left that tab.

As such, impose a 10s delay before background "disable track"
optimizations. Pause optimizations are left in place since pause
w/o suspend is expected to be very low cost for resume.

Additionally if we add this deferred timeout we eliminate part of
the reason we didn't ship this feature for src=. It's not possible
to trigger track changes fast enough that we will lose av sync.
Unfortunately src= track changes still work by returning the next
keyframe, which may be up to 5s ahead which is too far, so we still
can't enable until http://crbug.com/709302 is fixed.

BUG=678663,752726
TEST=manually verify that bg opts don't occur until after 10s.

Change-Id: I8cc4b81bbc91bd9a1f0777dd137d9c2940325e86
Reviewed-on: https://chromium-review.googlesource.com/607154
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Dan Sanders <sandersd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#493122}
2 files changed