Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QAudioDeviceInfo::availableDevices crashes in debug mode
Forum Updated to NodeBB v4.3 + New Features

QAudioDeviceInfo::availableDevices crashes in debug mode

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 3.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Claude
    wrote on last edited by
    #1

    Hello,

    The static method QAudioDeviceInfo::availableDevices(QAudio::AudioOutput) crashes in debug mode for MinGW on Windows 7.

    Kit: Desktop Qt 5.5.0 MinGW 32 bit
    Compiler: MinGW 4.9.2 32bit
    Debugger: GNU gdb 7.8 for MinGW 4.9.2 32bit
    Qt version: Qt 5.5.0 MinGW 32 bit

    OS: Windows 7 Professional 64 bits

    It does not crash in release mode.

    The problem appeared when I have installed a driver for a Voice Modem: USR5637Voice64bit.EXE.
    I have uninstalled this driver, and the problem is remained.

    I have reinstalled Qt 5.5.0, and the problem is still there.

    Thanks for helping.

    Claude

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Can you get a stack trace of that crash ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Claude
        wrote on last edited by
        #3

        Hello,

        The problem occurs in this method:

        void BroadcastThread::CreateAudioOutput()
        {
            SysLog *pSysLog = MySysLog::Instance();
            QString msg;
            QTextStream stream(&msg);
        
            QList<QAudioDeviceInfo> audioOutputDevices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
        

        When crashing, I got this back trace:

        Thread 3 (Thread 5900.0x8c8):
        #0  BroadcastThread::CreateAudioOutput (this=0xef94f90) at BroadcastThread.cpp:70
                pSysLog = 0xd8679d0
                msg = {static null = {<No data fields>}, d = 0x6bab0800 <QArrayData::shared_null>}
                stream = {_vptr.QTextStream = 0x6bc68b18 <vtable for QTextStream+8>, d_ptr = {d = 0xef90f30}}
                audioOutputDevices = {<QListSpecialMethods<QAudioDeviceInfo>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = -1}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x6b9006fa <QObject::QObject(QObject*)+264>}, d = 0x6b9006fa <QObject::QObject(QObject*)+264>}}
                isAudioOutputDeviceDetected = 15
        #1  0x0040ad10 in BroadcastThread::run (this=0xef94f90) at BroadcastThread.cpp:50
        No locals.
        #2  0x6b799bb8 in QThreadPrivate::start(void*)@4 (arg=0xef94f90) at thread\qthread_win.cpp:344
                thr = 0xef94f90
                data = 0xef94fe8
        #3  0x762e1287 in msvcrt!_itow_s () from C:\Windows\syswow64\msvcrt.dll
        No symbol table info available.
        #4  0x762e1328 in msvcrt!_endthreadex () from C:\Windows\syswow64\msvcrt.dll
        No symbol table info available.
        #5  0x7797338a in KERNEL32!BaseThreadInitThunk () from C:\Windows\syswow64\kernel32.dll
        No symbol table info available.
        #6  0x77e9a242 in ntdll!RtlInitializeExceptionChain () from C:\Windows\SysWOW64\ntdll.dll
        No symbol table info available.
        #7  0x77e9a215 in ntdll!RtlInitializeExceptionChain () from C:\Windows\SysWOW64\ntdll.dll
        No symbol table info available.
        #8  0x00000000 in ?? ()
        No symbol table info available.
        
        
        

        In the Application Output pane, I got this error message:

        **ASSERT: "!isEmpty()" in file C:\work\build\qt5_workdir\w\s\qtbase\include/QtCore/../../src/corelib/tools/qlist.h, line 316**
        
        This application has requested the Runtime to terminate it in an unusual way.
        Please contact the application's support team for more information.
        Debugging has finished
        
        

        Thanks

        Claude

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          What code do you have after creating audioOutputDevices ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Claude
            wrote on last edited by
            #5

            Hi,

            Here is the complete method:

            void BroadcastThread::CreateAudioOutput()
            {
                SysLog *pSysLog = MySysLog::Instance();
                QString msg;
                QTextStream stream(&msg);
            
                QList<QAudioDeviceInfo> audioOutputDevices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
            
                stream << m_audioName << ": Number of audio ouput devices = <" << audioOutputDevices.size() << ">";
                pSysLog->SysLogInfo("BRDC", msg);
            
                for(int i=0; i < audioOutputDevices.size(); ++i)
                {
                    msg.clear();
                    stream << m_audioName << ": Detecting audio ouput device: <" << audioOutputDevices.at(i).deviceName() << ">";
                    pSysLog->SysLogInfo("BRDC", msg);
                }
            
                bool isAudioOutputDeviceDetected = false;
                for(int i=0; i < audioOutputDevices.size(); ++i)
                {
                    const QAudioDeviceInfo &audioDeviceInfo = audioOutputDevices.at(i);
                    if (audioDeviceInfo.deviceName().startsWith(m_audioName))
                    {
                        isAudioOutputDeviceDetected = true;
            
                        msg.clear();
                        stream << m_audioName << ": Setting audio ouput device: <" << audioDeviceInfo.deviceName() << ">";
                        pSysLog->SysLogInfo("BRDC", msg);
            
                        QAudioFormat format;
                        format.setSampleRate(22000);
                        format.setChannelCount(1);
                        format.setSampleSize(16);
                        format.setCodec("audio/pcm");
                        format.setByteOrder(QAudioFormat::LittleEndian);
                        format.setSampleType(QAudioFormat::UnSignedInt);
            
                        if (!audioDeviceInfo.isFormatSupported(format))
                        {
                            msg.clear();
                            stream << m_audioName << ": Raw audio format not supported by backend, cannot play audio";
                            pSysLog->SysLogWarning("BRDC", msg);
                            format = audioDeviceInfo.nearestFormat(format);
                        }
            
                        m_audioOutput.reset(new QAudioOutput(audioDeviceInfo, format), &QAudioOutput::deleteLater);
                        connect(qobject_cast<QAudioOutput *>(m_audioOutput.data()), SIGNAL(stateChanged(QAudio::State)),
                                this, SLOT(onStateChanged(QAudio::State)));
                        break;
                    }
                }
            
                // Validate that the audio output device has been detected
                if (!isAudioOutputDeviceDetected)
                {
                    msg.clear();
                    stream << m_audioName << ": No audio output device name beginning by: <" << m_audioName << ">";
                    pSysLog->SysLogError("BRDC", msg);
                }
            }
            
            1 Reply Last reply
            0
            • C Offline
              C Offline
              Claude
              wrote on last edited by
              #6

              I found the cause of a Qt bug in debug mode only.

              This is related to the use of the voice modem "USR5637" from USRobotics.

              When plugging the voice modem in the computer, an entry appears in the section “Sound, video and game controllers” of the Windows Device Manager.

              The entry name is “Unimodem Half-Duplex Audio Device”.

              In order to solve the crashing problem, in debug mode, of the method:

              QList<QAudioDeviceInfo> audioOutputDevices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);

              we have to right-click “Unimodem Half-Duplex Audio Device” and select “Uninstall”.

              This is a Qt bug in debug mode because the bug does not exist in release mode.

              In the QList returned by the method, there is an element with the name “Modem #0 Line Playback” that makes the method crashing in debug mode.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Does it happen only if the device is plugged or also when not present ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                C 1 Reply Last reply
                0
                • SGaistS SGaist

                  Does it happen only if the device is plugged or also when not present ?

                  C Offline
                  C Offline
                  Claude
                  wrote on last edited by
                  #8

                  @SGaist It happens also when the device is not present.

                  Once the device has been installed, the entry appears in the Device Manager. If we remove physically the device from the USB port, the entry disappears from the Device Manager but the bug is still there.

                  There is still an element with the name “Modem #0 Line Playback” in the QList returned by the method.

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved