• Andres Calderon Jaramillo's avatar
    VdaVD: Advertise a VideoFrame's visible size as the coded size. · 43a49df1
    Andres Calderon Jaramillo authored
    Problem:
    
    CL:2010243 made it so that the GL image for a video frame is created
    using the visible size. This is correct because we want to make sure
    that when we composite, we don't sample padding (which would result in
    unwelcome green lines). However, the coded size of the video frame sent
    to the client still contained the non-visible area. This caused
    PaintCanvasVideoRenderer to sometimes issue GL commands with dimensions
    exceeding those of the GL image backing the texture. These commands
    would subsequently fail validation resulting in the associated video
    frame not being rendered on the canvas.
    
    Solution:
    
    This CL is a generalization of CL:2056285 which solved the same problem
    but for the VA-API video decode accelerator. The essence of the solution
    here is to override ProvidePictureBuffersWithVisibleRect() in
    VdaVideoDecoder. That way, we end up creating the outgoing video frame
    with a coded size equal to the visible size solving the problem above.
    
    Note that there's one caveat: there is an unusual corner case where an
    H.264 video includes information about a visible rectangle whose origin
    is not at (0, 0). Therefore some of the top and left parts of the video
    should not be displayed. However, Chrome does not currently deal well
    with this case. This CL does not make that situation better, but this
    could be addressed in a follow-up CL considering that it's a rare case.
    
    I tested across many boards. To see the test cases and screenshots of
    the results, see [1] (a d08cb982 in the filename represents the base
    commit before this CL).
    
    [1] https://drive.google.com/open?id=1h94xbzNLBrlHBlbmaaasHV1P7HOaPBt1
    
    Bug: 1062002
    Test: video in bug gets rendered to canvas in kevin successfully.
    Change-Id: I6daf9df07c8588d82d5396908d8f91c92ce3984d
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2122484
    Commit-Queue: Andres Calderon Jaramillo <andrescj@chromium.org>
    Reviewed-by: default avatarAlexandre Courbot <acourbot@chromium.org>
    Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#754840}
    43a49df1
vda_video_decoder.cc 29.6 KB