kopia lustrzana https://gitlab.com/eliggett/wfview
Ensure buffer is at least 1/2 filled before starting
rodzic
918238835d
commit
b4884e773a
|
@ -449,6 +449,15 @@ qint64 audioHandler::readData(char* buffer, qint64 nBytes)
|
||||||
if (!isReady) {
|
if (!isReady) {
|
||||||
isReady = true;
|
isReady = true;
|
||||||
}
|
}
|
||||||
|
if (!audioBuffered) {
|
||||||
|
#if defined(RTAUDIO)
|
||||||
|
return 0;
|
||||||
|
#elif defined(PORTAUDIO)
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
return nBytes;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
audioPacket packet;
|
audioPacket packet;
|
||||||
if (ringBuf->size()>0)
|
if (ringBuf->size()>0)
|
||||||
{
|
{
|
||||||
|
@ -458,7 +467,7 @@ qint64 audioHandler::readData(char* buffer, qint64 nBytes)
|
||||||
{
|
{
|
||||||
if (!ringBuf->try_read(packet))
|
if (!ringBuf->try_read(packet))
|
||||||
{
|
{
|
||||||
qDebug(logAudio()) << "No more data available but buffer is not full! sentlen:" << sentlen << " nBytes:" << nBytes ;
|
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "buffer is empty, sentlen:" << sentlen << " nBytes:" << nBytes ;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
currentLatency = packet.time.msecsTo(QTime::currentTime());
|
currentLatency = packet.time.msecsTo(QTime::currentTime());
|
||||||
|
@ -739,6 +748,10 @@ void audioHandler::incomingAudio(audioPacket inPacket)
|
||||||
incomingAudio(inPacket); // Call myself again to run the packet a second time (FEC)
|
incomingAudio(inPacket); // Call myself again to run the packet a second time (FEC)
|
||||||
}
|
}
|
||||||
lastSentSeq = inPacket.seq;
|
lastSentSeq = inPacket.seq;
|
||||||
|
if (ringBuf->size() > ringBuf->capacity() / 2)
|
||||||
|
{
|
||||||
|
audioBuffered = true;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ private:
|
||||||
void reinit();
|
void reinit();
|
||||||
bool isInitialized=false;
|
bool isInitialized=false;
|
||||||
bool isReady = false;
|
bool isReady = false;
|
||||||
|
bool audioBuffered = false;
|
||||||
#if defined(RTAUDIO)
|
#if defined(RTAUDIO)
|
||||||
RtAudio* audio = Q_NULLPTR;
|
RtAudio* audio = Q_NULLPTR;
|
||||||
int audioDevice = 0;
|
int audioDevice = 0;
|
||||||
|
|
Ładowanie…
Reference in New Issue