Fix if 0 samples detected

merge-requests/9/merge
Phil Taylor 2022-05-08 20:57:35 +01:00
rodzic 7098564121
commit 3e0c008144
1 zmienionych plików z 130 dodań i 130 usunięć

Wyświetl plik

@ -84,7 +84,7 @@ bool audioConverter::convert(audioPacket audio)
{
// If inFormat and outFormat are identical, just emit the data back.
if (audio.data.size() != 0 && inFormat != outFormat)
if (audio.data.size() > 0 && inFormat != outFormat)
{
if (inFormat.codec() == "audio/opus")
@ -154,14 +154,13 @@ bool audioConverter::convert(audioPacket audio)
qInfo(logAudio()) << "Unsupported Sample Type:" << inFormat.sampleType() << "Size:" << inFormat.sampleSize();
}
if (samplesF.size() > 0)
{
audio.amplitude = samplesF.array().abs().maxCoeff();
// Set the volume
samplesF *= audio.volume;
/*
samplesF is now an Eigen Vector of the current samples in float format
The next step is to convert to the correct number of channels in outFormat.channelCount()
@ -301,6 +300,7 @@ bool audioConverter::convert(audioPacket audio)
}
}
}
}
emit converted(audio);
return true;