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

Commit 3092c5ac authored by Wonsik Kim's avatar Wonsik Kim
Browse files

codec2: Update DmaBufAllocator when new ComponentStore is set

Currently Store is captured inside allocators(ion, dmabuf). Update
Allocators when new store is set.

Bug: 211877648
(cherry picked from commit d3439782)
Merged-In: If0ad2128a42ab5db0072de8f6448235fad3e18ee
Change-Id: Ie389a9161aad73d8802ee2a86dfcf6d0013a43c0
parents d833cf07 ac6cb0d9
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -301,13 +301,21 @@ void C2PlatformAllocatorStoreImpl::setComponentStore(std::shared_ptr<C2Component
        std::lock_guard<std::mutex> lock(_mComponentStoreReadLock);
        _mComponentStore = store;
    }
    std::shared_ptr<C2AllocatorIon> allocator;
    std::shared_ptr<C2AllocatorIon> ionAllocator;
    {
        std::lock_guard<std::mutex> lock(gIonAllocatorMutex);
        allocator = gIonAllocator.lock();
        ionAllocator = gIonAllocator.lock();
    }
    if (allocator) {
        UseComponentStoreForIonAllocator(allocator, store);
    if (ionAllocator) {
        UseComponentStoreForIonAllocator(ionAllocator, store);
    }
    std::shared_ptr<C2DmaBufAllocator> dmaAllocator;
    {
        std::lock_guard<std::mutex> lock(gDmaBufAllocatorMutex);
        dmaAllocator = gDmaBufAllocator.lock();
    }
    if (dmaAllocator) {
        UseComponentStoreForDmaBufAllocator(dmaAllocator, store);
    }
}