audiotestsrc: fix crash when setting the wave property before having negotiated a format

https://bugzilla.gnome.org/show_bug.cgi?id=661911
This commit is contained in:
Tim-Philipp Müller 2011-10-17 15:41:58 +01:00
parent 1c10fbcd33
commit a586547b0c

View file

@ -878,13 +878,19 @@ static const ProcessFunc violet_noise_funcs[] = {
/* /*
* gst_audio_test_src_change_wave: * gst_audio_test_src_change_wave:
* Assign function pointer of wave genrator. * Assign function pointer of wave generator.
*/ */
static void static void
gst_audio_test_src_change_wave (GstAudioTestSrc * src) gst_audio_test_src_change_wave (GstAudioTestSrc * src)
{ {
gint idx; gint idx;
/* not negotiated yet? */
if (src->info.finfo == NULL) {
src->process = NULL;
return;
}
switch (GST_AUDIO_FORMAT_INFO_FORMAT (src->info.finfo)) { switch (GST_AUDIO_FORMAT_INFO_FORMAT (src->info.finfo)) {
case GST_AUDIO_FORMAT_S16: case GST_AUDIO_FORMAT_S16:
idx = 0; idx = 0;