From db1f10adc81aeb0508f5ebee2281bac9d20b3080 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ren=C3=A9=20Stadler?= Date: Sun, 16 Oct 2011 20:25:41 +0200 Subject: [PATCH] pngenc: don't unconditionally allocate 4096 pointers on the stack Instead allocate as many as needed (on the stack still). --- ext/libpng/gstpngenc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/libpng/gstpngenc.c b/ext/libpng/gstpngenc.c index 7bad037..8ccb804 100644 --- a/ext/libpng/gstpngenc.c +++ b/ext/libpng/gstpngenc.c @@ -30,8 +30,6 @@ #include #include -#define MAX_HEIGHT 4096 - GST_DEBUG_CATEGORY_STATIC (pngenc_debug); #define GST_CAT_DEFAULT pngenc_debug @@ -263,7 +261,7 @@ gst_pngenc_chain (GstPad * pad, GstBuffer * buf) { GstPngEnc *pngenc; gint row_index; - png_byte *row_pointers[MAX_HEIGHT]; + png_byte **row_pointers; GstFlowReturn ret = GST_FLOW_OK; GstBuffer *encoded_buf = NULL; @@ -331,6 +329,8 @@ gst_pngenc_chain (GstPad * pad, GstBuffer * buf) png_set_write_fn (pngenc->png_struct_ptr, pngenc, (png_rw_ptr) user_write_data, user_flush_data); + row_pointers = g_newa (png_byte *, pngenc->height); + for (row_index = 0; row_index < pngenc->height; row_index++) { row_pointers[row_index] = GST_BUFFER_DATA (buf) + (row_index * pngenc->stride); -- 2.7.4