• Miguel Casas-Sanchez's avatar
    Reland: simplify VaapiPictureFactory::Create() method and VaapiPicture members · b70d8c27
    Miguel Casas-Sanchez authored
    This CL is a reland of crrev.com/c/1079834 and crrev.com/c/1086131
    that got reverted (the second is just adding a few forgotten DCHECKs).
    This is because  GpuArcVideoDecodeAccelerator sends empty client and
    texture id vectors [0]; this CL handles gracefully these cases.
    
    [0] https://cs.chromium.org/chromium/src/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.cc?l=468
    
    original cl description ------------------------------------------------
    
    This CL moves part of the logic of VaapiPicture creation from VaVDA to
    VaapiPictureFactory, passing the PictureBuffer wholesale since we use
    most of it anyway.  The net result is less lines of code.
    
    VaapiPicture and derived classes hold on to a |texture_id_| and a
    |client_texture_id_|, the latter only used with |bind_image_cb_|:
    - |texture_id_| cannot be zero, either in the tests or in reality, because
      is a GL texture id; this CL enforces this via a DCHECK() in ctor. That
      simplifies the body a few methods.
    - |client_texture_id_| can be zero, and is always zero in the v_d_a_unittests,
      but it doesn't matter because |bind_image_cb_| is dummy for tests ([1]),
      so there's no point of enforcing it to be non zero.  Moreover, since
      it's a client-side texture id, it can be any number, so let's skip
      the confusing checks.
    
    Sprinkled a couple of consts and also, there's no need to do
    !callback.is_null() because CallbackBase provides bool(), so
    s/!callback.is_null()/callback/
    
    [1] https://cs.chromium.org/chromium/src/media/gpu/video_decode_accelerator_unittest.cc?sq=package:chromium&dr&g=0&l=452
    
    Bug: 822346
    Test: compiled+run simplechrome, v_d_a_unittests on eve. media_unittests.
    Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
    Change-Id: I8b211d97e6bcb3f86149224a1c130ca6a24984e8
    Reviewed-on: https://chromium-review.googlesource.com/1100535Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
    Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
    Commit-Queue: Miguel Casas <mcasas@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#567293}
    b70d8c27
video_decode_accelerator_unittest.cc 63.2 KB