Mono opus working ok but stereo still crashing?

merge-requests/6/head
Phil Taylor 2021-06-18 23:47:22 +01:00
rodzic bbf981cc24
commit 17f186354e
1 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -487,14 +487,14 @@ void audioHandler::incomingAudio(audioPacket inPacket)
if (setup.codec == 0x40 || setup.codec == 0x80) {
unsigned char* in = (unsigned char*)inPacket.data.data();
/* Encode the frame. */
QByteArray outPacket(chunkSize * setup.radioChan * 2, (char)0xff); // Preset the output buffer size.
QByteArray outPacket((chunkSize * setup.radioChan * 2), (char)0xff); // Preset the output buffer size.
qint16* out = (qint16*)outPacket.data();
int nbBytes = 0;
//while (lastSentSeq>0 && lastSentSeq++ < inPacket.seq)
//{
// nbBytes = opus_decode(decoder, Q_NULLPTR, inPacket.data.size(), out, outPacket.size(), 1);
//}
nbBytes = opus_decode(decoder, in, inPacket.data.size(), out, outPacket.size()/2, 0);
nbBytes = opus_decode(decoder, in, inPacket.data.size(), out, outPacket.size()/2 , 0);
if (nbBytes < 0)
{
@ -508,11 +508,11 @@ void audioHandler::incomingAudio(audioPacket inPacket)
outPacket.resize(nbBytes * 2);
}
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "Opus decoded" << inPacket.data.size() << "bytes, into" << outPacket.length() << "bytes";
inPacket.data.clear();
inPacket.data = outPacket; // Replace incoming data with converted.
//inPacket.data.clear();
inPacket.data = outPacket.data(); // Replace incoming data with converted.
}
}
//return;
//qDebug(logAudio()) << "Got" << setup.bits << "bits, length" << inPacket.data.length();
// Incoming data is 8bits?