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
int nBytesRecorded = SDL_DequeueAudio(devid_in, sampleAmplitude.data(), samplesPerFrame*sampleSizeBytes);
if (nBytesRecorded != 0) {
g_totalBytesCaptured += nBytesRecorded;
{
float fsum = 0.0f;
sampleAmplitudeHistory[historyId] = sampleAmplitude;
@@ -353,6 +351,8 @@ struct DataRxTx {
if (fsum == 0.0f) {
g_totalBytesCaptured = 0;
} else {
g_totalBytesCaptured += nBytesRecorded;
}
}
@@ -732,7 +732,7 @@ extern "C" {
int getFramesToAnalyze() { return g_data->framesToAnalyze; }
int getFramesLeftToAnalyze() { return g_data->framesLeftToAnalyze; }
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(); }
void setParameters(

View File

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