diff options
author | Liang Qi <liang.qi@qt.io> | 2018-01-06 20:21:19 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-01-06 20:21:19 +0100 |
commit | 82621148de82d63a562163a72598e15ed98797a8 (patch) | |
tree | 030d345ad4a4ae612995949bbbeec66b36e69854 /src/plugins | |
parent | 2fc515ea1eaa0f7ffb56c4dadee560095c3374bd (diff) | |
parent | 7a3b8907060123fe5d487d4c9ba3a1e222f468bb (diff) |
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
.qmake.conf
Change-Id: I5acdc7e0bd3729b80522dfff0f388cf2507fb111
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/alsa/qalsaaudiooutput.cpp | 3 | ||||
-rw-r--r-- | src/plugins/android/src/common/qandroidvideooutput.cpp | 1 | ||||
-rw-r--r-- | src/plugins/avfoundation/camera/avfcamerasession.mm | 2 | ||||
-rw-r--r-- | src/plugins/common/evr/evrcustompresenter.cpp | 7 | ||||
-rw-r--r-- | src/plugins/common/evr/evrd3dpresentengine.cpp | 163 | ||||
-rw-r--r-- | src/plugins/directshow/camera/dscamerasession.cpp | 4 | ||||
-rw-r--r-- | src/plugins/directshow/dsserviceplugin.cpp | 6 | ||||
-rw-r--r-- | src/plugins/directshow/player/directshowplayerservice.cpp | 31 | ||||
-rw-r--r-- | src/plugins/directshow/player/directshowplayerservice.h | 4 | ||||
-rw-r--r-- | src/plugins/gstreamer/camerabin/camerabinsession.cpp | 12 | ||||
-rw-r--r-- | src/plugins/plugins.pro | 3 | ||||
-rw-r--r-- | src/plugins/wasapi/qwasapiaudiodeviceinfo.cpp | 2 | ||||
-rw-r--r-- | src/plugins/windowsaudio/qwindowsaudiodeviceinfo.cpp | 11 | ||||
-rw-r--r-- | src/plugins/windowsaudio/qwindowsaudiooutput.cpp | 3 |
14 files changed, 141 insertions, 111 deletions
diff --git a/src/plugins/alsa/qalsaaudiooutput.cpp b/src/plugins/alsa/qalsaaudiooutput.cpp index cd97ae85b..ddbe04de9 100644 --- a/src/plugins/alsa/qalsaaudiooutput.cpp +++ b/src/plugins/alsa/qalsaaudiooutput.cpp @@ -316,9 +316,6 @@ bool QAlsaAudioOutput::open() return false; } - if (!QAlsaAudioDeviceInfo::availableDevices(QAudio::AudioOutput).contains(m_device)) - return false; - QString dev; #if SND_LIB_VERSION < 0x1000e // 1.0.14 if (m_device != "default") diff --git a/src/plugins/android/src/common/qandroidvideooutput.cpp b/src/plugins/android/src/common/qandroidvideooutput.cpp index eb41d4a8e..b425b9d89 100644 --- a/src/plugins/android/src/common/qandroidvideooutput.cpp +++ b/src/plugins/android/src/common/qandroidvideooutput.cpp @@ -324,7 +324,6 @@ void QAndroidTextureVideoOutput::onFrameAvailable() if (!m_surface->isActive()) { QVideoSurfaceFormat format(frame.size(), frame.pixelFormat(), QAbstractVideoBuffer::GLTextureHandle); - format.setScanLineDirection(QVideoSurfaceFormat::BottomToTop); m_surface->start(format); } diff --git a/src/plugins/avfoundation/camera/avfcamerasession.mm b/src/plugins/avfoundation/camera/avfcamerasession.mm index 0b7c0e9d8..8e3436d39 100644 --- a/src/plugins/avfoundation/camera/avfcamerasession.mm +++ b/src/plugins/avfoundation/camera/avfcamerasession.mm @@ -234,7 +234,7 @@ void AVFCameraSession::updateCameraDevices() break; case AVCaptureDevicePositionFront: info.position = QCamera::FrontFace; - info.orientation = 270; + info.orientation = 90; break; default: info.position = QCamera::UnspecifiedPosition; diff --git a/src/plugins/common/evr/evrcustompresenter.cpp b/src/plugins/common/evr/evrcustompresenter.cpp index 958204079..b07dbe719 100644 --- a/src/plugins/common/evr/evrcustompresenter.cpp +++ b/src/plugins/common/evr/evrcustompresenter.cpp @@ -1350,13 +1350,6 @@ HRESULT EVRCustomPresenter::createOptimalVideoType(IMFMediaType *proposedType, I // Modify the new type. - // Set the pixel aspect ratio (PAR) to 1:1 (see assumption #1, above) - // The ratio is packed in a single UINT64. A helper function is normally available for - // that (MFSetAttributeRatio) but it's not correctly defined in MinGW 4.9.1. - hr = mtOptimal->SetUINT64(MF_MT_PIXEL_ASPECT_RATIO, (((UINT64) 1) << 32) | ((UINT64) 1)); - if (FAILED(hr)) - goto done; - hr = proposedType->GetUINT64(MF_MT_FRAME_SIZE, &size); width = int(HI32(size)); height = int(LO32(size)); diff --git a/src/plugins/common/evr/evrd3dpresentengine.cpp b/src/plugins/common/evr/evrd3dpresentengine.cpp index fd9ccdef1..54403faba 100644 --- a/src/plugins/common/evr/evrd3dpresentengine.cpp +++ b/src/plugins/common/evr/evrd3dpresentengine.cpp @@ -47,6 +47,7 @@ #include <QDebug> #include <qthread.h> #include <private/qmediaopenglhelper_p.h> +#include <QOffscreenSurface> #ifdef MAYBE_ANGLE # include <qguiapplication.h> @@ -128,11 +129,65 @@ class OpenGLResources : public QObject { public: OpenGLResources() - : egl(new EGLWrapper) - , eglDisplay(0) - , eglSurface(0) - , glTexture(0) - {} + : m_egl(new EGLWrapper) + , m_eglDisplay(nullptr) + , m_eglSurface(nullptr) + , m_glTexture(0) + , m_glContext(QOpenGLContext::currentContext()) + { + Q_ASSERT(m_glContext); + } + + unsigned int glTexture() const + { + return m_glTexture; + } + + bool createTexture(const QVideoSurfaceFormat &format, IDirect3DDevice9Ex *device, + IDirect3DTexture9 **texture) + { + if (!m_glContext) + return false; + + m_glContext->functions()->glGenTextures(1, &m_glTexture); + QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); + m_eglDisplay = static_cast<EGLDisplay*>( + nativeInterface->nativeResourceForContext("eglDisplay", m_glContext)); + EGLConfig *eglConfig = static_cast<EGLConfig*>( + nativeInterface->nativeResourceForContext("eglConfig", m_glContext)); + + const bool hasAlpha = m_glContext->format().hasAlpha(); + + EGLint attribs[] = { + EGL_WIDTH, format.frameWidth(), + EGL_HEIGHT, format.frameHeight(), + EGL_TEXTURE_FORMAT, (hasAlpha ? EGL_TEXTURE_RGBA : EGL_TEXTURE_RGB), + EGL_TEXTURE_TARGET, EGL_TEXTURE_2D, + EGL_NONE + }; + + m_eglSurface = m_egl->createPbufferSurface(m_eglDisplay, eglConfig, attribs); + + HANDLE share_handle = 0; + PFNEGLQUERYSURFACEPOINTERANGLEPROC eglQuerySurfacePointerANGLE = + reinterpret_cast<PFNEGLQUERYSURFACEPOINTERANGLEPROC>( + m_egl->getProcAddress("eglQuerySurfacePointerANGLE")); + Q_ASSERT(eglQuerySurfacePointerANGLE); + eglQuerySurfacePointerANGLE( + m_eglDisplay, + m_eglSurface, + EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE, &share_handle); + + device->CreateTexture(format.frameWidth(), format.frameHeight(), 1, + D3DUSAGE_RENDERTARGET, + (hasAlpha ? D3DFMT_A8R8G8B8 : D3DFMT_X8R8G8B8), + D3DPOOL_DEFAULT, texture, &share_handle); + + m_glContext->functions()->glBindTexture(GL_TEXTURE_2D, m_glTexture); + m_egl->bindTexImage(m_eglDisplay, m_eglSurface, EGL_BACK_BUFFER); + + return texture != NULL; + } void release() { @@ -142,24 +197,32 @@ public: deleteLater(); } - EGLWrapper *egl; - EGLDisplay *eglDisplay; - EGLSurface eglSurface; - unsigned int glTexture; - private: + EGLWrapper *m_egl; + EGLDisplay *m_eglDisplay; + EGLSurface m_eglSurface; + unsigned int m_glTexture; + QOpenGLContext *m_glContext; + ~OpenGLResources() { - Q_ASSERT(QOpenGLContext::currentContext() != NULL); + QScopedPointer<QOffscreenSurface> surface; + if (m_glContext != QOpenGLContext::currentContext()) { + surface.reset(new QOffscreenSurface); + surface->create(); + m_glContext->makeCurrent(surface.data()); + } - if (eglSurface && egl) { - egl->releaseTexImage(eglDisplay, eglSurface, EGL_BACK_BUFFER); - egl->destroySurface(eglDisplay, eglSurface); + if (m_eglSurface && m_egl) { + m_egl->releaseTexImage(m_eglDisplay, m_eglSurface, EGL_BACK_BUFFER); + m_egl->destroySurface(m_eglDisplay, m_eglSurface); } - if (glTexture) - QOpenGLContext::currentContext()->functions()->glDeleteTextures(1, &glTexture); + if (m_glTexture) + m_glContext->functions()->glDeleteTextures(1, &m_glTexture); - delete egl; + delete m_egl; + if (surface) + m_glContext->doneCurrent(); } }; @@ -257,9 +320,9 @@ QVariant IMFSampleVideoBuffer::handle() const if (handleType() != GLTextureHandle) return handle; - if (m_engine->m_glResources && (m_textureUpdated || m_engine->updateTexture(m_surface))) { + if (m_textureUpdated || m_engine->updateTexture(m_surface)) { m_textureUpdated = true; - handle = QVariant::fromValue<unsigned int>(m_engine->m_glResources->glTexture); + handle = QVariant::fromValue<unsigned int>(m_engine->m_glResources->glTexture()); } #endif @@ -518,6 +581,10 @@ done: : qt_evr_pixelFormatFromD3DFormat(d3dFormat), m_useTextureRendering ? QAbstractVideoBuffer::GLTextureHandle : QAbstractVideoBuffer::NoHandle); + UINT32 horizontal = 1, vertical = 1; + hr = MFGetAttributeRatio(format, MF_MT_PIXEL_ASPECT_RATIO, &horizontal, &vertical); + if (SUCCEEDED(hr)) + m_surfaceFormat.setPixelAspectRatio(horizontal, vertical); } else { releaseResources(); } @@ -553,61 +620,11 @@ QVideoFrame D3DPresentEngine::makeVideoFrame(IMFSample *sample) bool D3DPresentEngine::createRenderTexture() { - if (m_texture) - return true; - - Q_ASSERT(QOpenGLContext::currentContext() != NULL); - - if (!m_glResources) - m_glResources = new OpenGLResources; - - QOpenGLContext *currentContext = QOpenGLContext::currentContext(); - if (!currentContext) - return false; - - QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); - m_glResources->eglDisplay = static_cast<EGLDisplay*>( - nativeInterface->nativeResourceForContext("eglDisplay", currentContext)); - EGLConfig *eglConfig = static_cast<EGLConfig*>( - nativeInterface->nativeResourceForContext("eglConfig", currentContext)); - - currentContext->functions()->glGenTextures(1, &m_glResources->glTexture); - - bool hasAlpha = currentContext->format().hasAlpha(); - - EGLint attribs[] = { - EGL_WIDTH, m_surfaceFormat.frameWidth(), - EGL_HEIGHT, m_surfaceFormat.frameHeight(), - EGL_TEXTURE_FORMAT, hasAlpha ? EGL_TEXTURE_RGBA : EGL_TEXTURE_RGB, - EGL_TEXTURE_TARGET, EGL_TEXTURE_2D, - EGL_NONE - }; - - EGLSurface pbuffer = m_glResources->egl->createPbufferSurface(m_glResources->eglDisplay, eglConfig, attribs); - - HANDLE share_handle = 0; - PFNEGLQUERYSURFACEPOINTERANGLEPROC eglQuerySurfacePointerANGLE = - reinterpret_cast<PFNEGLQUERYSURFACEPOINTERANGLEPROC>(m_glResources->egl->getProcAddress("eglQuerySurfacePointerANGLE")); - Q_ASSERT(eglQuerySurfacePointerANGLE); - eglQuerySurfacePointerANGLE( - m_glResources->eglDisplay, - pbuffer, - EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE, &share_handle); - - - m_device->CreateTexture(m_surfaceFormat.frameWidth(), m_surfaceFormat.frameHeight(), 1, - D3DUSAGE_RENDERTARGET, - hasAlpha ? D3DFMT_A8R8G8B8 : D3DFMT_X8R8G8B8, - D3DPOOL_DEFAULT, - &m_texture, - &share_handle); - - m_glResources->eglSurface = pbuffer; - - QOpenGLContext::currentContext()->functions()->glBindTexture(GL_TEXTURE_2D, m_glResources->glTexture); - m_glResources->egl->bindTexImage(m_glResources->eglDisplay, m_glResources->eglSurface, EGL_BACK_BUFFER); + if (m_glResources) + m_glResources->release(); - return m_texture != NULL; + m_glResources = new OpenGLResources; + return m_glResources->createTexture(m_surfaceFormat, m_device, &m_texture); } bool D3DPresentEngine::updateTexture(IDirect3DSurface9 *src) diff --git a/src/plugins/directshow/camera/dscamerasession.cpp b/src/plugins/directshow/camera/dscamerasession.cpp index 195712057..6590afeb9 100644 --- a/src/plugins/directshow/camera/dscamerasession.cpp +++ b/src/plugins/directshow/camera/dscamerasession.cpp @@ -815,8 +815,8 @@ bool DSCameraSession::configurePreviewFormat() return false; } - // Set sample grabber format (always RGB32) - static const AM_MEDIA_TYPE grabberFormat { MEDIATYPE_Video, MEDIASUBTYPE_RGB32, 0, 0, 0, FORMAT_VideoInfo, nullptr, 0, nullptr}; + // Set sample grabber format + static const AM_MEDIA_TYPE grabberFormat { MEDIATYPE_Video, MEDIASUBTYPE_ARGB32, 0, 0, 0, FORMAT_VideoInfo, nullptr, 0, nullptr}; if (!m_previewSampleGrabber->setMediaType(&grabberFormat)) return false; diff --git a/src/plugins/directshow/dsserviceplugin.cpp b/src/plugins/directshow/dsserviceplugin.cpp index 51be7e500..cb4f0cdf9 100644 --- a/src/plugins/directshow/dsserviceplugin.cpp +++ b/src/plugins/directshow/dsserviceplugin.cpp @@ -123,7 +123,9 @@ QMediaServiceProviderHint::Features DSServicePlugin::supportedFeatures( QByteArray DSServicePlugin::defaultDevice(const QByteArray &service) const { if (service == Q_MEDIASERVICE_CAMERA) { + addRefCount(); const QList<DSVideoDeviceInfo> &devs = DSVideoDeviceControl::availableDevices(); + releaseRefCount(); if (!devs.isEmpty()) return devs.first().first; } @@ -135,7 +137,9 @@ QList<QByteArray> DSServicePlugin::devices(const QByteArray &service) const QList<QByteArray> result; if (service == Q_MEDIASERVICE_CAMERA) { + addRefCount(); const QList<DSVideoDeviceInfo> &devs = DSVideoDeviceControl::availableDevices(); + releaseRefCount(); for (const DSVideoDeviceInfo &info : devs) result.append(info.first); } @@ -146,7 +150,9 @@ QList<QByteArray> DSServicePlugin::devices(const QByteArray &service) const QString DSServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device) { if (service == Q_MEDIASERVICE_CAMERA) { + addRefCount(); const QList<DSVideoDeviceInfo> &devs = DSVideoDeviceControl::availableDevices(); + releaseRefCount(); for (const DSVideoDeviceInfo &info : devs) { if (info.first == device) return info.second; diff --git a/src/plugins/directshow/player/directshowplayerservice.cpp b/src/plugins/directshow/player/directshowplayerservice.cpp index 8ee5d67a1..2218ca5ed 100644 --- a/src/plugins/directshow/player/directshowplayerservice.cpp +++ b/src/plugins/directshow/player/directshowplayerservice.cpp @@ -318,18 +318,15 @@ void DirectShowPlayerService::load(const QMediaContent &media, QIODevice *stream m_graphStatus = InvalidMedia; m_error = QMediaPlayer::ResourceError; } else { - // {36b73882-c2c8-11cf-8b46-00805f6cef60} - static const GUID iid_IFilterGraph2 = { - 0x36b73882, 0xc2c8, 0x11cf, {0x8b, 0x46, 0x00, 0x80, 0x5f, 0x6c, 0xef, 0x60} }; m_graphStatus = Loading; - m_graph = com_new<IFilterGraph2>(CLSID_FilterGraph, iid_IFilterGraph2); - if (stream) m_pendingTasks = SetStreamSource; else m_pendingTasks = SetUrlSource; + m_pendingTasks |= CreateGraph; + ::SetEvent(m_taskHandle); } @@ -340,6 +337,17 @@ void DirectShowPlayerService::load(const QMediaContent &media, QIODevice *stream updateStatus(); } +void DirectShowPlayerService::doCreateGraph(QMutexLocker *locker) +{ + Q_UNUSED(locker); + + // {36b73882-c2c8-11cf-8b46-00805f6cef60} + static const GUID iid_IFilterGraph2 = { + 0x36b73882, 0xc2c8, 0x11cf, {0x8b, 0x46, 0x00, 0x80, 0x5f, 0x6c, 0xef, 0x60} }; + + m_graph = com_new<IFilterGraph2>(CLSID_FilterGraphNoThread, iid_IFilterGraph2); +} + void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker) { IBaseFilter *source = 0; @@ -1686,6 +1694,8 @@ void DirectShowPlayerService::run() { QMutexLocker locker(&m_mutex); + CoInitialize(NULL); + for (;;) { while (m_pendingTasks == 0) { DWORD result = 0; @@ -1700,12 +1710,17 @@ void DirectShowPlayerService::run() } locker.relock(); - if (result == WAIT_OBJECT_0 + 1) { + if (m_graph && result == WAIT_OBJECT_0 + 1) { graphEvent(&locker); } } - if (m_pendingTasks & ReleaseGraph) { + if (m_pendingTasks & CreateGraph) { + m_pendingTasks ^= CreateGraph; + m_executingTask = CreateGraph; + + doCreateGraph(&locker); + } else if (m_pendingTasks & ReleaseGraph) { m_pendingTasks ^= ReleaseGraph; m_executingTask = ReleaseGraph; @@ -1798,6 +1813,8 @@ void DirectShowPlayerService::run() } m_executingTask = 0; } + + CoUninitialize(); } QT_END_NAMESPACE diff --git a/src/plugins/directshow/player/directshowplayerservice.h b/src/plugins/directshow/player/directshowplayerservice.h index 01d05449e..cc7b4dd3e 100644 --- a/src/plugins/directshow/player/directshowplayerservice.h +++ b/src/plugins/directshow/player/directshowplayerservice.h @@ -124,6 +124,7 @@ private: void run(); + void doCreateGraph(QMutexLocker *locker); void doSetUrlSource(QMutexLocker *locker); void doSetStreamSource(QMutexLocker *locker); void doRender(QMutexLocker *locker); @@ -169,7 +170,8 @@ private: ReleaseVideoProbe = 0x40000, ReleaseFilters = ReleaseGraph | ReleaseAudioOutput | ReleaseVideoOutput | ReleaseAudioProbe - | ReleaseVideoProbe + | ReleaseVideoProbe, + CreateGraph = 0x80000 }; enum Event diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp index 4941c6ef6..cfac61c01 100644 --- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp @@ -466,6 +466,9 @@ GstElement *CameraBinSession::buildCameraSource() #if CAMERABIN_DEBUG qDebug() << Q_FUNC_INFO; #endif + if (m_inputDevice.isEmpty()) + return nullptr; + if (!m_inputDeviceHasChanged) return m_cameraSrc; @@ -482,7 +485,7 @@ GstElement *CameraBinSession::buildCameraSource() if (!m_cameraSrc) m_cameraSrc = camSrc; - if (m_cameraSrc && !m_inputDevice.isEmpty()) { + if (m_cameraSrc) { #if CAMERABIN_DEBUG qDebug() << "set camera device" << m_inputDevice; #endif @@ -729,18 +732,21 @@ void CameraBinSession::setState(QCamera::State newState) if (newState == m_pendingState) return; - m_pendingState = newState; - emit pendingStateChanged(m_pendingState); + emit pendingStateChanged(newState); #if CAMERABIN_DEBUG qDebug() << Q_FUNC_INFO << newState; #endif setStateHelper(newState); + m_pendingState = newState; } void CameraBinSession::setStateHelper(QCamera::State state) { + if (state == m_pendingState) + return; + switch (state) { case QCamera::UnloadedState: unload(); diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 98a1bf242..71b9ec6e1 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -40,7 +40,8 @@ win32:!winrt { winrt { - SUBDIRS += winrt + SUBDIRS += winrt \ + audiocapture } unix:!mac:!android { diff --git a/src/plugins/wasapi/qwasapiaudiodeviceinfo.cpp b/src/plugins/wasapi/qwasapiaudiodeviceinfo.cpp index e1a46841d..53345dec8 100644 --- a/src/plugins/wasapi/qwasapiaudiodeviceinfo.cpp +++ b/src/plugins/wasapi/qwasapiaudiodeviceinfo.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcMmDeviceInfo, "qt.multimedia.deviceinfo") QWasapiAudioDeviceInfo::QWasapiAudioDeviceInfo(QByteArray dev, QAudio::Mode mode) - : m_deviceName(dev) + : m_deviceName(QString::fromLocal8Bit(dev)) { qCDebug(lcMmDeviceInfo) << __FUNCTION__ << dev << mode; m_interface = QWasapiUtils::createOrGetInterface(dev, mode); diff --git a/src/plugins/windowsaudio/qwindowsaudiodeviceinfo.cpp b/src/plugins/windowsaudio/qwindowsaudiodeviceinfo.cpp index 83e9ccfc8..c054c0f76 100644 --- a/src/plugins/windowsaudio/qwindowsaudiodeviceinfo.cpp +++ b/src/plugins/windowsaudio/qwindowsaudiodeviceinfo.cpp @@ -238,21 +238,16 @@ void QWindowsAudioDeviceInfo::updateLists() if (!sizez.isEmpty()) return; - bool hasCaps = false; DWORD fmt = 0; if(mode == QAudio::AudioOutput) { WAVEOUTCAPS woc; - if (waveOutGetDevCaps(devId, &woc, sizeof(WAVEOUTCAPS)) == MMSYSERR_NOERROR) { - hasCaps = true; + if (waveOutGetDevCaps(devId, &woc, sizeof(WAVEOUTCAPS)) == MMSYSERR_NOERROR) fmt = woc.dwFormats; - } } else { WAVEINCAPS woc; - if (waveInGetDevCaps(devId, &woc, sizeof(WAVEINCAPS)) == MMSYSERR_NOERROR) { - hasCaps = true; + if (waveInGetDevCaps(devId, &woc, sizeof(WAVEINCAPS)) == MMSYSERR_NOERROR) fmt = woc.dwFormats; - } } sizez.clear(); @@ -260,7 +255,7 @@ void QWindowsAudioDeviceInfo::updateLists() channelz.clear(); typez.clear(); - if (hasCaps) { + if (fmt) { // Check sample size if ((fmt & WAVE_FORMAT_1M08) || (fmt & WAVE_FORMAT_1S08) diff --git a/src/plugins/windowsaudio/qwindowsaudiooutput.cpp b/src/plugins/windowsaudio/qwindowsaudiooutput.cpp index 815b78979..eb4caf128 100644 --- a/src/plugins/windowsaudio/qwindowsaudiooutput.cpp +++ b/src/plugins/windowsaudio/qwindowsaudiooutput.cpp @@ -298,10 +298,7 @@ void QWindowsAudioOutput::close() deviceState = QAudio::StoppedState; errorState = QAudio::NoError; - int delay = (buffer_size-bytesFree())*1000/(settings.sampleRate() - *settings.channelCount()*(settings.sampleSize()/8)); waveOutReset(hWaveOut); - Sleep(delay+10); freeBlocks(waveBlocks); waveOutClose(hWaveOut); |