diff options
author | Tom Rondeau | 2010-12-22 17:41:30 -0500 |
---|---|---|
committer | Tom Rondeau | 2010-12-22 17:41:30 -0500 |
commit | 64ee9a2973e6c217c54f8cb0433ab24b0e52e2cc (patch) | |
tree | 4abf8b15b088ceef22f4f34edb04e0d708aee5f5 /gr-audio-alsa | |
parent | a8e58dba4d820e0b66d89bf05af29c381e46eef9 (diff) | |
download | gnuradio-64ee9a2973e6c217c54f8cb0433ab24b0e52e2cc.tar.gz gnuradio-64ee9a2973e6c217c54f8cb0433ab24b0e52e2cc.tar.bz2 gnuradio-64ee9a2973e6c217c54f8cb0433ab24b0e52e2cc.zip |
A new patch for fixing the alsa restart issue. Submitted by Volker Schroer.
Diffstat (limited to 'gr-audio-alsa')
-rw-r--r-- | gr-audio-alsa/src/audio_alsa_sink.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gr-audio-alsa/src/audio_alsa_sink.cc b/gr-audio-alsa/src/audio_alsa_sink.cc index c28e23fea..d44a93b3f 100644 --- a/gr-audio-alsa/src/audio_alsa_sink.cc +++ b/gr-audio-alsa/src/audio_alsa_sink.cc @@ -221,9 +221,15 @@ audio_alsa_sink::check_topology (int ninputs, int noutputs) int nchan = ninputs; int err; - // FIXME check_topology may be called more than once. + // Check the state of the stream // Ensure that the pcm is in a state where we can still mess with the hw_params - + snd_pcm_state_t state; + state=snd_pcm_state(d_pcm_handle); + if ( state== SND_PCM_STATE_RUNNING) + return true; // If stream is running, don't change any parameters + else if(state == SND_PCM_STATE_XRUN ) + snd_pcm_prepare ( d_pcm_handle ); // Prepare stream on underrun, and we can set parameters; + bool special_case = nchan == 1 && d_special_case_mono_to_stereo; if (special_case) nchan = 2; |