[mpp_packet]: Fix reset function

1. Reset function will not reset buffer pointer and buffer size.
2. Make mpp_packet_reset into a C function.

Change-Id: I1d9041e9732f249ef4a7753a4aac5c0795c34b17
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
Herman Chen
2019-10-16 15:55:58 +08:00
parent 53997e5cd8
commit db234e2d21
2 changed files with 14 additions and 0 deletions

View File

@@ -51,6 +51,9 @@ typedef struct MppPacketImpl_t {
MppMeta meta;
} MppPacketImpl;
#ifdef __cplusplus
extern "C" {
#endif
/*
* mpp_packet_reset is only used internelly and should NOT be used outside
*/
@@ -59,4 +62,8 @@ MPP_RET mpp_packet_reset(MppPacketImpl *packet);
/* pointer check function */
MPP_RET check_is_mpp_packet(void *ptr);
#ifdef __cplusplus
}
#endif
#endif /*__MPP_PACKET_IMPL_H__*/

View File

@@ -255,7 +255,14 @@ MPP_RET mpp_packet_reset(MppPacketImpl *packet)
if (check_is_mpp_packet(packet))
return MPP_ERR_UNKNOW;
void *data = packet->data;
size_t size = packet->size;
memset(packet, 0, sizeof(*packet));
packet->data = data;
packet->pos = data;
packet->size = size;
setup_mpp_packet_name(packet);
return MPP_OK;
}