mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-11 02:08:46 -04:00
Race condition.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
|
||||
bool FCDThread::OpenSource(const char* cardname)
|
||||
{
|
||||
bool fail = false;
|
||||
snd_pcm_hw_params_t* params;
|
||||
//fcd_rate = FCDPP_RATE;
|
||||
//fcd_channels =2;
|
||||
@@ -28,14 +29,21 @@ bool FCDThread::OpenSource(const char* cardname)
|
||||
|
||||
snd_pcm_hw_params_alloca(¶ms);
|
||||
if ( snd_pcm_hw_params_any(fcd_handle, params) < 0 )
|
||||
qCritical("Funcube Dongle read settings failed");
|
||||
else if ( snd_pcm_hw_params(fcd_handle, params) < 0 )
|
||||
qCritical("Funcube Dongle write settings failed");
|
||||
// TODO: check actual samplerate, may be crippled firmware
|
||||
|
||||
if ( snd_pcm_start(fcd_handle) < 0 )
|
||||
fail = true;
|
||||
else if ( snd_pcm_hw_params(fcd_handle, params) < 0 ) {
|
||||
fail = true;
|
||||
// TODO: check actual samplerate, may be crippled firmware
|
||||
} else {
|
||||
if ( snd_pcm_start(fcd_handle) < 0 )
|
||||
fail = true;
|
||||
}
|
||||
if (fail) {
|
||||
qCritical("Funcube Dongle stream start failed");
|
||||
else qDebug("Funcube stream started");
|
||||
snd_pcm_close( fcd_handle );
|
||||
return false;
|
||||
} else {
|
||||
qDebug("Funcube stream started");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user