Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-8893

QAudioInput sometimes not writing to QIODevice

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 4.6.3
    • 4.6.2
    • Multimedia
    • None
    • b7ef079177ceec96f821393796c6c5b14c21704e

    Description

      I have a problem with QAudioInput sometimes not writing to QIODevice. Might be an accident, but after trimming it down it turned out that the problem is 100% gone once I got rid of ui...

      Attached example code is heavily trimmed down examples/multimedia/audioinput. The version basic_audio_test-no_ui does not have any ui. The version basic_audio_test-with_ui opens a main window with empty combo, but then never uses any elements of the ui and accesses the QAudioInput in exactly the same way as the no_ui version.

      The example code in both versions basically starts QAudioInput for the first device found and for QIODevice defined in soundbuffer.h/cpp, which in writeData() only writes out a message. The problem is that in both cases it seems that QAudioInput is opened and started without errors, but then in the case with ui I (sometimes) do not get the debug from writeData() (so I'm almost certain this method is not reached - that's why I started investigating/trimming my case down in the first place => in a more complex application I was not getting any data).

      • in "no_ui" version, in 100% of cases I get a stream of QIODevice's writeData calls:
        basic_audio_test-no_ui> ./build/basic_audio_test
        buffer opened
        "slotDeviceChanged(0:front:CARD=NVidia,DEV=0) reached"
        DFLT not supported
        About to START audio input
        Audio input started
        "SoundBuffer::writeData() : max_size == 1280"
        "SoundBuffer::writeData() : max_size == 1280"
        "SoundBuffer::writeData() : max_size == 1920"
        "SoundBuffer::writeData() : max_size == 1280"
        "SoundBuffer::writeData() : max_size == 1920"
        "SoundBuffer::writeData() : max_size == 1280"
        "SoundBuffer::writeData() : max_size == 1920"
        "SoundBuffer::writeData() : max_size == 1280"
        "SoundBuffer::writeData() : max_size == 1920"
        "SoundBuffer::writeData() : max_size == 1280"
        "SoundBuffer::writeData() : max_size == 1920"
        "SoundBuffer::writeData() : max_size == 1280"
        "SoundBuffer::writeData() : max_size == 1920"
        ^C
      • but in "with_ui" one of three cases happen:
        1) I sometimes get the same:
        basic_audio_test-with_ui> ./build/basic_audio_test
        buffer opened
        "slotDeviceChanged(0:front:CARD=NVidia,DEV=0) reached"
        DFLT not supported
        About to START audio input
        Audio input started
        "SoundBuffer::writeData() : max_size == 2560"
        "SoundBuffer::writeData() : max_size == 1920"
        "SoundBuffer::writeData() : max_size == 1280"
        "SoundBuffer::writeData() : max_size == 1920"
        "SoundBuffer::writeData() : max_size == 1280"
        "SoundBuffer::writeData() : max_size == 1920"
        "SoundBuffer::writeData() : max_size == 1280"
        "SoundBuffer::writeData() : max_size == 1920"
        "SoundBuffer::writeData() : max_size == 1280"
        "SoundBuffer::writeData() : max_size == 1920"

      2) BUT sometimes I get just:
      basic_audio_test-with_ui> ./build/basic_audio_test
      buffer opened
      "slotDeviceChanged(0:front:CARD=NVidia,DEV=0) reached"
      DFLT not supported
      About to START audio input
      Audio input started

      and then no more output (ui is responsive, btw).

      3) and sometimes I get additionally 1 line with writeData and nothing more:
      basic_audio_test-with_ui> ./build/basic_audio_test
      buffer opened
      "slotDeviceChanged(0:front:CARD=NVidia,DEV=0) reached"
      DFLT not supported
      About to START audio input
      Audio input started
      "SoundBuffer::writeData() : max_size == 1280"

      and then no more output (ui is responsive, btw). It never happens that e.g. 2 or 3 or other number of frames is received. It's always - either unblocked stream, or nothing or (rarely) one frame.

      As I wrote - I have noticed the problem (no data received by IODevice) in a more complex setup which does not depend on usage of terminal output (so it is not just about writing out messages using qDebug()...).

      The first question I asked was - is there something blocked or is there something looping or...?
      I attach three strace outputs:

      • from "no_ui" version (which never stops writing messages about new data received);
      • from "with_ui" version in the case when it does not stop writing messages about new data received (seems quite similar to the above;
      • from "with_ui" version in the case when it does NOT write messages about new data received (it definitely does "something" - hard for me to say what...)

      Attachments

        1. basic_audio_test-no_ui.tar.bz2
          2 kB
        2. basic_audio_test-strace-3x.tar.bz2
          1 kB
        3. basic_audio_test-with_ui.tar.bz2
          2 kB
        4. QTBUG-8893.patch
          2 kB
        5. tmp_patch1.patch
          1.0 kB
        6. tmp_patch2.patch
          1.0 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            korbatit Kurt Korbatits (closed Nokia identity) (Inactive)
            wiecko Marek Wieckowski
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes