Fix a race condition caused by global state in the equalizer.

This commit is contained in:
David Sansome 2010-04-12 20:33:59 +00:00
parent 1070a5fd07
commit c08179aa94
3 changed files with 10 additions and 3 deletions

View File

@ -399,7 +399,7 @@ void GstEngine::SetEqualizerEnabled(bool enabled) {
}
void GstEngine::SetEqualizerParameters( int preamp, const QList<int>& band_gains ) {
void GstEngine::SetEqualizerParameters(int preamp, const QList<int>& band_gains) {
equalizer_preamp_ = preamp;
equalizer_gains_ = band_gains;

View File

@ -110,6 +110,9 @@ void gst_equalizer_class_init(GstEqualizerClass* klass) {
void gst_equalizer_init(GstEqualizer* obj, GstEqualizerClass* klass) {
// Properties
obj->active = false;
obj->i = 0;
obj->j = 2;
obj->k = 1;
}
@ -233,8 +236,10 @@ static GstFlowReturn gst_equalizer_transform_ip(GstBaseTransform* base,
/* Indexes for the history arrays
* These have to be kept between calls to this function
* hence they are static */
static gint i = 0, j = 2, k = 1;
* hence they are members of the equalizer object */
int& i = obj->i;
int& j = obj->j;
int& k = obj->k;
gint index, band, channel;
gint halflength;

View File

@ -66,6 +66,8 @@ struct _GstEqualizer {
sIIRCoefficients* iir_cf;
sXYData data_history[EQ_MAX_BANDS][EQ_CHANNELS] __attribute__((aligned));
int i, j, k;
};
struct _GstEqualizerClass {