Unsolved QAudioOutput in ARM Linux(Ubuntu16.04 ) is not working properly, and print "ALSA lib pcm.c:7963:(snd_pcm_recover) underrun occurred"
-
I want to use QAudioInput and QAudioOutput to develop voice intercom function in arm linux. Through Qudpsocket, I send the original audio (PCM) acquired in my PC to the arm board, but arm board can't play the audio. Here is the error code printed by my program:
ALSA lib pcm.c:7963:(snd_pcm_recover) underrun occurred
And when the program outputs the error code, the player will bang
Here's my program
int udpSpeak::recvSound()
{
if(nullptr == ioOutputDevice)
return -1;while (udp->hasPendingDatagrams()) { qint64 size = udp->pendingDatagramSize(); QByteArray array = QByteArray(size,0); udp->readDatagram(array.data(),size); udp->writeDatagram(array.data(), size, host, 11111); ioOutputDevice->write(array.data()); } return 0;
}
I send the data back to PC, which can play normally -
Hi,
Underrun meaning not enough data, are you sure you have the same settings for your device as for your machine ?
By the way, why are you not directly writing the QByteArray ?