summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rondeau2011-08-02 20:46:50 -0400
committerTom Rondeau2011-08-02 20:46:50 -0400
commit6f79b8be8f7edb8cc6f18b6a12ede2858d65b681 (patch)
tree352a71b208c26253faf993347b10346417427135
parent8e1f9ce7dde6ba00cdaf6df8f08a602e4a3843b5 (diff)
downloadgnuradio-6f79b8be8f7edb8cc6f18b6a12ede2858d65b681.tar.gz
gnuradio-6f79b8be8f7edb8cc6f18b6a12ede2858d65b681.tar.bz2
gnuradio-6f79b8be8f7edb8cc6f18b6a12ede2858d65b681.zip
patch: applying Alexandru Csete's patch (that I though I already applied...)
-rw-r--r--gr-audio/lib/alsa/audio_alsa_source.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/gr-audio/lib/alsa/audio_alsa_source.cc b/gr-audio/lib/alsa/audio_alsa_source.cc
index 4f0042b22..2f4506f71 100644
--- a/gr-audio/lib/alsa/audio_alsa_source.cc
+++ b/gr-audio/lib/alsa/audio_alsa_source.cc
@@ -217,8 +217,14 @@ audio_alsa_source::check_topology (int ninputs, int noutputs)
unsigned int nchan = noutputs;
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_stereo_to_mono;
if (special_case)