pool_handle = (media_packet_pool_s *)pool;
- /* increase format reference count */
- if (media_format_ref(fmt) != MEDIA_FORMAT_ERROR_NONE) {
- LOGE("failed to increase ref count");
- return MEDIA_PACKET_ERROR_INVALID_OPERATION;
- }
pool_handle->fmt_h = fmt;
return ret;
LOGD("[%d]%p queued", i, pool_handle->packet[i]);
pool_handle->curr_pool_size++;
}
+
+ /* increase format reference count */
+ if (media_format_ref(pool_handle->fmt_h) != MEDIA_FORMAT_ERROR_NONE) {
+ LOGE("failed to increase ref count");
+ return MEDIA_PACKET_ERROR_INVALID_OPERATION;
+ }
+
g_atomic_int_set(&pool_handle->pool_allocated, 1);
return ret;
return ret;
}
}
+
+ /* unreference media_format */
+ if (media_format_unref(pool_handle->fmt_h) != MEDIA_FORMAT_ERROR_NONE) {
+ LOGE("failed to decrease ref count");
+ g_mutex_unlock(&pool_handle->mutex);
+ return MEDIA_PACKET_ERROR_INVALID_OPERATION;
+ }
+
g_mutex_unlock(&pool_handle->mutex);
return ret;
return MEDIA_PACKET_ERROR_INVALID_OPERATION;
}
- /* unreference media_format */
- if (media_format_unref(pool_handle->fmt_h) != MEDIA_FORMAT_ERROR_NONE) {
- LOGE("failed to decrease ref count");
- return MEDIA_PACKET_ERROR_INVALID_OPERATION;
- }
-
g_queue_free(pool_handle->queue);
LOGI("The packet pool handle(%p) will be destroyed..", pool_handle);
free(pool_handle);