static void __pkt_deinit(media_packet_s *handle)
{
- MEDIA_PACKET_NULL_ARG_CHECK(handle);
+ if (!handle) {
+ LOGW("NULL handle");
+ return;
+ }
media_format_unref(handle->format);
handle->format = NULL;
for (i = 0; i < g_handle_num; i++) {
if (g_media_packet[i] != NULL) {
- ref_count = MEDIA_FORMAT_GET_REFCOUNT(g_media_format[media_format_idx]);
+ if (g_media_format[media_format_idx])
+ ref_count = MEDIA_FORMAT_GET_REFCOUNT(g_media_format[media_format_idx]);
+ else
+ ref_count = -1;
ret = media_packet_destroy(g_media_packet[i]);
g_media_packet[i] = NULL;
for (i = 0; i < g_handle_num; i++) {
if (g_media_packet[i] != NULL) {
- ref_count = MEDIA_FORMAT_GET_REFCOUNT(g_media_format[media_format_idx]);
+ if (g_media_format[media_format_idx])
+ ref_count = MEDIA_FORMAT_GET_REFCOUNT(g_media_format[media_format_idx]);
+ else
+ ref_count = -1;
media_packet_destroy(g_media_packet[i]);
g_media_packet[i] = NULL;
if (ref_count == 1) {
for (i = 0; i < MEDIA_FORMAT_MAX_HANDLE; i++) {
if (g_media_format[i] != NULL) {
- int ref_count = MEDIA_FORMAT_GET_REFCOUNT(g_media_format[i]);
+ ref_count = MEDIA_FORMAT_GET_REFCOUNT(g_media_format[i]);
g_print("media_format_h[%d] ref_count:%d. excute media_format_unref().\n", i, ref_count);
if (ref_count == 1) {