diff --git a/ChangeLog b/ChangeLog index b6b35342d3..7520648871 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-11-11 Ronald S. Bultje + + * ext/alsa/gstalsa.c: (gst_alsa_change_state): + Only set hardware parameters *after* negotiation. Before + negotiation, it will set ANY and that seems to cause crashes + (see e.g. #151288, #153227). + 2004-11-10 Ronald S. Bultje * ext/alsa/gstalsasink.c: (gst_alsa_sink_get_time): diff --git a/ext/alsa/gstalsa.c b/ext/alsa/gstalsa.c index 8c35e5a572..cfe94c4ed5 100644 --- a/ext/alsa/gstalsa.c +++ b/ext/alsa/gstalsa.c @@ -1100,9 +1100,6 @@ gst_alsa_change_state (GstElement * element) return GST_STATE_FAILURE; break; case GST_STATE_READY_TO_PAUSED: - if (!(GST_FLAG_IS_SET (element, GST_ALSA_RUNNING) || - gst_alsa_start_audio (this))) - return GST_STATE_FAILURE; this->played = 0; this->captured = 0; break; @@ -1113,8 +1110,14 @@ gst_alsa_change_state (GstElement * element) snd_strerror (err)); return GST_STATE_FAILURE; } - } else if (!(GST_FLAG_IS_SET (element, GST_ALSA_RUNNING) || - gst_alsa_start_audio (this))) { + } + /* If we were already negotiated, but we are not running, then + * we stopped (probably because we paused), so re-start. If + * there's no format, we didn't negotiate yet so don't do + * anything because ALSA will crash (#151288, #153227, etc.). */ + else if (this->format != NULL && + !GST_FLAG_IS_SET (element, GST_ALSA_RUNNING) && + !gst_alsa_start_audio (this)) { return GST_STATE_FAILURE; } gst_alsa_clock_start (this->clock);