Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2bd4df79 authored by Arun Johnson's avatar Arun Johnson
Browse files

Fix for handling end of stream

 - Fixes handling of end of strem when provided only with
   C2Work and not with C2AccessUnitInfos::input

Change-Id: I0ed5d73f68e91058b4622f118c7ee15afcc66736
parent a0934756
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -277,9 +277,11 @@ c2_status_t MultiAccessUnitHelper::scatter(
                    std::static_pointer_cast<const C2AccessUnitInfos::input>(
                    w->input.buffers.front()->getInfo(C2AccessUnitInfos::input::PARAM_TYPE));
            uint32_t offset = 0; uint32_t multiAUSize = multiAU.front().size();
            bool sendEos = false;
            for (int idx = 0; idx < auInfo->flexCount(); ++idx) {
                std::vector<C2ConstLinearBlock> au;
                const C2AccessUnitInfosStruct &info = auInfo->m.values[idx];
                sendEos |= (info.flags & C2FrameData::FLAG_END_OF_STREAM);
                std::unique_ptr<C2Work> newWork = cloneInputWork(w, info.flags);
                frameSet.insert(newFrameIdx);
                newFrameIdx = mFrameIndex++;
@@ -302,6 +304,17 @@ c2_status_t MultiAccessUnitHelper::scatter(
                processedWork->push_back(std::move(sliceWork));
                offset += info.size;
            }
            if (!sendEos && (w->input.flags & C2FrameData::FLAG_END_OF_STREAM)) {
                if (!processedWork->empty()) {
                    std::list<std::unique_ptr<C2Work>> &sliceWork = processedWork->back();
                    if (!sliceWork.empty()) {
                        std::unique_ptr<C2Work> &work = sliceWork.back();
                        if (work) {
                            work->input.flags = C2FrameData::FLAG_END_OF_STREAM;
                        }
                    }
                }
            }
        }
        if (!processedWork->empty()) {
            {