diff options
author | Chih-Yu Huang <akahuang@google.com> | 2021-02-16 11:08:37 +0900 |
---|---|---|
committer | Chih-Yu Huang <akahuang@google.com> | 2021-03-01 15:32:09 +0900 |
commit | d57b79342897c1215517d17ef260ab5bc61b9b50 (patch) | |
tree | 7e7bd615e441a1636b4dca8c55e4f4804dae9118 /components | |
parent | c065af968553ae2c64d5712134d4f1e11501f180 (diff) | |
download | v4l2_codec2-d57b79342897c1215517d17ef260ab5bc61b9b50.tar.gz |
V4L2DecodeComponent: handle aborted decoding C2Work
Originally V4L2DecodeComponent does nothing when V4L2Decoder reports
aborted decoded request. The corresponding C2Work is not cleared from
|mWorksAtDecoder|.
This CL changes to report the aborted C2Work with adding the flag
C2FrameData::FLAG_DROP_FRAME.
Bug: 177627914
Test: android.media.cts.MediaRandomTest#testPlayerRandomActionH264
Change-Id: I236e434b2df1567bd5cf96511f611a80f8b198b1
Diffstat (limited to 'components')
-rw-r--r-- | components/V4L2DecodeComponent.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/components/V4L2DecodeComponent.cpp b/components/V4L2DecodeComponent.cpp index 9461aa7..58cd34d 100644 --- a/components/V4L2DecodeComponent.cpp +++ b/components/V4L2DecodeComponent.cpp @@ -512,8 +512,18 @@ void V4L2DecodeComponent::onDecodeDone(int32_t bitstreamId, VideoDecoder::Decode VideoDecoder::DecodeStatusToString(status)); ALOG_ASSERT(mDecoderTaskRunner->RunsTasksInCurrentSequence()); + auto it = mWorksAtDecoder.find(bitstreamId); + ALOG_ASSERT(it != mWorksAtDecoder.end()); + C2Work* work = it->second.get(); + switch (status) { case VideoDecoder::DecodeStatus::kAborted: + work->input.buffers.front().reset(); + work->worklets.front()->output.flags = static_cast<C2FrameData::flags_t>( + work->worklets.front()->output.flags & C2FrameData::FLAG_DROP_FRAME); + mOutputBitstreamIds.push(bitstreamId); + + pumpReportWork(); return; case VideoDecoder::DecodeStatus::kError: @@ -521,10 +531,6 @@ void V4L2DecodeComponent::onDecodeDone(int32_t bitstreamId, VideoDecoder::Decode return; case VideoDecoder::DecodeStatus::kOk: - auto it = mWorksAtDecoder.find(bitstreamId); - ALOG_ASSERT(it != mWorksAtDecoder.end()); - C2Work* work = it->second.get(); - // Release the input buffer. work->input.buffers.front().reset(); @@ -627,7 +633,10 @@ bool V4L2DecodeComponent::reportWorkIfFinished(int32_t bitstreamId) { } auto it = mWorksAtDecoder.find(bitstreamId); - ALOG_ASSERT(it != mWorksAtDecoder.end()); + if (it == mWorksAtDecoder.end()) { + ALOGI("work(bitstreamId = %d) is dropped, skip.", bitstreamId); + return true; + } if (!isWorkDone(*(it->second))) { ALOGV("work(bitstreamId = %d) is not done yet.", bitstreamId); |