kopia lustrzana https://gitlab.com/eliggett/wfview
Remove extra opus debugging
rodzic
2214ec7783
commit
da53f5371b
|
@ -488,23 +488,12 @@ void audioHandler::incomingAudio(audioPacket inPacket)
|
||||||
if (setup.codec == 0x40 || setup.codec == 0x80) {
|
if (setup.codec == 0x40 || setup.codec == 0x80) {
|
||||||
unsigned char* in = (unsigned char*)inPacket.data.data();
|
unsigned char* in = (unsigned char*)inPacket.data.data();
|
||||||
|
|
||||||
qInfo(logAudio()) << "Opus Packet Received: << " << opus_packet_get_nb_channels(in)
|
|
||||||
<< "channels, " << opus_packet_get_nb_samples(in, inPacket.data.size(), setup.samplerate)
|
|
||||||
<< "samples" << opus_decoder_get_nb_samples(decoder, in, inPacket.data.size()) << "decoded samples";
|
|
||||||
qInfo(logAudio()) << "Radio: channels" << setup.radioChan << "samplerate" << setup.samplerate;
|
|
||||||
/* Decode the frame. */
|
/* Decode the frame. */
|
||||||
//QByteArray outPacket(this->chunkSize * sizeof(qint16) * setup.radioChan, (char)0xff); // Preset the output buffer size.
|
|
||||||
QByteArray outPacket((setup.samplerate / 50) * sizeof(qint16) * setup.radioChan, (char)0xff); // Preset the output buffer size.
|
QByteArray outPacket((setup.samplerate / 50) * sizeof(qint16) * setup.radioChan, (char)0xff); // Preset the output buffer size.
|
||||||
qint16* out = (qint16*)outPacket.data();
|
qint16* out = (qint16*)outPacket.data();
|
||||||
int nSamples = 0;
|
int nSamples = 0;
|
||||||
|
|
||||||
if (lastSentSeq > 0 && lastSentSeq+1 < inPacket.seq)
|
nSamples = opus_decode(decoder, in, inPacket.data.size(), out, (setup.samplerate / 50), 0);
|
||||||
{
|
|
||||||
nSamples = opus_decode(decoder, NULL, 0, out, (setup.samplerate / 50), 1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
nSamples = opus_decode(decoder, in, inPacket.data.size(), out, (setup.samplerate / 50), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nSamples < 0)
|
if (nSamples < 0)
|
||||||
{
|
{
|
||||||
|
@ -512,17 +501,13 @@ void audioHandler::incomingAudio(audioPacket inPacket)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (int(nSamples * sizeof(qint16)) != outPacket.size())
|
if (int(nSamples * sizeof(qint16) * setup.radioChan) != outPacket.size())
|
||||||
{
|
{
|
||||||
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "Opus decoder mismatch: nBytes:" << nSamples * sizeof(qint16) << "outPacket:" << outPacket.size();
|
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "Opus decoder mismatch: nBytes:" << nSamples * sizeof(qint16) << "outPacket:" << outPacket.size();
|
||||||
outPacket.resize(nSamples * sizeof(qint16));
|
outPacket.resize(nSamples * sizeof(qint16) * setup.radioChan);
|
||||||
}
|
}
|
||||||
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "Opus decoded" << inPacket.data.size() << "bytes, into" << outPacket.length() << "bytes";
|
|
||||||
inPacket.data.clear();
|
inPacket.data.clear();
|
||||||
inPacket.data = outPacket; // Replace incoming data with converted.
|
inPacket.data = outPacket; // Replace incoming data with converted.
|
||||||
//qint16* in16 = (qint16*)inPacket.data.data();
|
|
||||||
//for (int i = 0; i < inPacket.data.length() / 2; i++)
|
|
||||||
// in16[i] = qToLittleEndian(in16[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,8 +640,6 @@ void audioHandler::getNextAudioChunk(QByteArray& ret)
|
||||||
if (err) {
|
if (err) {
|
||||||
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "Resampler error " << err << " inFrames:" << inFrames << " outFrames:" << outFrames;
|
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "Resampler error " << err << " inFrames:" << inFrames << " outFrames:" << outFrames;
|
||||||
}
|
}
|
||||||
//qInfo(logAudio()) << "Resampler run " << err << " inFrames:" << inFrames << " outFrames:" << outFrames;
|
|
||||||
//qInfo(logAudio()) << "Resampler run inLen:" << packet->datain.length() << " outLen:" << packet->dataout.length();
|
|
||||||
packet.data.clear();
|
packet.data.clear();
|
||||||
packet.data = outPacket; // Copy output packet back to input buffer.
|
packet.data = outPacket; // Copy output packet back to input buffer.
|
||||||
}
|
}
|
||||||
|
@ -685,9 +668,6 @@ void audioHandler::getNextAudioChunk(QByteArray& ret)
|
||||||
{
|
{
|
||||||
//Are we using the opus codec?
|
//Are we using the opus codec?
|
||||||
qint16* in = (qint16*)packet.data.data();
|
qint16* in = (qint16*)packet.data.data();
|
||||||
// Convert from little endian
|
|
||||||
//for (int i = 0; i < packet.data.length() / 2; i++)
|
|
||||||
// in[i] = qToBigEndian(in[i]);
|
|
||||||
|
|
||||||
/* Encode the frame. */
|
/* Encode the frame. */
|
||||||
QByteArray outPacket(1275, (char)0xff); // Preset the output buffer size to MAXIMUM possible Opus frame size
|
QByteArray outPacket(1275, (char)0xff); // Preset the output buffer size to MAXIMUM possible Opus frame size
|
||||||
|
@ -700,15 +680,10 @@ void audioHandler::getNextAudioChunk(QByteArray& ret)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
outPacket.resize(nbBytes);
|
outPacket.resize(setup.radioChan);
|
||||||
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "Opus encoded" << packet.data.length() << "bytes, into" << outPacket.length() << "bytes";
|
|
||||||
packet.data.clear();
|
packet.data.clear();
|
||||||
packet.data = outPacket; // Replace incoming data with converted.
|
packet.data = outPacket; // Replace incoming data with converted.
|
||||||
}
|
}
|
||||||
qInfo(logAudio()) << "Opus Packet To Send: << " << opus_packet_get_nb_channels(out)
|
|
||||||
<< "channels, " << opus_packet_get_nb_samples(out, outPacket.size(), setup.samplerate);
|
|
||||||
qInfo(logAudio()) << "Radio: channels" << setup.radioChan << "samplerate" << setup.samplerate;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (setup.bits == 8)
|
else if (setup.bits == 8)
|
||||||
{
|
{
|
||||||
|
|
Ładowanie…
Reference in New Issue