avmedia/source/win/player.cxx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
New commits: commit 9639193cc92bf0e2ec18f1a155bd1f4ef82899f9 Author: Balazs Varga <balazs.va...@collabora.com> AuthorDate: Mon Aug 18 20:04:01 2025 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Tue Aug 19 06:32:43 2025 +0200 fix sd local unit test failers after adding media foundation api sd.check fails in CppunitTest_sd_export_tests-ooxml2 because of not finished async calls before closing the unit test files. Workaround to not create any media player objects (temporary) for unit test files. Co-authored-by: Mike Kaganski <mike.kagan...@collabora.com> Change-Id: I93c8108a9806f2f6f171e07467afd4e79eae7ee8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189886 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/avmedia/source/win/player.cxx b/avmedia/source/win/player.cxx index 4ad9711ce843..a4f68e098062 100644 --- a/avmedia/source/win/player.cxx +++ b/avmedia/source/win/player.cxx @@ -36,6 +36,7 @@ #include "window.hxx" #include <cppuhelper/supportsservice.hxx> #include <o3tl/char16_t2wchar_t.hxx> +#include <o3tl/test_info.hxx> #include <osl/file.hxx> #include <rtl/ref.hxx> @@ -405,11 +406,16 @@ HRESULT Player::InitializeWindow(bool bAddSoundWindow) &g_pPlayer ); - // Create a new media item for this URL. - // The CreateMediaItemFromURL method completes asynchronously. When it does, - // MFPlay sends an MFP_EVENT_TYPE_MEDIAITEM_CREATED event. + // synchronous for unit tests (TODO) + static const BOOL bSync + = o3tl::IsRunningUnitTest() ? TRUE : FALSE; if (SUCCEEDED(hr)) - hr = g_pPlayer->CreateMediaItemFromURL(o3tl::toW(maURL.getStr()), FALSE, 0, nullptr); + { + // Create a new media item for this URL. + // The CreateMediaItemFromURL method completes asynchronously. When it does, + // MFPlay sends an MFP_EVENT_TYPE_MEDIAITEM_CREATED event. + hr = g_pPlayer->CreateMediaItemFromURL(o3tl::toW(maURL.getStr()), bSync, 0, nullptr); + } if (SUCCEEDED(hr)) m_state = Stopped;