aboutsummaryrefslogtreecommitdiff
path: root/components/V4L2Decoder.cpp
AgeCommit message (Collapse)Author
2021-05-12V4L2Decoder: setup the output pixel format when resolution changeandroid-12.0.0_r32android-12.0.0_r29android-12.0.0_r28android-12.0.0_r27android-12.0.0_r26android-12.0.0_r21android-12.0.0_r20android-12.0.0_r19android-12.0.0_r18android-12.0.0_r16android12-qpr1-releaseandroid12-qpr1-d-s3-releaseandroid12-qpr1-d-s2-releaseandroid12-qpr1-d-s1-releaseandroid12-qpr1-d-releaseandroid12-devChih-Yu Huang
This CL setups the supported pixel format when resolution change. Currently the supported pixel format is flexible 420 format. Bug: 170199771 Test: android.media.cts.AdaptivePlaybackTest Change-Id: Ic1b8f5c23fa5ff14c5dba026e0d927df092a6351
2021-05-12v4l2_codec2: Use Android Size instead of Chrome Size.David Staessens
This CL changes the V4L2 decoder and encoder to use the Android Size structure instead of the one copied from Chrome, the Chrome size.h file is removed. Bug: 155138142 Test: arc.VideoEncodeAccel.h264_192p_i420_vm arc.VideoDecodeAccel.h264_vm Change-Id: I8f63e847d8cf4ffd33621706287a44c93a4864fd
2021-05-12v4l2_codec2: Use Android Rect instead of Chrome Rect.David Staessens
This CL changes the V4L2 decoder and encoder to use the Android rect structure instead of the one copied from Chrome, the Chrome rect.h file is removed. Bug: 155138142 Test: arc.VideoEncodeAccel.h264_192p_i420_vm arc.VideoDecodeAccel.h264_vm Change-Id: Ie581deee6b4b43a27c45e48269a6902526727933
2021-05-12v4l2_codec2: Adapt V4L2 device and V4L2 device poller for Android.David Staessens
This CL reworks the V4L2 device and V4L2 device poller code that was branched from their Chrome counterparts: - Adhere to the Android coding style. - Make use of Android logging mechanisms. - Make use of Android assert macros. Bug: 155138142 Test: arc.VideoEncodeAccel.h264_192p_i420_vm Change-Id: I4842624e7fae9fc3f52d90dc90a5e7c026c63513
2021-03-15V4L2Decoder: print blockId when V4L2 buffer is not availableChih-Yu Huang
Bug: 160110407 Test: m -j32 Change-Id: I6546e851e685eb78e23314d8ad09ad9117fbce6d
2021-03-01V4L2Decoder: adjust the ALOGD log to ALOGVChih-Yu Huang
The logs of V4L2Decoder are too verbose for debug image. This CL adjusts the ALOGD log to ALOGV. Bug: 178665560 Test: m -j32 Change-Id: Id8c94b3e515a43ab90404cc34b9a5ee3e5442469
2021-01-12V4L2Decoder: continue buffer fetching after flushChih-Yu Huang
tryFetchVideoFrame() is used to fetch output buffers from VideoFramePool. It should be triggered after a buffer is fetched. But if there is no free V4L2 slot, then we postpone triggering the method until there is free V4L2 slot (i.e. a buffer is DQBUF from V4L2 output queue). However, when getting flush request, we streamoff V4L2 output queue. All the buffers are dropped, no buffer will be DQBUF from V4L2 output queue. In this case we should trigger tryFetchVideoFrame() after flush request is completed. Bug: 176038223 Test: android.media.cts.DecoderTest#testCodecResetsH264WithoutSurface Change-Id: I59217dbe25592dcc877430263524382b7f9e17d2
2021-01-12V4L2Decoder: destroy previous VideoFramePool before getting new oneChih-Yu Huang
VideoFramePool is used to wrap C2BlockPool and request buffers for V4L2Decoder. When resolution changes, V4L2Decoder creates a new VideoFramePool instance to request buffers with new resolution. Also, C2VdaBqBlockPool is designed to provide buffers with the same resolution. So there only one VideoFramePool could exist at the same time. This CL destroys the previous VideoFramePool before getting the new one, and checks the buffer format passed to C2VdaBqBlockPool::fetchGraphicBlock() is the same as the format requested by requestNewBufferSet(). Also, this CL simplifies the signature of the callback of getting VideoFramePool. Originally we put the returned value at output argument because Chromium callback with WeakPtr doesn't support returned value. But we actually could avoid WeakPtr here because V4L2Decoder is always destroyed before V4L2DecodeComponent. It's safe to use ::base::Unretained(this). Bug: 174287571 Test: android.media.cts.AdaptivePlaybackTest#test{H264,Vp8,Vp9}_* Change-Id: Ib06855e7ccc3db5508a4a3f6403bceedb9b5f59d
2021-01-12C2VdaBqBlockPool: add some verbose log for debuggingChih-Yu Huang
Bug: 160110407 Test: m -j32 Change-Id: If68fa775e2ea88bdbee46d3e6ef7854b5f7fee13
2021-01-12V4L2Decoder: replace ASSERT with normal check in tryFetchVideoFrame()Chih-Yu Huang
The ASSERT check for |mVideoFramePool| might fail if we fail to get a new video frame pool when resolution changes, but ServiceDeviceTask() invokes a new task to tryFetchVideoFrame() prior to resolution changes. To avoid the service crash, this CL replaces the assert to a if statement. Bug: 168557465 Test: pass android.media.cts.AdaptivePlaybackTest#testVP8_adaptiveDrc with related CLs Change-Id: I8c17ba21f3d72fa1518e482dd70657a5f254fe17
2020-09-17V4L2Decoder: Handle V4L2 queue QBUF errorChih-Yu Huang
This CL handles the error when we enqueue buffers to V4L2 queues. Bug: 168557465 Test: pass android.media.cts.AdaptivePlaybackTest#testVP8_eosFlushSeek with related CLs Change-Id: I0e7fc9231e7533ee64d204ed02994f001865b085
2020-09-17V4L2Decoder: Recycle the empty buffer back to V4L2 output queueChih-Yu Huang
If the output buffer dequeued from the V4L2 queue is not used (i.e. bytesUsed is equal to 0), then we could recycle the buffer back to the V4L2 queue. This could save the time of fetching the buffer from the buffer pool. Bug: 168557465 Test: pass android.media.cts.AdaptivePlaybackTest#testVP8_eosFlushSeek with related CLs Change-Id: I68a2aa620a6ddc9e1994b37113d07695988a71c8
2020-09-15V4L2Decoder: do not stop fetching output buffers on drain or flushChih-Yu Huang
Originally we stop fetching output buffers when drain or flush is finished, and resume fetching when getting resolution change event. But the V4L2 driver might not send the event after drain or flush. This CL changes not to stop fetching output buffers after drain or flush. Bug: 168557465 Test: Pass android.media.cts.AdaptivePlaybackTest#testVP8_eosFlushSeek with related CLs Change-Id: I389b85c1718ae82933329a10fe09ca6abbb57f5d
2020-09-15V4L2Decoder: streamon V4L2 output queue in Flush()Chih-Yu Huang
Originally we streamoff both input and output queue when Flush() is called. We expect the V4L2 driver will send the resolution change event after the playback resumes. Then the output queue will be streamon again. However, the driver might not send the event if the resumed playback has the same resolution. In this case, the output queue won't be streamon and the playback is stuck. This CL streamons the output queue immediately after the output queue is streamoff. Bug: 168557465 Test: Pass android.media.cts.AdaptivePlaybackTest#testVP8_eosFlushSeek with related CLs Change-Id: I0e3f0bd6445150ed9df2a30aac8ff692ec626137
2020-09-02VideoFramePool: Only accept one request at the same timeChih-Yu Huang
Originally, VideoFramePool can accept multiple requests in parallel. However, it increases the code complexity. Also, currently the caller only request one frame at the same time. This CL changes the VideoFramePool to accept one request at the same time. Bug: 166072201 Test: pass tast.arc.VideoDecodeAccel.h264_vm Change-Id: I16811e1d004dcaf8baeb70efb4a1cb5d2a3daacf
2020-08-28v4l2_codec2: Deprecate use of ::base::ScopedFD.David Staessens
This CL removes the use of ::base::ScopedFD in the VideoFrame and BitstreamBuffer classes. The use of ScopedFD forces us to duplicate the file descriptor, while this is not necessary. Bug: 143333813 Test: tast run $HOST arc.VideoDecodeAccel.h264_vm on hatch-arc-r Change-Id: I7e6fccbd142889f779f409947784568d89f0d13e
2020-08-26Reduce the verbosity of some logsDavid Stevens
This reduces the verbosity of logs that appear very often during execution of the c2_e2e_test. Bug: 166401871 Test: Run c2_e2e_test and verify there is no logspam Change-Id: Ie21c54f50b52c6062f8e7b6c9bc02ef226d3451d
2020-08-25V4L2Decoder: Clear mFrameAtDevice when streamoff the output queueChih-Yu Huang
|mFrameAtDevice| is to track the buffers enqueued in the V4L2 output queue. When we streamoff the V4L2 queue, all of the enqueued buffers are dropped immediately. Therefore we should also clear |mFrameAtDevice| at the same time. Bug: 166072201 Test: Run gts.DashTest#testWidevineVp9AdaptiveWithRendererDisabling and check the error message added by this CL doesn't appear. Change-Id: Ibda5949710e66e78a6f49c80c57e94c93fe69afc
2020-08-24V4L2Decoder: Skip fetching VideoFrame when no free V4L2 output slotChih-Yu Huang
We should only fetch buffers when there are free V4L2 output slots. This CL adds the check to avoid unnecessary buffer fetching. Bug: 160110407 Test: Run e2e test and confirm that buffer fetching is skipped when no free V4L2 slot Change-Id: If50752964155ba65d8cc7ec0805507c053716294
2020-08-06Merge changes I3c8e1054,I5efe9cdf into rvc-devTreeHugger Robot
* changes: v4l2_codec2: Move BitstreamBuffer class to BitstreamBuffer.h. v4l2_codec2: Change input buffer memory type to DMABuf.
2020-08-06v4l2_codec2: Move BitstreamBuffer class to BitstreamBuffer.h.David Staessens
This CL extracts and moves the BitstreamBuffer class into BitstreamBuffer.h, to allow it to be reused. Bug: 143333813 Test: tast run $HOST arc.VideoEncodeAccel.h264_vm on hatch-arc-r Change-Id: I3c8e1054929878bd5a0a3d3a894c0e766874a532
2020-08-05V4L2Decoder: use map to associate block IDs to V4L2 buffersAlexandre Courbot
Block IDs can be arbitrarily large, but we only have a limited number of V4L2 buffers. Keep an association between the block IDs received from VideoFramePool and a V4L2 buffer slot to use with them instead of assuming that block IDs can be used as valid V4L2 buffer indices. Bug: 161323057 Test: arc.VideoDecodeAccel.h264_vm fully passes on Kukui. Change-Id: Id6a1013795d85cc08e3dca9308442db4921ddae0
2020-08-04V4L2Decoder: pass the same output buffer to V4L2 Queue slotChih-Yu Huang
Originally we pass arbitrary output buffers to V4L2 Queue. However, the V4L2 stateful API requires the caller pass the same buffers to the output queue slot. This CL implement this requirement. Bug: 161770200 Bug: 161323057 Test: arc.VideoDecodeAccel.h264_vm runs first test successfully. Change-Id: I8f6c8871997f310425571b3983ae86f05c0c37c6
2020-07-09V4L2DecodeComponent: Support protected playback.Chih-Yu Huang
In this CL, V4L2DecodeComponent supports the protected playback by using C2VdaBqBlockPool. To use C2VdaBqBlockPool, there are 2 specific requirements compared to a normal C2BlockPool: 1. Call C2VdaBqBlockPool::requestNewBufferSet() before fetching blocks 2. Call MarkBlockPoolDataAsShared() after creating C2ConstGraphicBlock Bug: 153608694 Test: Run ExoPlayer Demo apk: Widevine dash policy tests Change-Id: Idce298d13cb2fb7f9dd88ae43cd4c8f0cb18dffb
2020-07-03components: Polish some logs.Chih-Yu Huang
This CL adds or fixes some information at logging, not changing the code logic. Bug: 160110407 Test: m -j32 Change-Id: I97d2cd43a526e56000abcc16886b1f0f6e0f6b71
2020-06-02components: Implement Codec2.0 V4L2 decode componentChih-Yu Huang
This CL implements V4L2DecodeComponent, a decode C2Component via V4L2 API. It mainly contains these parts: - VideoDecoder: An interface for video decoding, similar to media::VideoDecoder at Chromium project. - V4L2Decoder: An implementation of VideoDecoder via V4L2 stateful API. We wrap all V4L2-related logic in this class - VideoFrame The data structure to represent the output buffer of VideoDecoder. It encapsulates a C2GraphicBlock and only exposes the essential information of physical buffers. - VideoFramePool: The buffer pool used by VideoDecoder. It encapsulates C2BlockPool and provides asynchronous method to fetch buffers. - V4L2DecodeComponent, V4L2DecodeInterface: The C2Component implementation that delegates the decode request to V4L2Decoder. - V4L2ComponentFactory: The C2ComponentFactory that creates V4L2DecodeComponent. Bug: 152714603 Test: mmm external/v4l2_codec2/ Test: Run e2e test and make sure the V4L2DecodeComponent is running Change-Id: I23e9b3553b62dd6c83d943d7787297305372c37d