From 15abbc8c9e3acb5d9bee70fd8bec25242ec7abdd Mon Sep 17 00:00:00 2001 From: Val Doroshchuk Date: Fri, 21 Jun 2019 15:41:30 +0200 Subject: DirectShow: Map MEDIASUBTYPE_RGB24 to QVideoFrame::Format_BGR24 MEDIASUBTYPE_RGB24 inverts Red and Blue channels, i.e. on Little-Endian: BGR and thus Format_BGR24 should be used instead of Format_RGB24. To reproduce the bug: QCameraViewfinderSettings settings; settings.setPixelFormat(QVideoFrame::Format_RGB24); camera->setViewfinderSettings(settings); If the camera supports MEDIASUBTYPE_RGB24 it will show Red and Blue channels inverted. *NOTE* This fix causes ignoring MEDIASUBTYPE_RGB24 format and using MEDUASUBTYPE_RGB32 instead. Because the video surfaces currently do not support QVideoFrame::Format_BGR32. So it fixes the issue with inverted colors by ignoring RGB24 media type. If there is a need to use RGB24, it would require to implement custom surface which supports QVideoFrame::Format_BGR24 and swap colors manually. Change-Id: I0d77694ef688a05dc52d13f991a5088e00f72867 Fixes: QTBUG-75959 Reviewed-by: Timur Pocheptsov --- src/plugins/directshow/common/directshowmediatype.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/directshow/common/directshowmediatype.cpp b/src/plugins/directshow/common/directshowmediatype.cpp index fe86e0204..103f1ddc1 100644 --- a/src/plugins/directshow/common/directshowmediatype.cpp +++ b/src/plugins/directshow/common/directshowmediatype.cpp @@ -52,7 +52,7 @@ namespace { { QVideoFrame::Format_ARGB32, MEDIASUBTYPE_ARGB32 }, { QVideoFrame::Format_RGB32, MEDIASUBTYPE_RGB32 }, - { QVideoFrame::Format_RGB24, MEDIASUBTYPE_RGB24 }, + { QVideoFrame::Format_BGR24, MEDIASUBTYPE_RGB24 }, { QVideoFrame::Format_RGB565, MEDIASUBTYPE_RGB565 }, { QVideoFrame::Format_RGB555, MEDIASUBTYPE_RGB555 }, { QVideoFrame::Format_AYUV444, MEDIASUBTYPE_AYUV }, -- cgit v1.2.3 From bc03bfdbcf63a81f7261637378e2447e76dc7e97 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 2 Jul 2019 16:07:00 +0200 Subject: Fix MinGW build With newer MinGW versions we have to link against libamstrmid for the symbols IID_IMFTopologyServiceLookupClient, IID_IMFVideoDeviceID and IID_IMFVideoPresenter. Fixes: QTBUG-70655 Change-Id: Ib203d991d2bd8cd63193a7319c156f30f0e8826b Reviewed-by: VaL Doroshchuk --- src/plugins/directshow/directshow.pro | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/plugins/directshow/directshow.pro b/src/plugins/directshow/directshow.pro index 54d617166..a3badf603 100644 --- a/src/plugins/directshow/directshow.pro +++ b/src/plugins/directshow/directshow.pro @@ -16,6 +16,10 @@ mingw { DEFINES += NO_DSHOW_STRSAFE } +mingw { + LIBS_PRIVATE += -lamstrmid +} + include(common/common.pri) qtConfig(directshow-player): include(player/player.pri) include(camera/camera.pri) -- cgit v1.2.3 From 767a7e1c9e418545605f2828b7b0847ee650dea8 Mon Sep 17 00:00:00 2001 From: VaL Doroshchuk Date: Thu, 30 May 2019 14:34:43 +0200 Subject: Fix crash when app is destroyed before QSample::load is finished MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QSample objects live and handled in loading thread (which uses QNetworkAccessManager). When the app is finished and going to be destroyed, all static objects are destroying as well. In case if static QNetworkConfigurationManagerPrivate (which is used by QNetworkAccessManager) is destroyed before static QSampleCache, and loading of the resource is not finished yet (still executing QNetworkAccessManager::get()), this produces a crash. Since the loading thread is started only when loading of new QSample is requested, (and all events are also handled by this thread) proposing a fix to wait before loading thread is finished when a sample is requested to be released. This postpones deleting of the QSample either when new sample is requested to load or when QSampleCache is destroyed. This makes sure that no loading thread exists when all QSoundEffects objects and afterwards QNetworkConfigurationManagerPrivate are already deleted. Change-Id: I55669ea4c2796a48cae4f0465f7f74d89e393675 Fixes: QTBUG-76090 Reviewed-by: Christian Strømme --- src/multimedia/audio/qsamplecache_p.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/multimedia/audio/qsamplecache_p.cpp b/src/multimedia/audio/qsamplecache_p.cpp index c956d764b..73fc3cd2f 100644 --- a/src/multimedia/audio/qsamplecache_p.cpp +++ b/src/multimedia/audio/qsamplecache_p.cpp @@ -295,9 +295,12 @@ void QSample::loadIfNecessary() } } -// Called in both threads +// Called in application thread bool QSampleCache::notifyUnreferencedSample(QSample* sample) { + if (m_loadingThread.isRunning()) + m_loadingThread.wait(); + QMutexLocker locker(&m_mutex); if (m_capacity > 0) return false; @@ -306,16 +309,17 @@ bool QSampleCache::notifyUnreferencedSample(QSample* sample) return true; } -// Called in application threadd +// Called in application thread void QSample::release() { QMutexLocker locker(&m_mutex); #ifdef QT_SAMPLECACHE_DEBUG qDebug() << "Sample:: release" << this << QThread::currentThread() << m_ref; #endif - m_ref--; - if (m_ref == 0) + if (--m_ref == 0) { + locker.unlock(); m_parent->notifyUnreferencedSample(this); + } } // Called in dtor and when stream is loaded -- cgit v1.2.3 From 8756a20821305eabb6026400e6d3cdc79df1690d Mon Sep 17 00:00:00 2001 From: Val Doroshchuk Date: Mon, 1 Jul 2019 16:12:30 +0200 Subject: GStreamer: Fix 0.10 compile error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: QTBUG-76816 Change-Id: I2909c2f2df91ac26b5104e24892310aa62cad172 Reviewed-by: Christian Strømme --- src/gsttools/qgstreamerplayersession.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gsttools/qgstreamerplayersession.cpp b/src/gsttools/qgstreamerplayersession.cpp index 5ede8a1c9..15587f0ce 100644 --- a/src/gsttools/qgstreamerplayersession.cpp +++ b/src/gsttools/qgstreamerplayersession.cpp @@ -981,9 +981,11 @@ bool QGstreamerPlayerSession::isSeekable() const bool QGstreamerPlayerSession::play() { +#if GST_CHECK_VERSION(1,0,0) static bool dumpDot = qEnvironmentVariableIsSet("GST_DEBUG_DUMP_DOT_DIR"); if (dumpDot) - gst_debug_bin_to_dot_file_with_ts(GST_BIN(m_pipeline), GstDebugGraphDetails(GST_DEBUG_GRAPH_SHOW_ALL), "session.play"); + gst_debug_bin_to_dot_file_with_ts(GST_BIN(m_pipeline), GstDebugGraphDetails(GST_DEBUG_GRAPH_SHOW_ALL), "gst.play"); +#endif #ifdef DEBUG_PLAYBIN qDebug() << Q_FUNC_INFO; #endif -- cgit v1.2.3 From 1b70bbed49d12af86851a505a5aa5428b9e0c567 Mon Sep 17 00:00:00 2001 From: Nate Weibley Date: Sat, 17 Feb 2018 15:51:02 -0500 Subject: Fix GetFrameRateList checks and memory leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GetFrameRateList passes an unmanaged pointer to the caller which must be manually freed with CoTaskMemFree. Additionally the Chromium project notes that some drivers cause quirky return values which we would not catch without stricter checks. See: https://chromium.googlesource.com/chromium/src/media/+/8cc93abd7339eeb9b7c2a12cca07b3dc245b2139/video/capture/win/video_capture_device_win.cc#484 Change-Id: I6aa4a6ea1ac0241e585e98cf9ff63240bacd3956 Reviewed-by: Christian Strømme --- src/plugins/directshow/camera/dscamerasession.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/directshow/camera/dscamerasession.cpp b/src/plugins/directshow/camera/dscamerasession.cpp index 5ab9f67d8..a237811ae 100644 --- a/src/plugins/directshow/camera/dscamerasession.cpp +++ b/src/plugins/directshow/camera/dscamerasession.cpp @@ -1137,8 +1137,8 @@ void DSCameraSession::updateSourceCapabilities() long listSize = 0; LONGLONG *frameRates = 0; SIZE size = { resolution.width(), resolution.height() }; - if (SUCCEEDED(pVideoControl->GetFrameRateList(pPin, iIndex, size, - &listSize, &frameRates))) { + hr = pVideoControl->GetFrameRateList(pPin, iIndex, size, &listSize, &frameRates); + if (hr == S_OK && listSize > 0 && frameRates) { for (long i = 0; i < listSize; ++i) { qreal fr = qreal(10000000) / frameRates[i]; frameRateRanges.append(QCamera::FrameRateRange(fr, fr)); @@ -1147,6 +1147,8 @@ void DSCameraSession::updateSourceCapabilities() // Make sure higher frame rates come first std::sort(frameRateRanges.begin(), frameRateRanges.end(), qt_frameRateRangeGreaterThan); } + + CoTaskMemFree(frameRates); pPin->Release(); } } -- cgit v1.2.3