Verified Commit eb37d5cc authored by James Almer's avatar James Almer

picture: properly handle Dav1dUserData references in Dav1dPicture

parent 8308f4b5
Pipeline #3845 passed with stages
in 5 minutes and 10 seconds
...@@ -113,6 +113,7 @@ void dav1d_data_props_copy(Dav1dDataProps *const dst, ...@@ -113,6 +113,7 @@ void dav1d_data_props_copy(Dav1dDataProps *const dst,
assert(dst != NULL); assert(dst != NULL);
assert(src != NULL); assert(src != NULL);
dav1d_ref_dec(&dst->user_data.ref);
*dst = *src; *dst = *src;
if (dst->user_data.ref) dav1d_ref_inc(dst->user_data.ref); if (dst->user_data.ref) dav1d_ref_inc(dst->user_data.ref);
} }
......
...@@ -92,10 +92,8 @@ struct pic_ctx_context { ...@@ -92,10 +92,8 @@ struct pic_ctx_context {
static void free_buffer(const uint8_t *const data, void *const user_data) { static void free_buffer(const uint8_t *const data, void *const user_data) {
struct pic_ctx_context *pic_ctx = user_data; struct pic_ctx_context *pic_ctx = user_data;
struct Dav1dRef *user_data_ref = pic_ctx->pic.m.user_data.ref;
pic_ctx->allocator.release_picture_callback(&pic_ctx->pic, pic_ctx->allocator.release_picture_callback(&pic_ctx->pic,
pic_ctx->allocator.cookie); pic_ctx->allocator.cookie);
if (user_data_ref) dav1d_ref_dec(&user_data_ref);
free(pic_ctx); free(pic_ctx);
} }
...@@ -203,6 +201,7 @@ void dav1d_picture_ref(Dav1dPicture *const dst, const Dav1dPicture *const src) { ...@@ -203,6 +201,7 @@ void dav1d_picture_ref(Dav1dPicture *const dst, const Dav1dPicture *const src) {
dav1d_ref_inc(src->ref); dav1d_ref_inc(src->ref);
if (src->frame_hdr_ref) dav1d_ref_inc(src->frame_hdr_ref); if (src->frame_hdr_ref) dav1d_ref_inc(src->frame_hdr_ref);
if (src->seq_hdr_ref) dav1d_ref_inc(src->seq_hdr_ref); if (src->seq_hdr_ref) dav1d_ref_inc(src->seq_hdr_ref);
if (src->m.user_data.ref) dav1d_ref_inc(src->m.user_data.ref);
} }
*dst = *src; *dst = *src;
} }
...@@ -236,6 +235,7 @@ void dav1d_picture_unref_internal(Dav1dPicture *const p) { ...@@ -236,6 +235,7 @@ void dav1d_picture_unref_internal(Dav1dPicture *const p) {
dav1d_ref_dec(&p->ref); dav1d_ref_dec(&p->ref);
dav1d_ref_dec(&p->seq_hdr_ref); dav1d_ref_dec(&p->seq_hdr_ref);
dav1d_ref_dec(&p->frame_hdr_ref); dav1d_ref_dec(&p->frame_hdr_ref);
dav1d_ref_dec(&p->m.user_data.ref);
} }
memset(p, 0, sizeof(*p)); memset(p, 0, sizeof(*p));
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment