summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-02-15 07:30:17 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-02-15 07:30:17 +0100
commit6c28744f769c6caf460e1eb6148ebdb4ae62d893 (patch)
tree8816badeb043bf1e0cccf63e60150562a94d157d
parentc080bfae6de775d25d041520808ae686bad7cf0a (diff)
audioresample: Add locking to protect the resampling context
When setting the quality/filter-length while PLAYING the resampling context will be destroyed and created again in some cases, which will cause crashes in the transform function if it's called at that time.
-rw-r--r--gst/audioresample/gstaudioresample.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gst/audioresample/gstaudioresample.c b/gst/audioresample/gstaudioresample.c
index ee4c757c..308f7abd 100644
--- a/gst/audioresample/gstaudioresample.c
+++ b/gst/audioresample/gstaudioresample.c
@@ -1174,16 +1174,19 @@ gst_audio_resample_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_QUALITY:
+ GST_BASE_TRANSFORM_LOCK (resample);
resample->quality = g_value_get_int (value);
GST_DEBUG_OBJECT (resample, "new quality %d", resample->quality);
gst_audio_resample_update_state (resample, resample->width,
resample->channels, resample->inrate, resample->outrate,
resample->quality, resample->fp);
+ GST_BASE_TRANSFORM_UNLOCK (resample);
break;
case PROP_FILTER_LENGTH:{
gint filter_length = g_value_get_int (value);
+ GST_BASE_TRANSFORM_LOCK (resample);
if (filter_length <= 8)
resample->quality = 0;
else if (filter_length <= 16)
@@ -1212,6 +1215,7 @@ gst_audio_resample_set_property (GObject * object, guint prop_id,
gst_audio_resample_update_state (resample, resample->width,
resample->channels, resample->inrate, resample->outrate,
resample->quality, resample->fp);
+ GST_BASE_TRANSFORM_UNLOCK (resample);
break;
}
default: