c++windowsqt6qtmultimediaqt6.4.1

"Failed to setup resampler" when starting QAudioSink


I'm porting some QtMultimedia code from Qt 5.15 to 6.4.1. The following program, when built with Qt 6.4.1 on Windows:

int main (int argc, char *argv[]) {

    QCoreApplication a(argc, argv);

    QAudioDevice device = QMediaDevices::defaultAudioOutput();
    QAudioFormat format = device.preferredFormat();
    QAudioSink *output = new QAudioSink(device, format);
    output->start();

    return a.exec();

}

Fails to start the audio output, printing the following message:

qt.multimedia.audiooutput: Failed to setup resampler

The equivalent code in Qt5 (using QAudioDeviceInfo and QAudioOutput) seems to run fine. What am I missing here?


Solution

  • Apparently, it's a bug in Qt 6.4.1 on Windows, where, as the user johnco3 discovered in that forum post, for some reason QAudioSink is looking for a DLL named "mfplat.dll.dll" when it should be looking for "mfplat.dll" (it adds an extra ".dll" suffix).

    The correctly named version of this DLL lives in the Windows system directory (e.g. C:\Windows\System32\mfplat.dll), so there are a couple of workaround until the bug is fixed:

    1. Go back to Qt 6.4.0, apparently it's a new issue in 6.4.1, or
    2. Copy mfplat.dll to somewhere in the DLL path then rename it to "mfplat.dll.dll":
      1. Either copy it to the application executable's directory and rename it there, or
      2. Create some folder somewhere, copy and rename it there, then add that folder to the PATH environment variable.

    It's a somewhat silly bug, but alas. At least the workaround exists and can be easily undone when the bug is eventually fixed.

    See also: