Lines Matching full:work

83 bool isWorkDone(const C2Work& work) {  in isWorkDone()  argument
84 const int32_t bitstreamId = frameIndexToBitstreamId(work.input.ordinal.frameIndex); in isWorkDone()
86 // Exception: EOS work should be processed by reportEOSWork(). in isWorkDone()
87 // Always return false here no matter the work is actually done. in isWorkDone()
88 if (work.input.flags & C2FrameData::FLAG_END_OF_STREAM) return false; in isWorkDone()
90 // Work is done when all conditions meet: in isWorkDone()
91 // 1. mDecoder has released the work's input buffer. in isWorkDone()
92 // 2. mDecoder has returned the work's output buffer in normal case, in isWorkDone()
94 bool inputReleased = (work.input.buffers.front() == nullptr); in isWorkDone()
95 bool outputReturned = !work.worklets.front()->output.buffers.empty(); in isWorkDone()
96 bool ignoreOutput = (work.input.flags & C2FrameData::FLAG_CODEC_CONFIG) || in isWorkDone()
97 (work.worklets.front()->output.flags & C2FrameData::FLAG_DROP_FRAME); in isWorkDone()
98 ALOGV("work(%d): inputReleased: %d, outputReturned: %d, ignoreOutput: %d", bitstreamId, in isWorkDone()
103 bool isNoShowFrameWork(const C2Work& work, const C2WorkOrdinalStruct& currOrdinal) { in isNoShowFrameWork() argument
104 // We consider Work contains no-show frame when all conditions meet: in isNoShowFrameWork()
105 // 1. Work's ordinal is smaller than current ordinal. in isNoShowFrameWork()
106 // 2. Work's output buffer is not returned. in isNoShowFrameWork()
107 // 3. Work is not EOS, CSD, or marked with dropped frame. in isNoShowFrameWork()
108 bool smallOrdinal = (work.input.ordinal.timestamp < currOrdinal.timestamp) && in isNoShowFrameWork()
109 (work.input.ordinal.frameIndex < currOrdinal.frameIndex); in isNoShowFrameWork()
110 bool outputReturned = !work.worklets.front()->output.buffers.empty(); in isNoShowFrameWork()
111 bool specialWork = (work.input.flags & C2FrameData::FLAG_END_OF_STREAM) || in isNoShowFrameWork()
112 (work.input.flags & C2FrameData::FLAG_CODEC_CONFIG) || in isNoShowFrameWork()
113 (work.worklets.front()->output.flags & C2FrameData::FLAG_DROP_FRAME); in isNoShowFrameWork()
387 void V4L2DecodeComponent::queueTask(std::unique_ptr<C2Work> work) { in queueTask() argument
388 ALOGV("%s(): flags=0x%x, index=%llu, timestamp=%llu", __func__, work->input.flags, in queueTask()
389 work->input.ordinal.frameIndex.peekull(), work->input.ordinal.timestamp.peekull()); in queueTask()
392 if (work->worklets.size() != 1u || work->input.buffers.size() > 1u) { in queueTask()
393 ALOGE("Invalid work: worklets.size()=%zu, input.buffers.size()=%zu", work->worklets.size(), in queueTask()
394 work->input.buffers.size()); in queueTask()
395 work->result = C2_CORRUPTED; in queueTask()
396 reportWork(std::move(work)); in queueTask()
400 work->worklets.front()->output.flags = static_cast<C2FrameData::flags_t>(0); in queueTask()
401 work->worklets.front()->output.buffers.clear(); in queueTask()
402 work->worklets.front()->output.ordinal = work->input.ordinal; in queueTask()
403 if (work->input.buffers.empty()) { in queueTask()
404 // Client may queue a work with no input buffer for either it's EOS or empty CSD, otherwise in queueTask()
405 // every work must have one input buffer. in queueTask()
406 if ((work->input.flags & C2FrameData::FLAG_END_OF_STREAM) == 0 && in queueTask()
407 (work->input.flags & C2FrameData::FLAG_CODEC_CONFIG) == 0) { in queueTask()
408 ALOGE("Invalid work: work with no input buffer should be EOS or CSD."); in queueTask()
413 // Emplace a nullptr to unify the check for work done. in queueTask()
414 ALOGV("Got a work with no input buffer! Emplace a nullptr inside."); in queueTask()
415 work->input.buffers.emplace_back(nullptr); in queueTask()
418 mPendingWorks.push(std::move(work)); in queueTask()
440 const C2Work* work = pendingWork.get(); in pumpPendingWorks() local
450 work->input.buffers.front()->data().linearBlocks().front(); in pumpPendingWorks()
451 ALOG_ASSERT(linearBlock.size() > 0u, "Input buffer of work(%d) is empty.", bitstreamId); in pumpPendingWorks()
453 // Try to parse color aspects from bitstream for CSD work of non-secure H264 codec. in pumpPendingWorks()
469 mPendingColorAspectsChangeFrameIndex = work->input.ordinal.frameIndex.peeku(); in pumpPendingWorks()
489 // Directly report the empty CSD work as finished. in pumpPendingWorks()
501 C2Work* work = it->second.get(); in onDecodeDone() local
505 work->input.buffers.front().reset(); in onDecodeDone()
506 work->worklets.front()->output.flags = static_cast<C2FrameData::flags_t>( in onDecodeDone()
507 work->worklets.front()->output.flags & C2FrameData::FLAG_DROP_FRAME); in onDecodeDone()
519 work->input.buffers.front().reset(); in onDecodeDone()
521 // CSD Work doesn't have output buffer, the corresponding onOutputFrameReady() won't be in onDecodeDone()
523 if (work->input.flags & C2FrameData::FLAG_CODEC_CONFIG) in onDecodeDone()
538 ALOGE("Work with bitstreamId=%d not found, already abandoned?", bitstreamId); in onOutputFrameReady()
542 C2Work* work = it->second.get(); in onOutputFrameReady() local
547 work->input.ordinal.frameIndex.peeku() >= mPendingColorAspectsChangeFrameIndex) { in onOutputFrameReady()
554 work->worklets.front()->output.buffers.emplace_back(std::move(buffer)); in onOutputFrameReady()
556 // Check no-show frame by timestamps for VP8/VP9 cases before reporting the current work. in onOutputFrameReady()
559 detectNoShowFrameWorksAndReportIfFinished(work->input.ordinal); in onOutputFrameReady()
574 const C2Work* work = kv.second.get(); in detectNoShowFrameWorksAndReportIfFinished() local
576 // A work in mWorksAtDecoder would be considered to have no-show frame if there is no in detectNoShowFrameWorksAndReportIfFinished()
577 // corresponding output buffer returned while the one of the work with latter timestamp is in detectNoShowFrameWorksAndReportIfFinished()
579 if (isNoShowFrameWork(*work, currOrdinal)) { in detectNoShowFrameWorksAndReportIfFinished()
580 work->worklets.front()->output.flags = C2FrameData::FLAG_DROP_FRAME; in detectNoShowFrameWorksAndReportIfFinished()
586 ALOGV("Detected no-show frame work index=%llu timestamp=%llu", in detectNoShowFrameWorksAndReportIfFinished()
587 work->input.ordinal.frameIndex.peekull(), in detectNoShowFrameWorksAndReportIfFinished()
588 work->input.ordinal.timestamp.peekull()); in detectNoShowFrameWorksAndReportIfFinished()
610 // EOS work will not be reported here. reportEOSWork() does it. in reportWorkIfFinished()
612 ALOGV("work(bitstreamId = %d) is EOS Work.", bitstreamId); in reportWorkIfFinished()
618 ALOGI("work(bitstreamId = %d) is dropped, skip.", bitstreamId); in reportWorkIfFinished()
623 ALOGV("work(bitstreamId = %d) is not done yet.", bitstreamId); in reportWorkIfFinished()
627 std::unique_ptr<C2Work> work = std::move(it->second); in reportWorkIfFinished() local
630 work->result = C2_OK; in reportWorkIfFinished()
631 work->workletsProcessed = static_cast<uint32_t>(work->worklets.size()); in reportWorkIfFinished()
632 // A work with neither flags nor output buffer would be treated as no-corresponding in reportWorkIfFinished()
634 if (work->worklets.front()->output.flags & C2FrameData::FLAG_DROP_FRAME) in reportWorkIfFinished()
635 work->worklets.front()->output.flags = static_cast<C2FrameData::flags_t>(0); in reportWorkIfFinished()
637 return reportWork(std::move(work)); in reportWorkIfFinished()
649 ALOGE("Failed to find EOS work."); in reportEOSWork()
662 ALOGW("There are remaining works except EOS work. abandon them."); in reportEOSWork()
664 ALOGW("bitstreamId(%d) => Work index=%llu, timestamp=%llu", kv.first, in reportEOSWork()
674 bool V4L2DecodeComponent::reportWork(std::unique_ptr<C2Work> work) { in reportWork() argument
675 ALOGV("%s(work=%llu)", __func__, work->input.ordinal.frameIndex.peekull()); in reportWork()
690 finishedWorks.emplace_back(std::move(work)); in reportWork()
720 // Pending EOS work will be abandoned here due to component flush if any. in flushTask()
744 for (auto& work : abandonedWorks) { in reportAbandonedWorks() local
745 // TODO: correlate the definition of flushed work result to framework. in reportAbandonedWorks()
746 work->result = C2_NOT_FOUND; in reportAbandonedWorks()
747 // When the work is abandoned, buffer in input.buffers shall reset by component. in reportAbandonedWorks()
748 if (!work->input.buffers.empty()) { in reportAbandonedWorks()
749 work->input.buffers.front().reset(); in reportAbandonedWorks()
789 ALOGV("Set EOS flag at last queued work."); in drainTask()