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

Commit 6b260079 authored by Bill Yi's avatar Bill Yi
Browse files

Merge SP2A.220405.004 to aosp-master - DO NOT MERGE

Merged-In: I00ca36e7ec8eea08f4b7ec6808a83c845dfc09ce
Merged-In: I8a7351046c2ee48eddcc12c95a5a6526e7763160
Change-Id: I4a27b062364a0a22ff05c075465a0555233e74d9
parents ba2bc909 ae5c3b1f
Loading
Loading
Loading
Loading
+22 −15
Original line number Diff line number Diff line
@@ -207,6 +207,7 @@ public:

        c2_status_t err = mapInternal(mapSize, mapOffset, alignmentBytes, prot, flags, &(map.addr), addr);
        if (map.addr) {
            std::lock_guard<std::mutex> guard(mMutexMappings);
            mMappings.push_back(map);
        }
        return err;
@@ -217,6 +218,8 @@ public:
            ALOGD("tried to unmap unmapped buffer");
            return C2_NOT_FOUND;
        }
        { // Scope for the lock_guard of mMutexMappings.
            std::lock_guard<std::mutex> guard(mMutexMappings);
            for (auto it = mMappings.begin(); it != mMappings.end(); ++it) {
                if (addr != (uint8_t *)it->addr + it->alignmentBytes ||
                        size + it->alignmentBytes != it->size) {
@@ -231,9 +234,11 @@ public:
                    *fence = C2Fence(); // not using fences
                }
                (void)mMappings.erase(it);
            ALOGV("successfully unmapped: addr=%p size=%zu fd=%d", addr, size, mHandle.bufferFd());
                ALOGV("successfully unmapped: addr=%p size=%zu fd=%d", addr, size,
                          mHandle.bufferFd());
                return C2_OK;
            }
        }
        ALOGD("unmap failed to find specified map");
        return C2_BAD_VALUE;
    }
@@ -241,6 +246,7 @@ public:
    virtual ~Impl() {
        if (!mMappings.empty()) {
            ALOGD("Dangling mappings!");
            std::lock_guard<std::mutex> guard(mMutexMappings);
            for (const Mapping &map : mMappings) {
                (void)munmap(map.addr, map.size);
            }
@@ -320,6 +326,7 @@ protected:
        size_t size;
    };
    std::list<Mapping> mMappings;
    std::mutex mMutexMappings;
};

class C2AllocationIon::ImplV2 : public C2AllocationIon::Impl {
+8 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include <binder/IMemory.h>
#include <binder/MemoryDealer.h>
#include <drm/drm_framework_common.h>
#include <log/log.h>
#include <media/mediametadataretriever.h>
#include <media/stagefright/MediaSource.h>
#include <media/stagefright/foundation/ADebug.h>
@@ -422,7 +423,13 @@ bool HeifDecoderImpl::reinit(HeifFrameInfo* frameInfo) {

        initFrameInfo(&mSequenceInfo, videoFrame);

        mSequenceLength = atoi(mRetriever->extractMetadata(METADATA_KEY_VIDEO_FRAME_COUNT));
        const char* frameCount = mRetriever->extractMetadata(METADATA_KEY_VIDEO_FRAME_COUNT);
        if (frameCount == nullptr) {
            android_errorWriteWithInfoLog(0x534e4554, "215002587", -1, NULL, 0);
            ALOGD("No valid sequence information in metadata");
            return false;
        }
        mSequenceLength = atoi(frameCount);

        if (defaultInfo == nullptr) {
            defaultInfo = &mSequenceInfo;