• Mina Almasry's avatar
    [Chromecast] Improve AV sync at playback start · 8eac30f5
    Mina Almasry authored
    A number of changes to improve AV sync at playback start:
    
    - AvSync now will not perform corrections if it measures a slope that is
    way off from what it expects. There are a number of reasons this could
    happen:
      - Samples measured right after resuming playback may be from the
      paused state, which messes with the measured slope. This is especially
      important given our current interaction with the
      BufferingController...
      - Some vendor video decoder implementations will play video at an
      accelerated rate if they are not able to start playback in time, to
      'catch up' to the required value, and then resume normally. We need to
      ignore this behavior in AvSync.
    
    - Modify the initialization of AvSync a bit to treat Start/Stop similar
    to Pause/Resume. From the prespective of AvSync these should be
    identical calls, and should maybe be combined to one in the future.
    Also, due to the interaction with BufferingController, Start is actually
    Start + Pause + Resume, so we need to treat Resume as we do for Start,
    because the start of playback is actually the first Resume.
    
    - For AvSync to compare the slope to an expected case, it needs to know
    the current rate of playback, so add code from MediaPipelineBackend to
    notify AvSync of playback rate changes.
      - As a bonus, the playback rate change is handled a bit better now.
      It's not perfect, but this is the first time I'm testing it as it
      seems no app supports it.
    
    - Add ability for linear regression to dump its samples. This is very
    useful for debugging unexpected slope calculations. This was very useful
    to root cause the issue.
    
    Bug: b/110481225
    Test: Manual
    
    Change-Id: I28ffa83c633446f2441ff5dfb8d5674b5e149ea5
    Reviewed-on: https://chromium-review.googlesource.com/1132518Reviewed-by: default avatarSergey Volk <servolk@chromium.org>
    Reviewed-by: default avatarKenneth MacKay <kmackay@chromium.org>
    Commit-Queue: Mina Almasry <almasrymina@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#575130}
    8eac30f5
av_sync_video.cc 16.8 KB