Fix MSE GC, make it less aggressive, more spec-compliant

There are a few a problems with current MSE Garbage Collection (GC from
now on):
1. It doesn't take into account current media_time as MSE spec requires
(https://codereview.chromium.org/341083004/ was supposed to fix that,
but it was never merged).  The MSE spec clearly mentions what should be
the state of the media element based on the buffered ranges (see MSE
spec 2.4.4 SourceBuffer Monitoring).  Since there is a latency between
the read position in the source buffer stream and the playback position,
the MSE garbage collection must be adjusted so as to not remove the
playback position from the buffered ranges.

2. It is too aggressive, i.e. sometimes it throws away chunks of data
from SourceBufferStream that have not been read from DemuxerStream yet,
have not been consumed by the media pipeline and many apps don't expect
that appended data will be thrown away prematurely, so they don't
attempt to fill in the gaps created by throwing away data (see
crbug.com/421694).

This CL fixes those issues by:
1. Making GC algorithm (SourceBufferStream::GarbageCollectIfNeeded)
callable from blink level via WebSourceBuffer::evictCodedFrames/
ChunkDemuxer::EvictCodedFrames.
This will allow blink to initiate GC from outside of append loop as
discussed in CL 341083004 and will allow blink to know that GC has
failed to evict enough data and throw QuotaExceededErr in that case as
prescribed by MSE spec (see step #6 in section 3.5.4 of
https://w3c.github.io/media-source/).  Related CL for blink:
https://codereview.chromium.org/1013923002/

2. Passing HTMLMediaElement::currentTime from blink level into
ChunkDemuxer::EvictCodedFrames and into MSE GC algorithm. The GC
algorithm is adjusted to stop throwing away data when the current
playback position is reached.

3. Making the GC algorithm stop when freeing data from the back of
MSE SourceBuffer and when reaching the last append position.

BUG=421694,440173,474806

Review URL: https://codereview.chromium.org/1008463002

Cr-Commit-Position: refs/heads/master@{#344908}
9 files changed