Loading media/codec2/hidl/1.0/utils/Component.cpp +31 −0 Original line number Diff line number Diff line Loading @@ -482,6 +482,37 @@ void Component::initListener(const sp<Component>& self) { if (res != C2_OK) { mInit = res; } struct ListenerDeathRecipient : public HwDeathRecipient { ListenerDeathRecipient(const wp<Component>& comp) : mComponent{comp} { } virtual void serviceDied( uint64_t /* cookie */, const wp<::android::hidl::base::V1_0::IBase>& /* who */ ) override { auto strongComponent = mComponent.promote(); if (strongComponent) { LOG(INFO) << "Client died ! release the component !!"; strongComponent->release(); } else { LOG(ERROR) << "Client died ! no component to release !!"; } } wp<Component> mComponent; }; mDeathRecipient = new ListenerDeathRecipient(self); Return<bool> transStatus = mListener->linkToDeath( mDeathRecipient, 0); if (!transStatus.isOk()) { LOG(ERROR) << "Listener linkToDeath() transaction failed."; } if (!static_cast<bool>(transStatus)) { LOG(DEBUG) << "Listener linkToDeath() call failed."; } } Component::~Component() { Loading media/codec2/hidl/1.0/utils/include/codec2/hidl/1.0/Component.h +3 −0 Original line number Diff line number Diff line Loading @@ -132,6 +132,9 @@ protected: friend struct ComponentStore; struct Listener; using HwDeathRecipient = ::android::hardware::hidl_death_recipient; sp<HwDeathRecipient> mDeathRecipient; }; } // namespace utils Loading media/codec2/hidl/1.1/utils/Component.cpp +31 −0 Original line number Diff line number Diff line Loading @@ -489,6 +489,37 @@ void Component::initListener(const sp<Component>& self) { if (res != C2_OK) { mInit = res; } struct ListenerDeathRecipient : public HwDeathRecipient { ListenerDeathRecipient(const wp<Component>& comp) : component{comp} { } virtual void serviceDied( uint64_t /* cookie */, const wp<::android::hidl::base::V1_0::IBase>& /* who */ ) override { auto strongComponent = component.promote(); if (strongComponent) { LOG(INFO) << "Client died ! release the component !!"; strongComponent->release(); } else { LOG(ERROR) << "Client died ! no component to release !!"; } } wp<Component> component; }; mDeathRecipient = new ListenerDeathRecipient(self); Return<bool> transStatus = mListener->linkToDeath( mDeathRecipient, 0); if (!transStatus.isOk()) { LOG(ERROR) << "Listener linkToDeath() transaction failed."; } if (!static_cast<bool>(transStatus)) { LOG(DEBUG) << "Listener linkToDeath() call failed."; } } Component::~Component() { Loading media/codec2/hidl/1.1/utils/include/codec2/hidl/1.1/Component.h +3 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,9 @@ protected: friend struct ComponentStore; struct Listener; using HwDeathRecipient = ::android::hardware::hidl_death_recipient; sp<HwDeathRecipient> mDeathRecipient; }; } // namespace utils Loading Loading
media/codec2/hidl/1.0/utils/Component.cpp +31 −0 Original line number Diff line number Diff line Loading @@ -482,6 +482,37 @@ void Component::initListener(const sp<Component>& self) { if (res != C2_OK) { mInit = res; } struct ListenerDeathRecipient : public HwDeathRecipient { ListenerDeathRecipient(const wp<Component>& comp) : mComponent{comp} { } virtual void serviceDied( uint64_t /* cookie */, const wp<::android::hidl::base::V1_0::IBase>& /* who */ ) override { auto strongComponent = mComponent.promote(); if (strongComponent) { LOG(INFO) << "Client died ! release the component !!"; strongComponent->release(); } else { LOG(ERROR) << "Client died ! no component to release !!"; } } wp<Component> mComponent; }; mDeathRecipient = new ListenerDeathRecipient(self); Return<bool> transStatus = mListener->linkToDeath( mDeathRecipient, 0); if (!transStatus.isOk()) { LOG(ERROR) << "Listener linkToDeath() transaction failed."; } if (!static_cast<bool>(transStatus)) { LOG(DEBUG) << "Listener linkToDeath() call failed."; } } Component::~Component() { Loading
media/codec2/hidl/1.0/utils/include/codec2/hidl/1.0/Component.h +3 −0 Original line number Diff line number Diff line Loading @@ -132,6 +132,9 @@ protected: friend struct ComponentStore; struct Listener; using HwDeathRecipient = ::android::hardware::hidl_death_recipient; sp<HwDeathRecipient> mDeathRecipient; }; } // namespace utils Loading
media/codec2/hidl/1.1/utils/Component.cpp +31 −0 Original line number Diff line number Diff line Loading @@ -489,6 +489,37 @@ void Component::initListener(const sp<Component>& self) { if (res != C2_OK) { mInit = res; } struct ListenerDeathRecipient : public HwDeathRecipient { ListenerDeathRecipient(const wp<Component>& comp) : component{comp} { } virtual void serviceDied( uint64_t /* cookie */, const wp<::android::hidl::base::V1_0::IBase>& /* who */ ) override { auto strongComponent = component.promote(); if (strongComponent) { LOG(INFO) << "Client died ! release the component !!"; strongComponent->release(); } else { LOG(ERROR) << "Client died ! no component to release !!"; } } wp<Component> component; }; mDeathRecipient = new ListenerDeathRecipient(self); Return<bool> transStatus = mListener->linkToDeath( mDeathRecipient, 0); if (!transStatus.isOk()) { LOG(ERROR) << "Listener linkToDeath() transaction failed."; } if (!static_cast<bool>(transStatus)) { LOG(DEBUG) << "Listener linkToDeath() call failed."; } } Component::~Component() { Loading
media/codec2/hidl/1.1/utils/include/codec2/hidl/1.1/Component.h +3 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,9 @@ protected: friend struct ComponentStore; struct Listener; using HwDeathRecipient = ::android::hardware::hidl_death_recipient; sp<HwDeathRecipient> mDeathRecipient; }; } // namespace utils Loading