Merge branch 'audio-enhance'

monitor
Roeland Jansen 2021-11-10 20:32:26 +01:00
commit 1503ecd9f7
1 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -575,7 +575,6 @@ qint64 audioHandler::writeData(const char* data, qint64 nBytes)
#endif
}
void audioHandler::incomingAudio(audioPacket inPacket)
{
// No point buffering audio until stream is actually running.
@ -594,8 +593,13 @@ void audioHandler::incomingAudio(audioPacket inPacket)
/* Decode the frame. */
QByteArray outPacket((setup.samplerate / 50) * sizeof(qint16) * setup.radioChan, (char)0xff); // Preset the output buffer size.
qint16* out = (qint16*)outPacket.data();
int nSamples = opus_decode(decoder, in, inPacket.data.size(), out, (setup.samplerate / 50), 0);
int nSamples = opus_packet_get_nb_samples(in, inPacket.data.size(),setup.samplerate);
if (nSamples != setup.samplerate / 50)
{
qInfo(logAudio()) << "Opus nSamples=" << nSamples << " expected:" << (setup.samplerate / 50);
return;
}
nSamples = opus_decode(decoder, in, inPacket.data.size(), out, (setup.samplerate / 50), 0);
if (nSamples < 0)
{