mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
pngenc: don't unconditionally allocate 4096 pointers on the stack
Instead allocate as many as needed (on the stack still).
This commit is contained in:
parent
65f9354803
commit
db1f10adc8
1 changed files with 3 additions and 3 deletions
|
@ -30,8 +30,6 @@
|
|||
#include <gst/video/video.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#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);
|
||||
|
|
Loading…
Reference in a new issue