kopia lustrzana https://gitlab.com/eliggett/wfview
Fix underrun handler
rodzic
f00051ecd4
commit
0f7a5566fc
|
@ -166,7 +166,12 @@ bool audioHandler::init(audioSetup setupIn)
|
||||||
|
|
||||||
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "thread id" << QThread::currentThreadId();
|
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "thread id" << QThread::currentThreadId();
|
||||||
|
|
||||||
|
underTimer = new QTimer();
|
||||||
|
underTimer->setSingleShot(true);
|
||||||
|
connect(underTimer, &QTimer::timeout, this, &audioHandler::clearUnderrun);
|
||||||
|
|
||||||
this->start();
|
this->start();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,15 +576,15 @@ void audioHandler::stateChanged(QAudio::State state)
|
||||||
case QAudio::IdleState:
|
case QAudio::IdleState:
|
||||||
{
|
{
|
||||||
isUnderrun = true;
|
isUnderrun = true;
|
||||||
|
if (underTimer->isActive()) {
|
||||||
|
underTimer->stop();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QAudio::ActiveState:
|
case QAudio::ActiveState:
|
||||||
{
|
{
|
||||||
//qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Audio started!";
|
//qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Audio started!";
|
||||||
if (underTimer == Q_NULLPTR) {
|
if (!underTimer->isActive()) {
|
||||||
underTimer = new QTimer();
|
|
||||||
underTimer->setSingleShot(true);
|
|
||||||
connect(underTimer, &QTimer::timeout, this, &audioHandler::clearUnderrun);
|
|
||||||
underTimer->start(500);
|
underTimer->start(500);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -601,6 +606,5 @@ void audioHandler::stateChanged(QAudio::State state)
|
||||||
void audioHandler::clearUnderrun()
|
void audioHandler::clearUnderrun()
|
||||||
{
|
{
|
||||||
isUnderrun = false;
|
isUnderrun = false;
|
||||||
delete underTimer;
|
underTimer->stop();
|
||||||
underTimer = Q_NULLPTR;
|
|
||||||
}
|
}
|
|
@ -142,7 +142,7 @@ private:
|
||||||
|
|
||||||
OpusEncoder* encoder=Q_NULLPTR;
|
OpusEncoder* encoder=Q_NULLPTR;
|
||||||
OpusDecoder* decoder=Q_NULLPTR;
|
OpusDecoder* decoder=Q_NULLPTR;
|
||||||
QTimer * underTimer=Q_NULLPTR;
|
QTimer* underTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue