media/gpu/v4l2: add V4L2Device poller class
Each of the V4L2 decoder/encoder classes reimplement the same polling mechanism, where a dedicated thread is used to poll() an open V4L2 device and signal the decoder/encoder thread when a buffer or event is ready to be dequeued. This adds considerable amounts of code to each of these classes and complicates them. This CL replicates the polling feature into a dedicated class that is self-contained, properly documented, and easy to understand. This class is not intended to be used directly: instead, V4L2Device now has an EnablePolling() method that will invoke a callback on the client's sequence whenever an event or buffer is ready. This approach considerably simplifies the client's code, which on top of not having to reimplement the polling functionality, also doesn't need to guess when it should schedule polling: V4L2Device has all the information it needs to make this decision when queueing or dequeueing a buffer. Bug: 1003223 Test: vdatests passing on Kevin. Change-Id: I6b8619a89132c34c7424d83613c7681aedfc46ff Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1799652 Commit-Queue: Alexandre Courbot <acourbot@chromium.org> Reviewed-by:Chih-Yu Huang <akahuang@chromium.org> Reviewed-by:
Hirokazu Honda <hiroh@chromium.org> Cr-Commit-Position: refs/heads/master@{#700122}
Showing
Please register or sign in to comment