diff --git a/mpp/base/mpp_buffer_impl.cpp b/mpp/base/mpp_buffer_impl.cpp index d8b4f017..9c1ea695 100644 --- a/mpp/base/mpp_buffer_impl.cpp +++ b/mpp/base/mpp_buffer_impl.cpp @@ -75,6 +75,7 @@ private: RK_U32 group_id; RK_U32 group_count; RK_U32 finalizing; + RK_U32 finished; // misc group for internal / externl buffer with different type MppBufferGroupImpl *misc[MPP_BUFFER_MODE_BUTT][MPP_BUFFER_TYPE_BUTT]; @@ -604,6 +605,7 @@ MppBufferService::MppBufferService() : group_id(0), group_count(0), finalizing(0), + finished(0), misc_count(0) { RK_S32 i, j; @@ -655,6 +657,7 @@ MppBufferService::~MppBufferService() deinit_buffer_no_lock(pos, __FUNCTION__); } } + finished = 1; } RK_U32 MppBufferService::get_group_id() @@ -745,6 +748,9 @@ void MppBufferService::set_misc(MppBufferMode mode, MppBufferType type, MppBuffe void MppBufferService::put_group(MppBufferGroupImpl *p) { + if (finished) + return ; + buffer_group_add_log(p, NULL, GRP_RELEASE, __FUNCTION__); // remove unused list diff --git a/mpp/base/mpp_meta.cpp b/mpp/base/mpp_meta.cpp index d5214e35..7d0cddf7 100644 --- a/mpp/base/mpp_meta.cpp +++ b/mpp/base/mpp_meta.cpp @@ -69,6 +69,7 @@ private: RK_U32 meta_id; RK_U32 meta_count; RK_U32 node_count; + RK_U32 finished; public: static MppMetaService *get_instance() { @@ -101,7 +102,8 @@ public: MppMetaService::MppMetaService() : meta_id(0), meta_count(0), - node_count(0) + node_count(0), + finished(0) { INIT_LIST_HEAD(&mlist_meta); INIT_LIST_HEAD(&mlist_node); @@ -128,6 +130,7 @@ MppMetaService::~MppMetaService() put_node(pos); } } + finished = 1; } RK_S32 MppMetaService::get_index_of_key(MppMetaKey key, MppMetaType type) @@ -166,6 +169,9 @@ MppMetaImpl *MppMetaService::get_meta(const char *tag, const char *caller) void MppMetaService::put_meta(MppMetaImpl *meta) { + if (finished) + return ; + mpp_assert(meta->ref_count); if (meta->ref_count) meta->ref_count--;