Loading media/codec2/hal/hidl/1.0/utils/Component.cpp +30 −5 Original line number Diff line number Diff line Loading @@ -222,6 +222,21 @@ c2_status_t Component::status() const { return mInit; } void Component::onDeathReceived() { { std::lock_guard<std::mutex> lock(mBlockPoolsMutex); mClientDied = true; for (auto it = mBlockPools.begin(); it != mBlockPools.end(); ++it) { if (it->second->getAllocatorId() == C2PlatformAllocatorStore::BUFFERQUEUE) { std::shared_ptr<C2BufferQueueBlockPool> bqPool = std::static_pointer_cast<C2BufferQueueBlockPool>(it->second); bqPool->invalidate(); } } } release(); } // Methods from ::android::hardware::media::c2::V1_0::IComponent Return<Status> Component::queue(const WorkBundle& workBundle) { std::list<std::unique_ptr<C2Work>> c2works; Loading Loading @@ -409,9 +424,19 @@ Return<void> Component::createBlockPool( blockPool = nullptr; } if (blockPool) { bool emplaced = false; { mBlockPoolsMutex.lock(); if (!mClientDied) { mBlockPools.emplace(blockPool->getLocalId(), blockPool); emplaced = true; } mBlockPoolsMutex.unlock(); } if (!emplaced) { blockPool.reset(); status = C2_BAD_STATE; } } else if (status == C2_OK) { status = C2_CORRUPTED; } Loading Loading @@ -494,8 +519,8 @@ void Component::initListener(const sp<Component>& self) { ) override { auto strongComponent = mComponent.promote(); if (strongComponent) { LOG(INFO) << "Client died ! release the component !!"; strongComponent->release(); LOG(INFO) << "Client died ! notify and release the component !!"; strongComponent->onDeathReceived(); } else { LOG(ERROR) << "Client died ! no component to release !!"; } Loading media/codec2/hal/hidl/1.0/utils/include/codec2/hidl/1.0/Component.h +3 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ struct Component : public IComponent, const sp<::android::hardware::media::bufferpool::V2_0:: IClientManager>& clientPoolManager); c2_status_t status() const; // Receives a death notification of the client. void onDeathReceived(); typedef ::android::hardware::graphics::bufferqueue::V1_0:: IGraphicBufferProducer HGraphicBufferProducer1; Loading Loading @@ -135,6 +137,7 @@ protected: using HwDeathRecipient = ::android::hardware::hidl_death_recipient; sp<HwDeathRecipient> mDeathRecipient; bool mClientDied{false}; }; } // namespace utils Loading media/codec2/hal/hidl/1.1/utils/Component.cpp +30 −5 Original line number Diff line number Diff line Loading @@ -222,6 +222,21 @@ c2_status_t Component::status() const { return mInit; } void Component::onDeathReceived() { { std::lock_guard<std::mutex> lock(mBlockPoolsMutex); mClientDied = true; for (auto it = mBlockPools.begin(); it != mBlockPools.end(); ++it) { if (it->second->getAllocatorId() == C2PlatformAllocatorStore::BUFFERQUEUE) { std::shared_ptr<C2BufferQueueBlockPool> bqPool = std::static_pointer_cast<C2BufferQueueBlockPool>(it->second); bqPool->invalidate(); } } } release(); } // Methods from ::android::hardware::media::c2::V1_1::IComponent Return<Status> Component::queue(const WorkBundle& workBundle) { std::list<std::unique_ptr<C2Work>> c2works; Loading Loading @@ -409,9 +424,19 @@ Return<void> Component::createBlockPool( blockPool = nullptr; } if (blockPool) { bool emplaced = false; { mBlockPoolsMutex.lock(); if (!mClientDied) { mBlockPools.emplace(blockPool->getLocalId(), blockPool); emplaced = true; } mBlockPoolsMutex.unlock(); } if (!emplaced) { blockPool.reset(); status = C2_BAD_STATE; } } else if (status == C2_OK) { status = C2_CORRUPTED; } Loading Loading @@ -501,8 +526,8 @@ void Component::initListener(const sp<Component>& self) { ) override { auto strongComponent = component.promote(); if (strongComponent) { LOG(INFO) << "Client died ! release the component !!"; strongComponent->release(); LOG(INFO) << "Client died ! notify and release the component !!"; strongComponent->onDeathReceived(); } else { LOG(ERROR) << "Client died ! no component to release !!"; } Loading media/codec2/hal/hidl/1.1/utils/include/codec2/hidl/1.1/Component.h +3 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,8 @@ struct Component : public IComponent, const sp<::android::hardware::media::bufferpool::V2_0:: IClientManager>& clientPoolManager); c2_status_t status() const; // Receives a death notification of the client. void onDeathReceived(); typedef ::android::hardware::graphics::bufferqueue::V1_0:: IGraphicBufferProducer HGraphicBufferProducer1; Loading Loading @@ -140,6 +142,7 @@ protected: using HwDeathRecipient = ::android::hardware::hidl_death_recipient; sp<HwDeathRecipient> mDeathRecipient; bool mClientDied{false}; }; } // namespace utils Loading media/codec2/hal/hidl/1.2/utils/Component.cpp +30 −5 Original line number Diff line number Diff line Loading @@ -222,6 +222,21 @@ c2_status_t Component::status() const { return mInit; } void Component::onDeathReceived() { { std::lock_guard<std::mutex> lock(mBlockPoolsMutex); mClientDied = true; for (auto it = mBlockPools.begin(); it != mBlockPools.end(); ++it) { if (it->second->getAllocatorId() == C2PlatformAllocatorStore::BUFFERQUEUE) { std::shared_ptr<C2BufferQueueBlockPool> bqPool = std::static_pointer_cast<C2BufferQueueBlockPool>(it->second); bqPool->invalidate(); } } } release(); } // Methods from ::android::hardware::media::c2::V1_1::IComponent Return<Status> Component::queue(const WorkBundle& workBundle) { std::list<std::unique_ptr<C2Work>> c2works; Loading Loading @@ -409,9 +424,19 @@ Return<void> Component::createBlockPool( blockPool = nullptr; } if (blockPool) { bool emplaced = false; { mBlockPoolsMutex.lock(); if (!mClientDied) { mBlockPools.emplace(blockPool->getLocalId(), blockPool); emplaced = true; } mBlockPoolsMutex.unlock(); } if (!emplaced) { blockPool.reset(); status = C2_BAD_STATE; } } else if (status == C2_OK) { status = C2_CORRUPTED; } Loading Loading @@ -532,8 +557,8 @@ void Component::initListener(const sp<Component>& self) { ) override { auto strongComponent = component.promote(); if (strongComponent) { LOG(INFO) << "Client died ! release the component !!"; strongComponent->release(); LOG(INFO) << "Client died ! notify and release the component !!"; strongComponent->onDeathReceived(); } else { LOG(ERROR) << "Client died ! no component to release !!"; } Loading Loading
media/codec2/hal/hidl/1.0/utils/Component.cpp +30 −5 Original line number Diff line number Diff line Loading @@ -222,6 +222,21 @@ c2_status_t Component::status() const { return mInit; } void Component::onDeathReceived() { { std::lock_guard<std::mutex> lock(mBlockPoolsMutex); mClientDied = true; for (auto it = mBlockPools.begin(); it != mBlockPools.end(); ++it) { if (it->second->getAllocatorId() == C2PlatformAllocatorStore::BUFFERQUEUE) { std::shared_ptr<C2BufferQueueBlockPool> bqPool = std::static_pointer_cast<C2BufferQueueBlockPool>(it->second); bqPool->invalidate(); } } } release(); } // Methods from ::android::hardware::media::c2::V1_0::IComponent Return<Status> Component::queue(const WorkBundle& workBundle) { std::list<std::unique_ptr<C2Work>> c2works; Loading Loading @@ -409,9 +424,19 @@ Return<void> Component::createBlockPool( blockPool = nullptr; } if (blockPool) { bool emplaced = false; { mBlockPoolsMutex.lock(); if (!mClientDied) { mBlockPools.emplace(blockPool->getLocalId(), blockPool); emplaced = true; } mBlockPoolsMutex.unlock(); } if (!emplaced) { blockPool.reset(); status = C2_BAD_STATE; } } else if (status == C2_OK) { status = C2_CORRUPTED; } Loading Loading @@ -494,8 +519,8 @@ void Component::initListener(const sp<Component>& self) { ) override { auto strongComponent = mComponent.promote(); if (strongComponent) { LOG(INFO) << "Client died ! release the component !!"; strongComponent->release(); LOG(INFO) << "Client died ! notify and release the component !!"; strongComponent->onDeathReceived(); } else { LOG(ERROR) << "Client died ! no component to release !!"; } Loading
media/codec2/hal/hidl/1.0/utils/include/codec2/hidl/1.0/Component.h +3 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ struct Component : public IComponent, const sp<::android::hardware::media::bufferpool::V2_0:: IClientManager>& clientPoolManager); c2_status_t status() const; // Receives a death notification of the client. void onDeathReceived(); typedef ::android::hardware::graphics::bufferqueue::V1_0:: IGraphicBufferProducer HGraphicBufferProducer1; Loading Loading @@ -135,6 +137,7 @@ protected: using HwDeathRecipient = ::android::hardware::hidl_death_recipient; sp<HwDeathRecipient> mDeathRecipient; bool mClientDied{false}; }; } // namespace utils Loading
media/codec2/hal/hidl/1.1/utils/Component.cpp +30 −5 Original line number Diff line number Diff line Loading @@ -222,6 +222,21 @@ c2_status_t Component::status() const { return mInit; } void Component::onDeathReceived() { { std::lock_guard<std::mutex> lock(mBlockPoolsMutex); mClientDied = true; for (auto it = mBlockPools.begin(); it != mBlockPools.end(); ++it) { if (it->second->getAllocatorId() == C2PlatformAllocatorStore::BUFFERQUEUE) { std::shared_ptr<C2BufferQueueBlockPool> bqPool = std::static_pointer_cast<C2BufferQueueBlockPool>(it->second); bqPool->invalidate(); } } } release(); } // Methods from ::android::hardware::media::c2::V1_1::IComponent Return<Status> Component::queue(const WorkBundle& workBundle) { std::list<std::unique_ptr<C2Work>> c2works; Loading Loading @@ -409,9 +424,19 @@ Return<void> Component::createBlockPool( blockPool = nullptr; } if (blockPool) { bool emplaced = false; { mBlockPoolsMutex.lock(); if (!mClientDied) { mBlockPools.emplace(blockPool->getLocalId(), blockPool); emplaced = true; } mBlockPoolsMutex.unlock(); } if (!emplaced) { blockPool.reset(); status = C2_BAD_STATE; } } else if (status == C2_OK) { status = C2_CORRUPTED; } Loading Loading @@ -501,8 +526,8 @@ void Component::initListener(const sp<Component>& self) { ) override { auto strongComponent = component.promote(); if (strongComponent) { LOG(INFO) << "Client died ! release the component !!"; strongComponent->release(); LOG(INFO) << "Client died ! notify and release the component !!"; strongComponent->onDeathReceived(); } else { LOG(ERROR) << "Client died ! no component to release !!"; } Loading
media/codec2/hal/hidl/1.1/utils/include/codec2/hidl/1.1/Component.h +3 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,8 @@ struct Component : public IComponent, const sp<::android::hardware::media::bufferpool::V2_0:: IClientManager>& clientPoolManager); c2_status_t status() const; // Receives a death notification of the client. void onDeathReceived(); typedef ::android::hardware::graphics::bufferqueue::V1_0:: IGraphicBufferProducer HGraphicBufferProducer1; Loading Loading @@ -140,6 +142,7 @@ protected: using HwDeathRecipient = ::android::hardware::hidl_death_recipient; sp<HwDeathRecipient> mDeathRecipient; bool mClientDied{false}; }; } // namespace utils Loading
media/codec2/hal/hidl/1.2/utils/Component.cpp +30 −5 Original line number Diff line number Diff line Loading @@ -222,6 +222,21 @@ c2_status_t Component::status() const { return mInit; } void Component::onDeathReceived() { { std::lock_guard<std::mutex> lock(mBlockPoolsMutex); mClientDied = true; for (auto it = mBlockPools.begin(); it != mBlockPools.end(); ++it) { if (it->second->getAllocatorId() == C2PlatformAllocatorStore::BUFFERQUEUE) { std::shared_ptr<C2BufferQueueBlockPool> bqPool = std::static_pointer_cast<C2BufferQueueBlockPool>(it->second); bqPool->invalidate(); } } } release(); } // Methods from ::android::hardware::media::c2::V1_1::IComponent Return<Status> Component::queue(const WorkBundle& workBundle) { std::list<std::unique_ptr<C2Work>> c2works; Loading Loading @@ -409,9 +424,19 @@ Return<void> Component::createBlockPool( blockPool = nullptr; } if (blockPool) { bool emplaced = false; { mBlockPoolsMutex.lock(); if (!mClientDied) { mBlockPools.emplace(blockPool->getLocalId(), blockPool); emplaced = true; } mBlockPoolsMutex.unlock(); } if (!emplaced) { blockPool.reset(); status = C2_BAD_STATE; } } else if (status == C2_OK) { status = C2_CORRUPTED; } Loading Loading @@ -532,8 +557,8 @@ void Component::initListener(const sp<Component>& self) { ) override { auto strongComponent = component.promote(); if (strongComponent) { LOG(INFO) << "Client died ! release the component !!"; strongComponent->release(); LOG(INFO) << "Client died ! notify and release the component !!"; strongComponent->onDeathReceived(); } else { LOG(ERROR) << "Client died ! no component to release !!"; } Loading