• Christopher Cameron's avatar
    Fix grey bar when viewing local capture in Google Meet · e3e055a5
    Christopher Cameron authored
    Meet gives an option to request video quality of 360. Not all cameras
    will natively return a height-360 size, so Chrome will go with the
    next-biggest capture size, and letterbox-and-scale the video frame.
    
    On the machine where I reproduced this, the media::VideoFrame had the
    following attributes.
    - visible_rect:0,60 640x360
    - natural_size:640x360
    - coded_size:640x480
    
    This exposed the following bug in the combination of the functions
    VideoResourceUpdater::CreateForSoftwarePlanes and
    PaintCanvasVideoRenderer::Copy.
    * The function VideoResourceUpdater::CreateForSoftwarePlanes creates a
      resource of size |coded_size|, and expects that
      PaintCanvasVideoRenderer::Copy will populate the |visible_rect|
      sub-rectangle of that resource.
    * PaintCanvasVideoRenderer::Copy actually copies not to |visible_rect|,
      but rather to rectangle at (0,0) that has the size of |visible_rect|.
    
    The consequence is that we end up viewing the resource through a
    misaligned letterbox.
    
    The fix is is to inline PaintCanvasVideoRenderer::Copy (which is only a
    few lines long) in VideoResourceUpdater::CreateForSoftwarePlanes, and
    specify the correct destination rectangle.
    
    Also add some comments to clarify the function's behavior. Note that
    this behavior was switched in crrev.com/545920.
    
    Bug: 1090435
    Change-Id: Icef81728defc0cf46b35180dada5d68f24e6b21d
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2318313
    Auto-Submit: ccameron <ccameron@chromium.org>
    Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
    Commit-Queue: ccameron <ccameron@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#791480}
    e3e055a5
paint_canvas_video_renderer.h 11.4 KB