chore[MppPacket]: Add caller log on check failure

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I9b7bb0e4d66dd017734d9b97b8965b2f8193ab0d
This commit is contained in:
Herman Chen
2024-12-10 16:08:28 +08:00
parent 18c0350721
commit 11b68bfc3f
2 changed files with 4 additions and 3 deletions

View File

@@ -97,7 +97,8 @@ MPP_RET mpp_packet_add_segment_info(MppPacket packet, RK_S32 type, RK_S32 offset
void mpp_packet_copy_segment_info(MppPacket dst, MppPacket src);
/* pointer check function */
MPP_RET check_is_mpp_packet(void *ptr);
MPP_RET check_is_mpp_packet_f(void *ptr, const char *caller);
#define check_is_mpp_packet(ptr) check_is_mpp_packet_f(ptr, __FUNCTION__)
#ifdef __cplusplus
}

View File

@@ -29,12 +29,12 @@ static MppMemPool mpp_packet_pool = mpp_mem_pool_init_f(module_name, sizeof(MppP
#define setup_mpp_packet_name(packet) \
((MppPacketImpl*)packet)->name = module_name;
MPP_RET check_is_mpp_packet(void *packet)
MPP_RET check_is_mpp_packet_f(void *packet, const char *caller)
{
if (packet && ((MppPacketImpl*)packet)->name == module_name)
return MPP_OK;
mpp_err_f("pointer %p failed on check\n", packet);
mpp_err("MppPacket %p failed on check from %s\n", packet, caller);
mpp_abort();
return MPP_NOK;
}