kopia lustrzana https://gitlab.com/eliggett/wfview
rodzic
3036108d6f
commit
6e44480d6b
|
@ -601,19 +601,17 @@ 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_packet_get_nb_samples(in, livePacket.data.size(), setup.samplerate);
|
||||
if (nSamples < 1)
|
||||
int nSamples = opus_packet_get_nb_samples(in, livePacket.data.size(),setup.samplerate);
|
||||
if (nSamples != setup.samplerate / 50)
|
||||
{
|
||||
qInfo(logAudio()) << "Opus nSamples=" << nSamples << " expected:" << (setup.samplerate / 50);
|
||||
return;
|
||||
}
|
||||
if (livePacket.seq > lastSentSeq + 1) {
|
||||
opus_decoder_ctl(decoder, OPUS_GET_LAST_PACKET_DURATION(&nSamples));
|
||||
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Attempting FEC on packet" << inPacket.seq << "as last is" << lastSentSeq << "nSamples=" << nSamples;
|
||||
nSamples = opus_decode(decoder, in, livePacket.data.size(), out, nSamples, 1);
|
||||
nSamples = opus_decode(decoder, in, livePacket.data.size(), out, (setup.samplerate / 50), 1);
|
||||
}
|
||||
else {
|
||||
nSamples = opus_decode(decoder, in, livePacket.data.size(), out, nSamples, 0);
|
||||
nSamples = opus_decode(decoder, in, livePacket.data.size(), out, (setup.samplerate / 50), 0);
|
||||
}
|
||||
if (nSamples < 0)
|
||||
{
|
||||
|
@ -714,6 +712,7 @@ void audioHandler::incomingAudio(audioPacket inPacket)
|
|||
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Buffer full! capacity:" << ringBuf->capacity() << "length" << ringBuf->size();
|
||||
}
|
||||
if ((inPacket.seq > lastSentSeq + 1) && (setup.codec == 0x40 || setup.codec == 0x80)) {
|
||||
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Attempting FEC on packet" << inPacket.seq << "as last is"<<lastSentSeq ;
|
||||
lastSentSeq = inPacket.seq;
|
||||
incomingAudio(inPacket); // Call myself again to run the packet a second time (FEC)
|
||||
}
|
||||
|
|
|
@ -1459,6 +1459,8 @@ void udpServer::sendRxAudio()
|
|||
{
|
||||
audio.clear();
|
||||
rxaudio->getNextAudioChunk(audio);
|
||||
// Now we have the next audio chunk, we can release the mutex.
|
||||
audioMutex.unlock();
|
||||
int len = 0;
|
||||
while (len < audio.length()) {
|
||||
audioPacket partial;
|
||||
|
@ -1466,7 +1468,6 @@ void udpServer::sendRxAudio()
|
|||
receiveAudioData(partial);
|
||||
len = len + partial.data.length();
|
||||
}
|
||||
audioMutex.unlock();
|
||||
}
|
||||
else {
|
||||
qInfo(logUdpServer()) << "Unable to lock mutex for rxaudio";
|
||||
|
|
Ładowanie…
Reference in New Issue