QAudioProbe::audioBufferProbed() behavior
-
I have a QMediaPlayer which I set as source for a QAudioProbe. Then I connect the signal audioBufferProbed() to a private slot in my class like this:
connect(m_probe, SIGNAL(audioBufferProbed(const QAudioBuffer&)), this, SLOT(processAudioProbe(const QAudioBuffer&)));
Here's what I don't understand: I have a button for opening an audio file and one for playing it. As soon as I open the file, audioBufferProbed() is emmitted, even before I even clicked play. What data do I get here? Why is the buffer probed before the player even plays?
Here's the open function:
void MainWidget::openFile(const QString &fileName) { QUrl url = QUrl::fromLocalFile(fileName); QMediaContent media(url); m_player->setMedia(media); // this already seems to trigger audioBufferProbed() }
Here's play:
void MainWidget::startPlayback() { m_player->play(); }
-
Hi and welcome to devnet,
Does it happen also when you open a file the first time ? Or only after you already opened one and replace it with another ?
-
Hi and welcome to devnet,
Does it happen also when you open a file the first time ? Or only after you already opened one and replace it with another ?
-
What version of Qt and OS are you using ?
-
I created a minimal working example which demonstrates the issue: https://bitbucket.org/rdssdf/mweaudioprobe
-
Since you're on Linux, It might be something that's GStreamer specific.
-
Ok, I just confirmed that the issue does not occur on Windows. You are probably right that it is GStreamer specific. So... what are my options on Linux? Can I configure GStreamer somehow or can I run Qt with a different audio framework? I'd really like to build my app for Linux as well.
-
Depending on your Qt version you could rebuild the multimedia module using GStreamer 1.0
-
I rebuilt Qt 5.5 from source with GStreamer 1.0 but it's still the same. Btw, is there a way to rebuild a module and pass configure options using the web installer? I had to checkout the sources from git and compile them because I could not find out how to do it.
-
You can get the sources from the installer but not start a build from there.