mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-13 01:35:30 +00:00
goom: don't allocate 260kB struct on the stack
PluginInfo is quite a sizeable struct, let's not allocate it on the stack, especially not if we're copying it over into another dynamically allocated copy anyway. Fixes #570761.
This commit is contained in:
parent
b47b393566
commit
cf8dddd5c7
1 changed files with 32 additions and 32 deletions
|
@ -46,6 +46,7 @@
|
||||||
#include "mmx.h"
|
#include "mmx.h"
|
||||||
#endif /* HAVE_MMX */
|
#endif /* HAVE_MMX */
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_EXTERN (goom_debug);
|
GST_DEBUG_CATEGORY_EXTERN (goom_debug);
|
||||||
#define GST_CAT_DEFAULT goom_debug
|
#define GST_CAT_DEFAULT goom_debug
|
||||||
|
@ -115,46 +116,45 @@ void
|
||||||
plugin_info_init (PluginInfo * pp, int nbVisuals)
|
plugin_info_init (PluginInfo * pp, int nbVisuals)
|
||||||
{
|
{
|
||||||
|
|
||||||
PluginInfo p = { 0, };
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
p.sound.speedvar = p.sound.accelvar = p.sound.totalgoom = 0;
|
memset (pp, 0, sizeof (PluginInfo));
|
||||||
p.sound.prov_max = 0;
|
|
||||||
p.sound.goom_limit = 1;
|
|
||||||
p.sound.allTimesMax = 1;
|
|
||||||
p.sound.timeSinceLastGoom = 1;
|
|
||||||
p.sound.timeSinceLastBigGoom = 1;
|
|
||||||
p.sound.cycle = 0;
|
|
||||||
|
|
||||||
secure_f_feedback (&p.sound.volume_p, "Sound Volume");
|
pp->sound.speedvar = pp->sound.accelvar = pp->sound.totalgoom = 0;
|
||||||
secure_f_feedback (&p.sound.accel_p, "Sound Acceleration");
|
pp->sound.prov_max = 0;
|
||||||
secure_f_feedback (&p.sound.speed_p, "Sound Speed");
|
pp->sound.goom_limit = 1;
|
||||||
secure_f_feedback (&p.sound.goom_limit_p, "Goom Limit");
|
pp->sound.allTimesMax = 1;
|
||||||
secure_f_feedback (&p.sound.last_goom_p, "Goom Detection");
|
pp->sound.timeSinceLastGoom = 1;
|
||||||
secure_f_feedback (&p.sound.last_biggoom_p, "Big Goom Detection");
|
pp->sound.timeSinceLastBigGoom = 1;
|
||||||
secure_f_feedback (&p.sound.goom_power_p, "Goom Power");
|
pp->sound.cycle = 0;
|
||||||
|
|
||||||
secure_i_param (&p.sound.biggoom_speed_limit_p, "Big Goom Speed Limit");
|
secure_f_feedback (&pp->sound.volume_p, "Sound Volume");
|
||||||
IVAL (p.sound.biggoom_speed_limit_p) = 10;
|
secure_f_feedback (&pp->sound.accel_p, "Sound Acceleration");
|
||||||
IMIN (p.sound.biggoom_speed_limit_p) = 0;
|
secure_f_feedback (&pp->sound.speed_p, "Sound Speed");
|
||||||
IMAX (p.sound.biggoom_speed_limit_p) = 100;
|
secure_f_feedback (&pp->sound.goom_limit_p, "Goom Limit");
|
||||||
ISTEP (p.sound.biggoom_speed_limit_p) = 1;
|
secure_f_feedback (&pp->sound.last_goom_p, "Goom Detection");
|
||||||
|
secure_f_feedback (&pp->sound.last_biggoom_p, "Big Goom Detection");
|
||||||
|
secure_f_feedback (&pp->sound.goom_power_p, "Goom Power");
|
||||||
|
|
||||||
secure_i_param (&p.sound.biggoom_factor_p, "Big Goom Factor");
|
secure_i_param (&pp->sound.biggoom_speed_limit_p, "Big Goom Speed Limit");
|
||||||
IVAL (p.sound.biggoom_factor_p) = 10;
|
IVAL (pp->sound.biggoom_speed_limit_p) = 10;
|
||||||
IMIN (p.sound.biggoom_factor_p) = 0;
|
IMIN (pp->sound.biggoom_speed_limit_p) = 0;
|
||||||
IMAX (p.sound.biggoom_factor_p) = 100;
|
IMAX (pp->sound.biggoom_speed_limit_p) = 100;
|
||||||
ISTEP (p.sound.biggoom_factor_p) = 1;
|
ISTEP (pp->sound.biggoom_speed_limit_p) = 1;
|
||||||
|
|
||||||
plugin_parameters (&p.sound.params, "Sound", 11);
|
secure_i_param (&pp->sound.biggoom_factor_p, "Big Goom Factor");
|
||||||
|
IVAL (pp->sound.biggoom_factor_p) = 10;
|
||||||
|
IMIN (pp->sound.biggoom_factor_p) = 0;
|
||||||
|
IMAX (pp->sound.biggoom_factor_p) = 100;
|
||||||
|
ISTEP (pp->sound.biggoom_factor_p) = 1;
|
||||||
|
|
||||||
p.nbParams = 0;
|
plugin_parameters (&pp->sound.params, "Sound", 11);
|
||||||
p.params = NULL;
|
|
||||||
p.nbVisuals = nbVisuals;
|
pp->nbParams = 0;
|
||||||
p.visuals = (VisualFX **) malloc (sizeof (VisualFX *) * nbVisuals);
|
pp->params = NULL;
|
||||||
|
pp->nbVisuals = nbVisuals;
|
||||||
|
pp->visuals = (VisualFX **) malloc (sizeof (VisualFX *) * nbVisuals);
|
||||||
|
|
||||||
/* huh, we're setting a local variable and now copying it over? */
|
|
||||||
*pp = p;
|
|
||||||
pp->sound.params.params[0] = &pp->sound.biggoom_speed_limit_p;
|
pp->sound.params.params[0] = &pp->sound.biggoom_speed_limit_p;
|
||||||
pp->sound.params.params[1] = &pp->sound.biggoom_factor_p;
|
pp->sound.params.params[1] = &pp->sound.biggoom_factor_p;
|
||||||
pp->sound.params.params[2] = 0;
|
pp->sound.params.params[2] = 0;
|
||||||
|
|
Loading…
Reference in a new issue