1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

Race condition.

This commit is contained in:
John Greb 2014-12-02 16:57:42 +00:00
parent 3ec45e00ad
commit 9d18a9a1e9
5 changed files with 20 additions and 11 deletions

View File

@ -93,8 +93,8 @@ bool FCDInput::startInput(int device)
m_deviceDescription = QString("Funcube Dongle"); m_deviceDescription = QString("Funcube Dongle");
if (!applySettings(m_generalSettings, m_settings, true)) // if (!applySettings(m_generalSettings, m_settings, true))
qCritical("FCD: Unable to set config at start"); // qCritical("FCD: Unable to set config at start");
qDebug("FCDInput: start"); qDebug("FCDInput: start");
return true; return true;

View File

@ -15,6 +15,7 @@
bool FCDThread::OpenSource(const char* cardname) bool FCDThread::OpenSource(const char* cardname)
{ {
bool fail = false;
snd_pcm_hw_params_t* params; snd_pcm_hw_params_t* params;
//fcd_rate = FCDPP_RATE; //fcd_rate = FCDPP_RATE;
//fcd_channels =2; //fcd_channels =2;
@ -28,14 +29,21 @@ bool FCDThread::OpenSource(const char* cardname)
snd_pcm_hw_params_alloca(&params); snd_pcm_hw_params_alloca(&params);
if ( snd_pcm_hw_params_any(fcd_handle, params) < 0 ) if ( snd_pcm_hw_params_any(fcd_handle, params) < 0 )
qCritical("Funcube Dongle read settings failed"); fail = true;
else if ( snd_pcm_hw_params(fcd_handle, params) < 0 ) else if ( snd_pcm_hw_params(fcd_handle, params) < 0 ) {
qCritical("Funcube Dongle write settings failed"); fail = true;
// TODO: check actual samplerate, may be crippled firmware // TODO: check actual samplerate, may be crippled firmware
} else {
if ( snd_pcm_start(fcd_handle) < 0 ) if ( snd_pcm_start(fcd_handle) < 0 )
fail = true;
}
if (fail) {
qCritical("Funcube Dongle stream start failed"); 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; return true;
} }

View File

@ -22,6 +22,7 @@
FCDThread::FCDThread(SampleFifo* sampleFifo, QObject* parent) : FCDThread::FCDThread(SampleFifo* sampleFifo, QObject* parent) :
QThread(parent), QThread(parent),
fcd_handle(NULL),
m_running(false), m_running(false),
m_convertBuffer(BLOCKSIZE), m_convertBuffer(BLOCKSIZE),
m_sampleFifo(sampleFifo) m_sampleFifo(sampleFifo)

View File

@ -44,7 +44,7 @@ public:
int work(int n_items); int work(int n_items);
private: private:
snd_pcm_format_t fcd_format; snd_pcm_format_t fcd_format;
snd_pcm_t* fcd_handle = NULL; snd_pcm_t* fcd_handle;
QMutex m_startWaitMutex; QMutex m_startWaitMutex;
QWaitCondition m_startWaiter; QWaitCondition m_startWaiter;

View File

@ -96,7 +96,7 @@ bool V4LInput::startInput(int device)
qDebug("V4LInput: start"); qDebug("V4LInput: start");
MsgReportV4L::create(m_gains)->submit(m_guiMessageQueue); MsgReportV4L::create(m_gains)->submit(m_guiMessageQueue);
applySettings(m_generalSettings, m_settings, true); // applySettings(m_generalSettings, m_settings, true);
return true; return true;
} }