• Dan Sanders's avatar
    [media] Fix video to canvas GPU-CPU race. · 9803c0eb
    Dan Sanders authored
    VideoFrames marked with VideoFrameMetadata::READ_LOCK_FENCES_ENABLED
    must be retained until all reads have been completed. Such frames are
    produced when software frames are uploaded to GpuMemoryBuffers. The
    VideoResourceUpdater handles this, but PaintCanvasVideoRenderer
    implemented only sync tokens.
    
    As a result, WebGL reads of software-decoded frames can tear when the
    storage is reused for later frames.
    
    This CL adds a GL_COMMANDS_COMPLETED_CHROMIUM query after each potential
    VideoFrame read in PaintCanvasVideoRenderer, and retains a reference to
    the VideoFrame until it completes. This ensures that the memory is not
    reused until after the reads complete in the GPU process.
    
    Bug: 819914
    Change-Id: I3e6e5f83cff86beedbd76a406aa31c4eb84a0929
    Reviewed-on: https://chromium-review.googlesource.com/1244835Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
    Reviewed-by: default avatarPavel Feldman <pfeldman@chromium.org>
    Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
    Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
    Commit-Queue: Dan Sanders <sandersd@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#594900}
    9803c0eb
webmediaplayer_ms.cc 41.3 KB