Results 1 to 3 of 3

Thread: Assertion 's' failed at pulse/stream.c while restarting QAudioOutput and QAudioInput?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2015
    Posts
    3
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Assertion 's' failed at pulse/stream.c while restarting QAudioOutput and QAudioInput?

    My application uses QAudioOutput and QAudioInput for audio communication between different audio devices. So, a user can speak through a microphone and that can be heard through a speaker using this app. It has a push-to-talk feature where the user can push a button on the app or a key on the keyboard to activate speaking through a microphone for the very moment when the button or the key is pressed.

    The problem is that when push-to-talk option is used in quick succession, like when the user presses and releases the button in very quick succession for several times, like 5-6 times, sometimes the application crashes with an error message that says:

    Assertion 's' failed at pulse/stream.c:1662, function pa_stream_writable_size(). Aborting.
    Aborted
    My OS is Ubuntu 14.04 LTS.

    The methods for starting and stopping the microphone and the speaker are as below:
    Qt Code:
    1. void AudioSettings::pushToTalk_pressed()
    2. {
    3. if(output->state() != QAudio::ActiveState && input->state() != QAudio::ActiveState)
    4. {
    5. output->start(input->start());
    6. }
    7. }
    8.  
    9. void AudioSettings::pushToTalk_released()
    10. {
    11. if(output->state() == QAudio::ActiveState && input->state() == QAudio::ActiveState)
    12. {
    13. output->stop();
    14. input->stop();
    15. }
    16. }
    To copy to clipboard, switch view to plain text mode 

    Here input and output are respectively pointers to object of QAudioInput and QAudioOutput. They are initialized in the following way:
    Qt Code:
    1. QAudioFormat audioFormat;
    2. audioFormat.setChannelCount(2);
    3. audioFormat.setCodec("audio/pcm");
    4. audioFormat.setSampleRate(22050);
    5. audioFormat.setSampleSize(16);
    6. audioFormat.setByteOrder(QAudioFormat::LittleEndian);
    7. audioFormat.setSampleType(QAudioFormat::SignedInt);
    8.  
    9. QAudioDeviceInfo outputDevinfo = ui->output2Box->itemData(ui->output2Box->currentIndex()).value<QAudioDeviceInfo>();
    10.  
    11. if (!outputDevinfo.isFormatSupported(audioFormat))
    12. {
    13. //Default format not supported - trying to use nearest
    14. audioFormat = outputDevinfo.nearestFormat(audioFormat);
    15. }
    16.  
    17. //Initializing output device
    18. output = new QAudioOutput(outputDevinfo, audioFormat, this);
    19.  
    20. QAudioDeviceInfo inputDevinfo = ui->input2Box->itemData(ui->input2Box->currentIndex()).value<QAudioDeviceInfo>();
    21.  
    22.  
    23. if (!inputDevinfo.isFormatSupported(audioFormat))
    24. {
    25. //Default format not supported - trying to use nearest
    26. audioFormat = inputDevinfo.nearestFormat(audioFormat);
    27. }
    28.  
    29. //Initializing input device
    30. input = new QAudioInput(inputDevinfo, audioFormat, this);
    To copy to clipboard, switch view to plain text mode 

    I tried to use GDB for finding out why this crash happens, but I only get the result in call stack of QtCreator as shown in the image.
    Screenshot from 2016-05-11 15:27:22.jpg
    Could anyone please tell me how to prevent the aforementioned crash?

    Thanks.
    Last edited by the_naive; 11th May 2016 at 14:43.

Similar Threads

  1. Debug Assertion Failed
    By beethoven07 in forum Newbie
    Replies: 13
    Last Post: 23rd February 2013, 17:09
  2. Qt OpenGL: Assertion Failed When Close the Window
    By Seishin in forum Qt Programming
    Replies: 5
    Last Post: 21st August 2012, 15:18
  3. QaudioOutPut Stream Audio In Chat Voice ?
    By Thành Viên Mới in forum Qt Programming
    Replies: 2
    Last Post: 17th June 2011, 03:33
  4. Debug Assertion Failed
    By ^NyAw^ in forum General Programming
    Replies: 5
    Last Post: 28th December 2007, 11:48
  5. ASSERT(Failed assertion in Qt == Qt bug)
    By 0xBulbizarre in forum Qt Programming
    Replies: 1
    Last Post: 20th March 2006, 19:06

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.