...
 
Commits (1)
......@@ -44,7 +44,7 @@ uint8_t *dav1d_data_create_internal(Dav1dData *const buf, const size_t sz) {
buf->ref = dav1d_ref_create(sz);
if (!buf->ref) return NULL;
buf->data = buf->ref->const_data;
buf->data = buf->ref->data;
buf->sz = buf->m.size = sz;
buf->m.timestamp = INT64_MIN;
buf->m.duration = 0;
......
......@@ -58,9 +58,7 @@ Dav1dRef *dav1d_ref_wrap(const uint8_t *const ptr,
Dav1dRef *res = malloc(sizeof(Dav1dRef));
if (!res) return NULL;
if (ptr == user_data)
res->data = user_data;
res->const_data = ptr;
res->data = (void *)ptr;
atomic_init(&res->ref_cnt, 1);
res->free_callback = free_callback;
res->user_data = user_data;
......@@ -79,7 +77,7 @@ void dav1d_ref_dec(Dav1dRef **const pref) {
if (!ref) return;
if (atomic_fetch_sub(&ref->ref_cnt, 1) == 1) {
ref->free_callback(ref->const_data, ref->user_data);
ref->free_callback(ref->data, ref->user_data);
free(ref);
}
*pref = NULL;
......
......@@ -35,7 +35,6 @@
struct Dav1dRef {
void *data;
const void *const_data;
atomic_int ref_cnt;
void (*free_callback)(const uint8_t *data, void *user_data);
void *user_data;
......