mirror of
https://github.com/ggerganov/wave-share.git
synced 2026-04-27 10:59:28 +08:00
Fix empty capture spectrum check
This commit is contained in:
6
main.cpp
6
main.cpp
@@ -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(
|
||||||
|
|||||||
2
main.js
2
main.js
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user