Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Opening QAudioInput very slow, "could not get audio input for record source 1"



  • Hello,

    I open a QAudioInput when starting my Qt Widget application on a Samsung Galaxy S3 Mini with Android 4.1.2 using this procedure:
    @
    m_format.setSampleRate(16000);
    m_format.setChannelCount(1);
    m_format.setSampleSize(16);
    m_format.setCodec("audio/pcm");
    m_format.setByteOrder(QAudioFormat::LittleEndian);
    m_format.setSampleType(QAudioFormat::SignedInt);
    QAudioDeviceInfo info = QAudioDeviceInfo::defaultInputDevice();
    if (!info.isFormatSupported(m_format)) {
    qWarning() << "Default format not supported, trying to use the nearest.";
    m_format = info.nearestFormat(m_format);
    }

    m_input = new QAudioInput(m_format);
    m_input->setBufferSize(384);
    m_audioData->open(QIODevice::ReadWrite);
    

    @

    It takes very long (approx. 50 secs) for the app to start. Finally it starts and the input is successfully opened. In the console it says:

    @
    E/AudioRecord(27185): Could not get audio input for record source 1
    E/libOpenSLES(27185): android_audioRecorder_realize(0x586115f0) error creating AudioRecord object
    W/libOpenSLES(27185): Leaving Object:
    E/AudioRecord(27185): Could not get audio input for record source 1
    E/libOpenSLES(27185): android_audioRecorder_realize(0x586115f0) error creating AudioRecord object
    W/libOpenSLES(27185): Leaving Object::Realize (SL_RESULT_CONTENT_UNSUPPORTED)
    @
    Is there a mistake in my procedure? I don't know why it takes so long. When i restart the device and start the app it takes the same time.

    Thanks!

    Regards


Log in to reply