QAudioOutput
-
i am using Qt 5.13 QAudioOutput and QIODevice write is crashing in Qt 5.11 it is working fine in Q5.13 it is crashing .what is issue can anybody tell
QAudioOutput *speaker;
QIODevice *device;QAudioFormat format;
format.setChannelCount(1);
format.setSampleRate(SAMPLE_RATE);
format.setSampleSize(SAMPLE_SIZE);
format.setCodec("audio/pcm");
format.setByteOrder(QAudioFormat::LittleEndian);
format.setSampleType(QAudioFormat::SignedInt);eQueryAudioState = AudioPlayingNotStarted; bDecoderInit = false; speaker = new QAudioOutput(QAudioDeviceInfo::defaultOutputDevice(),format); speaker->setBufferSize(32000);//(32000);//(32768); // speaker->setNotifyInterval(20); device = speaker->start(); audioTimer = new QTimer(); audioTimer->setTimerType(Qt::TimerType::PreciseTimer); audioTimer->setSingleShot(false); audioTimer->setInterval(5);//5 connect(audioTimer,SIGNAL(timeout()),this,SLOT(playAudio())); audioTimer->start(); opusDecoderInit(format);
int nSamplesDecoded = opus_decode(opusDecoder,(unsigned char *)buffer.data(), ENCODED_BUFFER_SIZE, dec_out, AUDIO_BUFFER_SIZE, 0);
if (nSamplesDecoded < 0)
{
qDebug() << "decoder failed: " << opus_strerror(nSamplesDecoded);
return;
}
else
{
qDebug() << "Samples Decoded " << nSamplesDecoded ;
}if(device->isOpen() && device->isWritable()) { int BytesWritten = device->write((char *)dec_out,nSamplesDecoded*2); }
-
@satyanarayana143 said in QAudioOutput:
i am using Qt 5.13 QAudioOutput and QIODevice write is crashing in Qt 5.11 it is working fine in Q5.13 it is crashing
Please fix this sentence - in which version does it crash?
Did you use debugger to see where it crashes?
Do you have a stack trace after crash? -
Qt 5.13 version
device is QIODevice
static short dec_out[AUDIO_BUFFER_SIZE]={0};
int BytesWritten = device->write((char *)dec_out,nSamplesDecoded*2);
-
@satyanarayana143 said in QAudioOutput:
device is QIODevice
static short dec_out[AUDIO_BUFFER_SIZE]={0};
int BytesWritten = device->write((char )dec_out,nSamplesDecoded2);This does not answer my other questions. If your app is crashing then please use debugger...
-
@jsulm said in QAudioOutput:
This does not answer my other questions. If your app is crashing then please use debugger...
using debugger at this line it is crashing
-
@satyanarayana143 What kind of crash is it? SIGSEGV? Is device a valid pointer in that line?
-
QT installed system it is running in non qt installed system it is crashing i copied multimedia dlls .
any dll is missing for that crash
-
@satyanarayana143 You need to deploy your app properly with all needed libs and plug-ins: https://doc.qt.io/qt-5/deployment.html