Skip to content

Instantly share code, notes, and snippets.

@gstark
Created May 1, 2012 22:06
Show Gist options
  • Save gstark/2571816 to your computer and use it in GitHub Desktop.
Save gstark/2571816 to your computer and use it in GitHub Desktop.
gstvideoscale_patch.diff
diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c
index 7b44647..5618b37 100644
--- a/gst/videoscale/gstvideoscale.c
+++ b/gst/videoscale/gstvideoscale.c
@@ -307,6 +307,7 @@ gst_video_scale_class_init (GstVideoScaleClass * klass)
static void
gst_video_scale_init (GstVideoScale * videoscale, GstVideoScaleClass * klass)
{
+ GST_DEBUG("GES: calling video scale init");
videoscale->tmp_buf = NULL;
videoscale->method = DEFAULT_PROP_METHOD;
videoscale->add_borders = DEFAULT_PROP_ADD_BORDERS;
@@ -320,8 +321,12 @@ gst_video_scale_init (GstVideoScale * videoscale, GstVideoScaleClass * klass)
static void
gst_video_scale_finalize (GstVideoScale * videoscale)
{
+ GST_DEBUG("GES: calling video scale finalize");
if (videoscale->tmp_buf)
+ {
+ GST_DEBUG("GES: calling video scale free");
g_free (videoscale->tmp_buf);
+ }
G_OBJECT_CLASS (parent_class)->finalize (G_OBJECT (videoscale));
}
@@ -521,7 +526,11 @@ gst_video_scale_set_caps (GstBaseTransform * trans, GstCaps * in, GstCaps * out)
}
if (videoscale->tmp_buf)
+ {
+ GST_DEBUG("GES: calling video scale free before malloc");
g_free (videoscale->tmp_buf);
+ }
+ GST_DEBUG("GES: calling video scale malloc");
videoscale->tmp_buf = g_malloc (videoscale->to_width * 8 * 4);
gst_base_transform_set_passthrough (trans,
@gstark
Copy link
Author

gstark commented May 1, 2012

Apply this patch against 0.10.36. When I run this with GST_DEBUG=*:5 and you'll see that there is something leading to memory leaks. I don't think its in videoscale but it was the clearest spot I could find to place some debugging to trace. (it also showed as the largest leak in valgrind)

gst-launch playbin2 uri=......

0:00:00.676655349  2908  0x938e120 DEBUG             videoscale gstvideoscale.c:310:gst_video_scale_init: GES: calling video scale init
0:00:00.838913586  2908 0xb5e05120 DEBUG             videoscale gstvideoscale.c:533:gst_video_scale_set_caps: GES: calling video scale malloc
0:00:00.841475643  2908 0xb5e05120 DEBUG             videoscale gstvideoscale.c:530:gst_video_scale_set_caps: GES: calling video scale free before malloc
0:00:00.841486201  2908 0xb5e05120 DEBUG             videoscale gstvideoscale.c:533:gst_video_scale_set_caps: GES: calling video scale malloc

However.

gst-launch playbin uri=......

0:00:01.136025328  2485  0x8dbeef0 DEBUG             videoscale gstvideoscale.c:310:gst_video_scale_init: GES: calling video scale init
0:00:01.444486894  2485 0xb609fc60 DEBUG             videoscale gstvideoscale.c:533:gst_video_scale_set_caps: GES: calling video scale malloc
0:00:03.937730093  2485  0x8db9600 DEBUG             videoscale gstvideoscale.c:324:gst_video_scale_finalize: GES: calling video scale finalize
0:00:03.937742026  2485  0x8db9600 DEBUG             videoscale gstvideoscale.c:327:gst_video_scale_finalize: GES: calling video scale free

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment