• Chih-Yu Huang's avatar
    media/gpu/v4l2: Fix V4L2ImageProcessor Reset(). · 570aee6f
    Chih-Yu Huang authored
    Currently, in Reset() we only call TryCancelAll() on the client
    sequence to cancel tasks on device sequence. However, TryCancelAll()
    cancels tasks in a best-effort, meaning a few tasks on device sequence
    can still run. The tasks posts new tasks to the client sequence.
    Therefore, V4L2ImageProcessor might still return previous frames after
    Reset() is called.
    
    In this CL, we have these changes:
    1. Post additional task ResetTask() to device sequence after
       cancelling previous tasks.
    2. Clear |running_jobs_| at ResetTask(), and check the dequeued buffer
       id at Dequeue(). Only return the buffers at |running_jobs_|.
    3. Invalidate WeakPtr of the client sequence to cancel pending tasks
       on the client sequence.
    
    With 1. and 2., we could guarantee that after ResetTask(), we don't
    post task to |client_task_runner_| for returning frames. With 3., we
    could guarantee the tasks on |client_task_runner_| posted by the tasks
    on |device_task_runner_| prior to ResetTask() are cancelled.
    
    Bug: 1004727
    Test: Run video_decode_accelerator_tests on Kukui and Hana
    Test: Run video_encode_accelerator_unittest on Kukui and Hana
    
    Change-Id: Ic2f8084f7e7658488dac9e7d39b0f22be347795e
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1906858
    Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
    Reviewed-by: default avatarAlexandre Courbot <acourbot@chromium.org>
    Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#715612}
    570aee6f
v4l2_image_processor.h 8.22 KB