summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJøger Hansegård <joger.hansegard@qt.io>2024-01-22 11:41:00 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-01-22 19:02:06 +0000
commitfd893ee8d3b1a0f4721b5b98c0de219f19e4db2c (patch)
treefc3d70dcfd692455a8be056f0f97d4c8018e4ae8
parent6402ec25207cb319224d0a0b15f272b7faacf854 (diff)
Fix regression causing asserts with FFmpeg media player
While fixing bumpy video playback on Windows with FFmpeg, we introduced two regressions that cause application to assert in debug (3363496a7f0a0690bc3a2e50172cf6563f198701). These bugs were not discovered because I was testing with a WARP device, not a proper GPU. The first issue is that the shared texture between FFmpeg and RHI was created with 0 mip levels. This causes validation error in the D3D debug layer, and causes assert when playing the first frame. The fix is to set 1 as MipLevels. The second issue is that when opening a second file in media player, we did not close the shared handle before recreating it. This causes an assert. The fix is to close the handle first. Task-number: QTBUG-111815 Task-number: QTBUG-115308 Task-number: QTBUG-111459 Task-number: QTBUG-109213 Pick-to: 6.5 Change-Id: Ifd621b174fc68ef50e40cb3ad2d1c4bd410cf15e Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit 10ba74ebc89c8134f6bbb126aae7667a92b45742) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit a25b5eafc1dbf047c9c9c6556cd45f8c21beea9d)
-rw-r--r--src/plugins/multimedia/ffmpeg/qffmpeghwaccel_d3d11.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_d3d11.cpp b/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_d3d11.cpp
index b5d229a48..fbd5593ed 100644
--- a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_d3d11.cpp
+++ b/src/plugins/multimedia/ffmpeg/qffmpeghwaccel_d3d11.cpp
@@ -139,10 +139,13 @@ bool TextureBridge::isSrcInitialized(const ID3D11Device *dev,
bool TextureBridge::recreateSrc(ID3D11Device *dev, const ComPtr<ID3D11Texture2D> &tex)
{
+ m_sharedHandle.close();
+
CD3D11_TEXTURE2D_DESC desc{};
tex->GetDesc(&desc);
CD3D11_TEXTURE2D_DESC texDesc{ desc.Format, desc.Width, desc.Height };
+ texDesc.MipLevels = 1;
texDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX | D3D11_RESOURCE_MISC_SHARED_NTHANDLE;
if (dev->CreateTexture2D(&texDesc, nullptr, m_srcTex.ReleaseAndGetAddressOf()) != S_OK)