summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@gmail.com>2023-07-13 15:12:46 +1000
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-11-13 03:02:44 +0000
commit4753212d3e164a93ffa55a69e3ab306575ffcd3c (patch)
treecea298808d2e81ff1fc36ecc46f7b7e9855e5de0
parentc023436789a08e12c47177ed1040b86c823d4a7e (diff)
wasm: fix QAudioInput for wasm
Don't remove devices that were previously found. Temporarily make webaudio devices not the default Pick-to: 6.5 Fixes: QTBUG-115075 Change-Id: Iedaf53858c3b7dddc2cf1eb33a855989ca5793d9 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit 0272a7c1a68ed8c7abf46fe2bdc2abbba4ace66a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/multimedia/wasm/qwasmaudiosource.cpp22
-rw-r--r--src/multimedia/wasm/qwasmmediadevices.cpp1
2 files changed, 13 insertions, 10 deletions
diff --git a/src/multimedia/wasm/qwasmaudiosource.cpp b/src/multimedia/wasm/qwasmaudiosource.cpp
index 9f51d7077..a80b4c2d7 100644
--- a/src/multimedia/wasm/qwasmaudiosource.cpp
+++ b/src/multimedia/wasm/qwasmaudiosource.cpp
@@ -69,15 +69,16 @@ QWasmAudioSource::QWasmAudioSource(const QByteArray &device , QObject *parent)
m_name(device),
m_timer(new QTimer(this))
{
- aldata = new ALData();
- connect(m_timer, &QTimer::timeout, this, [this](){
- Q_ASSERT(m_running);
- if (m_pullMode)
- writeBuffer();
- else
- if (bytesReady() > 0)
+ if (device.contains("Emscripten")) {
+ aldata = new ALData();
+ connect(m_timer, &QTimer::timeout, this, [this](){
+ Q_ASSERT(m_running);
+ if (m_pullMode)
+ writeBuffer();
+ else if (bytesReady() > 0)
emit m_device->readyRead();
- });
+ });
+ }
}
void QWasmAudioSource::start(QIODevice *device)
@@ -148,8 +149,10 @@ void QWasmAudioSource::start(bool mode)
m_tmpData = new char[m_bufferSize];
else
m_tmpData = nullptr;
- m_timer->setInterval(m_format.durationForBytes(m_bufferSize) / 3'000);
+ m_timer->setInterval(m_format.durationForBytes(m_bufferSize) / 3000);
+ m_timer->start();
+ alcGetError(aldata->device); // clear error state
aldata->device = alcCaptureOpenDevice(m_name.data(), m_format.sampleRate(), format,
m_format.framesForBytes(m_bufferSize));
@@ -167,7 +170,6 @@ void QWasmAudioSource::start(bool mode)
}
m_processed = 0;
m_running = true;
- m_timer->start();
}
void QWasmAudioSource::stop()
diff --git a/src/multimedia/wasm/qwasmmediadevices.cpp b/src/multimedia/wasm/qwasmmediadevices.cpp
index 2f4ff687f..e985654ac 100644
--- a/src/multimedia/wasm/qwasmmediadevices.cpp
+++ b/src/multimedia/wasm/qwasmmediadevices.cpp
@@ -243,6 +243,7 @@ void QWasmMediaDevices::getMediaDevices()
std::move(enumerateDevicesCallback));
});
}
+
}
void QWasmMediaDevices::getOpenALAudioDevices()