Fix empty capture spectrum check

This commit is contained in:
Georgi Gerganov
2018-05-05 10:14:34 +03:00
parent db1c128f56
commit 948ba4e64d
2 changed files with 5 additions and 3 deletions

View File

@@ -316,8 +316,6 @@ struct DataRxTx {
// read capture data // read capture data
int nBytesRecorded = SDL_DequeueAudio(devid_in, sampleAmplitude.data(), samplesPerFrame*sampleSizeBytes); int nBytesRecorded = SDL_DequeueAudio(devid_in, sampleAmplitude.data(), samplesPerFrame*sampleSizeBytes);
if (nBytesRecorded != 0) { if (nBytesRecorded != 0) {
g_totalBytesCaptured += nBytesRecorded;
{ {
float fsum = 0.0f; float fsum = 0.0f;
sampleAmplitudeHistory[historyId] = sampleAmplitude; sampleAmplitudeHistory[historyId] = sampleAmplitude;
@@ -353,6 +351,8 @@ struct DataRxTx {
if (fsum == 0.0f) { if (fsum == 0.0f) {
g_totalBytesCaptured = 0; g_totalBytesCaptured = 0;
} else {
g_totalBytesCaptured += nBytesRecorded;
} }
} }
@@ -732,7 +732,7 @@ extern "C" {
int getFramesToAnalyze() { return g_data->framesToAnalyze; } int getFramesToAnalyze() { return g_data->framesToAnalyze; }
int getFramesLeftToAnalyze() { return g_data->framesLeftToAnalyze; } int getFramesLeftToAnalyze() { return g_data->framesLeftToAnalyze; }
int hasDeviceOutput() { return devid_out; } int hasDeviceOutput() { return devid_out; }
int hasDeviceCapture() { return (g_totalBytesCaptured > 0) ? devid_in : 0; } int hasDeviceCapture() { return (g_totalBytesCaptured > 32*1024) ? devid_in : 0; }
int doInit() { return init(); } int doInit() { return init(); }
void setParameters( void setParameters(

View File

@@ -538,6 +538,8 @@ function checkRxForPeerData() {
lastReceiverAnswerSDP = '{"type":"answer","sdp":'+JSON.stringify(writeSDP(res))+'}'; lastReceiverAnswerSDP = '{"type":"answer","sdp":'+JSON.stringify(writeSDP(res))+'}';
playSound("/media/open-ended"); playSound("/media/open-ended");
peerInfo.innerHTML= "Trying to connect with " + vals[0] + " ...";
senderSend(); senderSend();
return; return;