• wolenetz@chromium.org's avatar
    MSE: Populate WebM missing duration with DefaultDuration, derived, or default · cde6f1bc
    wolenetz@chromium.org authored
    This change modifes WebM stream parser to estimate missing WebM frame
    durations using the following logic:
    1) If the frame was a BlockGroup, it should already have a duration. Use
    it. (This is previous behavior; no other WebM frames previously had
    duration.)
    2) If the frame was a SimpleBlock, derive its duration as follows:
    2a) If the frame's TrackEntry had a DefaultDuration, use that value
    capped at a precision no greater than TimeCodes with TimeCodeScale
    applied.
    2b) Otherwise, if there is a subsequent frame in the cluster, set the
    duration to the difference in timestamps.
    2c) Otherwise, use the maximum frame duration for the track encountered
    so far, if any.
    2d) Otherwise, use a hardcoded value.
    Note, 2b-2c, for WebM audio, ideally would be calculated based on the
    track's codebook. This is left for a future CL.
    
    Adds related WebM track parser unit tests. Adjusts
    existing ChunkDemuxerTests, PipelineIntegrationTests, and
    WebMClusterParserTests based on new duration logic.
    
    R=acolwell@chromium.org
    TEST=All media_unittests and http/tests/media layout tests pass locally on Linux
    BUG=351166
    
    Review URL: https://codereview.chromium.org/213253006
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260247 0039d316-1c4b-4281-b951-d872f2087c98
    cde6f1bc
webm_stream_parser.cc 7.8 KB