Skip to content

Commit

Permalink
Don't leak pools if allocated multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
frederik-vestre-pexip committed Nov 16, 2022
1 parent 9ac3ce1 commit 6d76ff7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions gst/gstnicesrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ gst_nice_src_negotiate (GstBaseSrc * basesrc)
gboolean result = FALSE;

caps = gst_pad_get_allowed_caps (GST_BASE_SRC_PAD (basesrc));
if (!caps)
if (caps == NULL)
caps = gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD (basesrc));

GST_OBJECT_LOCK (src);
Expand All @@ -575,17 +575,22 @@ gst_nice_src_negotiate (GstBaseSrc * basesrc)
result = TRUE;
} else {
GstBaseSrcClass *bclass = GST_BASE_SRC_GET_CLASS (basesrc);
if (bclass->fixate)
if (bclass->fixate){
GstCaps *oldcaps = caps;
caps = bclass->fixate (basesrc, caps);
//gst_caps_unref(oldcaps);
}
GST_DEBUG_OBJECT (basesrc, "fixated to: %" GST_PTR_FORMAT, caps);
if (gst_caps_is_fixed (caps)) {
result = gst_base_src_set_caps (basesrc, caps);
}
}
gst_caps_unref (caps);
} else {
GST_DEBUG_OBJECT (basesrc, "no common caps");
}
if (caps != NULL){
gst_caps_unref (caps);
}
return result;
}

Expand Down Expand Up @@ -622,6 +627,8 @@ gst_nice_src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
else
gst_query_add_allocation_pool (query, pool, size, 0, 0);

gst_nice_src_clean_up_pool(src);

src->mem_list_interface.pool = pool;

if (src->agent){
Expand Down

0 comments on commit 6d76ff7

Please sign in to comment.