kopia lustrzana https://gitlab.com/eliggett/wfview
Fix merge error
commit
2fa83028d3
|
@ -83,8 +83,8 @@ audioConverter::~audioConverter()
|
|||
bool audioConverter::convert(audioPacket audio)
|
||||
{
|
||||
|
||||
// If inFormat and outFormat are identical, just emit the data back.
|
||||
if (audio.data.size() > 0 && inFormat != outFormat)
|
||||
// If inFormat and outFormat are identical, just emit the data back (removed as it doesn't then process amplitude)
|
||||
if (audio.data.size() > 0)
|
||||
{
|
||||
|
||||
if (inFormat.codec() == "audio/opus")
|
||||
|
|
|
@ -35,9 +35,7 @@ audioHandler::~audioHandler()
|
|||
converterThread->quit();
|
||||
converterThread->wait();
|
||||
}
|
||||
}
|
||||
|
||||
bool audioHandler::init(audioSetup setup)
|
||||
}bool audioHandler::init(audioSetup setup)
|
||||
{
|
||||
if (isInitialized) {
|
||||
return false;
|
||||
|
@ -80,14 +78,37 @@ bool audioHandler::init(audioSetup setup)
|
|||
return false;
|
||||
}
|
||||
|
||||
/* if (outFormat.channelCount() == 1 && inFormat.channelCount() == 2) {
|
||||
if (outFormat.channelCount() == 1 && inFormat.channelCount() == 2) {
|
||||
outFormat.setChannelCount(2);
|
||||
if (!setup.port.isFormatSupported(outFormat)) {
|
||||
qCritical(logAudio()) << (setup.isinput ? "Input" : "Output") << "Cannot request stereo input!";
|
||||
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "Cannot request stereo reverting to mono";
|
||||
outFormat.setChannelCount(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (outFormat.sampleRate() < 48000) {
|
||||
int tempRate=outFormat.sampleRate();
|
||||
outFormat.setSampleRate(48000);
|
||||
if (!setup.port.isFormatSupported(outFormat)) {
|
||||
qCritical(logAudio()) << (setup.isinput ? "Input" : "Output") << "Cannot request 48K, reverting to "<< tempRate;
|
||||
outFormat.setSampleRate(tempRate);
|
||||
}
|
||||
}
|
||||
|
||||
if (outFormat.sampleType() == QAudioFormat::UnSignedInt && outFormat.sampleSize()==8) {
|
||||
outFormat.setSampleType(QAudioFormat::SignedInt);
|
||||
outFormat.setSampleSize(16);
|
||||
|
||||
if (!setup.port.isFormatSupported(outFormat)) {
|
||||
qCritical(logAudio()) << (setup.isinput ? "Input" : "Output") << "Cannot request 16bit Signed samples, reverting to 8bit Unsigned";
|
||||
outFormat.setSampleType(QAudioFormat::UnSignedInt);
|
||||
outFormat.setSampleSize(8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
if (outFormat.sampleType()==QAudioFormat::SignedInt) {
|
||||
outFormat.setSampleType(QAudioFormat::Float);
|
||||
outFormat.setSampleSize(32);
|
||||
|
@ -232,7 +253,12 @@ void audioHandler::convertedOutput(audioPacket packet) {
|
|||
|
||||
currentLatency = packet.time.msecsTo(QTime::currentTime()) + (outFormat.durationForBytes(audioOutput->bufferSize() - audioOutput->bytesFree()) / 1000);
|
||||
if (audioDevice != Q_NULLPTR) {
|
||||
audioDevice->write(packet.data);
|
||||
if (audioDevice->write(packet.data) < packet.data.size()) {
|
||||
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Buffer full!";
|
||||
isOverrun=true;
|
||||
} else {
|
||||
isOverrun = false;
|
||||
}
|
||||
if (lastReceived.msecsTo(QTime::currentTime()) > 100) {
|
||||
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Time since last audio packet" << lastReceived.msecsTo(QTime::currentTime()) << "Expected around" << setup.blockSize;
|
||||
}
|
||||
|
@ -245,7 +271,7 @@ void audioHandler::convertedOutput(audioPacket packet) {
|
|||
}
|
||||
*/
|
||||
lastSentSeq = packet.seq;
|
||||
emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun);
|
||||
emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun);
|
||||
|
||||
amplitude = packet.amplitude;
|
||||
}
|
||||
|
@ -288,7 +314,7 @@ void audioHandler::convertedInput(audioPacket audio)
|
|||
}
|
||||
lastReceived = QTime::currentTime();
|
||||
amplitude = audio.amplitude;
|
||||
emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun);
|
||||
emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ signals:
|
|||
void audioMessage(QString message);
|
||||
void sendLatency(quint16 newSize);
|
||||
void haveAudioData(const audioPacket& data);
|
||||
void haveLevels(quint16 amplitude,quint16 latency,quint16 current,bool under);
|
||||
void haveLevels(quint16 amplitude,quint16 latency,quint16 current,bool under,bool over);
|
||||
void setupConverter(QAudioFormat in, QAudioFormat out, quint8 opus, quint8 resamp);
|
||||
void sendToConverter(audioPacket audio);
|
||||
|
||||
|
@ -117,6 +117,7 @@ private:
|
|||
|
||||
|
||||
bool isUnderrun = false;
|
||||
bool isOverrun = true;
|
||||
bool isInitialized=false;
|
||||
bool isReady = false;
|
||||
bool audioBuffered = false;
|
||||
|
|
1129
udphandler.cpp
1129
udphandler.cpp
Plik diff jest za duży
Load Diff
|
@ -56,8 +56,8 @@ public slots:
|
|||
void setVolume(unsigned char value);
|
||||
void init();
|
||||
void setCurrentRadio(quint8 radio);
|
||||
void getRxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under);
|
||||
void getTxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under);
|
||||
void getRxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over);
|
||||
void getTxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over);
|
||||
|
||||
|
||||
signals:
|
||||
|
|
Ładowanie…
Reference in New Issue