kopia lustrzana https://gitlab.com/eliggett/wfview
Lower latency without the conversion. Added needed thread destructor to
pa handler.monitor
rodzic
01afca7ca7
commit
49c423a7fb
|
@ -17,7 +17,6 @@ audioHandler::audioHandler(QObject* parent) : QObject(parent)
|
|||
|
||||
audioHandler::~audioHandler()
|
||||
{
|
||||
|
||||
if (converterThread != Q_NULLPTR) {
|
||||
converterThread->quit();
|
||||
converterThread->wait();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <eigen3/Eigen/Eigen>
|
||||
#endif
|
||||
|
||||
#define audioMonitorBufferSize (10)
|
||||
#define audioMonitorBufferSize (8)
|
||||
|
||||
|
||||
struct sharedAudioType
|
||||
|
|
|
@ -15,6 +15,12 @@ paHandler::paHandler(QObject* parent)
|
|||
paHandler::~paHandler()
|
||||
{
|
||||
|
||||
if (converterToMonitorThread != Q_NULLPTR)
|
||||
{
|
||||
converterToMonitorThread->quit();
|
||||
converterToMonitorThread->wait();
|
||||
}
|
||||
|
||||
if (converterThread != Q_NULLPTR) {
|
||||
converterThread->quit();
|
||||
converterThread->wait();
|
||||
|
@ -255,7 +261,12 @@ void paHandler::incomingAudio(audioPacket packet)
|
|||
{
|
||||
// Try sending directly to the hardware:
|
||||
//convertedOutput(packet);
|
||||
emit sendToMonitorConverter(packet);
|
||||
|
||||
// Convert:
|
||||
//emit sendToMonitorConverter(packet);
|
||||
|
||||
// if the formats are actually the same, no need to convert:
|
||||
convertedMonitorAudio(packet);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -312,6 +323,16 @@ void paHandler::convertedOutput(audioPacket packet) {
|
|||
//int readPos = sharedAudioInfo->bufferReadPosition;
|
||||
int readPos = (monitorBufferPosition++)%audioMonitorBufferSize;
|
||||
|
||||
/*
|
||||
if( (readPos+2)%audioMonitorBufferSize == sharedAudioInfo->bufferWritePosition)
|
||||
{
|
||||
// then we are too close, let's step back
|
||||
qDebug(logAudio()) << "Warning, monitor buffer read is too close, moving back. Write position: " << sharedAudioInfo->bufferWritePosition << ", read position: " << readPos;
|
||||
monitorBufferPosition = (sharedAudioInfo->bufferWritePosition-3)%audioMonitorBufferSize;
|
||||
readPos = monitorBufferPosition;
|
||||
}
|
||||
*/
|
||||
|
||||
// if(packet.data.size() != sharedAudioInfo->monitorAudioBuffer[readPos].data.size())
|
||||
// {
|
||||
// qDebug(logAudio()) << "ERROR, size mismatch. packet is " << packet.data.size() << "bytes, monitor audio is " << sharedAudioInfo->monitorAudioBuffer[readPos].data.size() << "bytes.";
|
||||
|
|
Ładowanie…
Reference in New Issue