From 4d54aeb67a43a42acf8f3cd94d83584f6870ade2 Mon Sep 17 00:00:00 2001 From: Arnaud Versini Date: Sun, 24 Oct 2021 16:49:50 +0200 Subject: avmedia : use std::recursive_mutex instead of osl::Mutex. Mostly reverts 621143588b3cb438baf27fb6893ab02e7b06f9dd but using recursive_mutex instead. Change-Id: I4b23410720834e19c5dd28c43bc84ed1b3e08072 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153236 Tested-by: Jenkins Reviewed-by: Arnaud Versini --- avmedia/source/gstreamer/gstplayer.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'avmedia') diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx index 0bd3485efd9a..259185c197ec 100644 --- a/avmedia/source/gstreamer/gstplayer.cxx +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -98,7 +99,7 @@ private: DECL_STATIC_LINK(MissingPluginInstaller, launchUi, void*, void); - osl::Mutex mutex_; + std::recursive_mutex mutex_; std::set reported_; std::map>> queued_; rtl::Reference currentThread_; @@ -110,7 +111,7 @@ private: MissingPluginInstaller::~MissingPluginInstaller() { - osl::MutexGuard g(mutex_); + std::unique_lock g(mutex_); SAL_WARN_IF(currentThread_.is(), "avmedia.gstreamer", "unjoined thread"); inCleanUp_ = true; } @@ -138,7 +139,7 @@ void MissingPluginInstaller::report( rtl::Reference join; rtl::Reference launch; { - osl::MutexGuard g(mutex_); + std::unique_lock g(mutex_); if (reported_.find(detStr) != reported_.end()) { return; } @@ -183,7 +184,7 @@ void eraseSource(std::set> & set, Player const * source) void MissingPluginInstaller::detach(Player const * source) { rtl::Reference join; { - osl::MutexGuard g(mutex_); + std::unique_lock g(mutex_); if (inCleanUp_) { // Guard against ~MissingPluginInstaller with erroneously un-joined // currentThread_ (thus non-empty currentSources_) calling @@ -257,7 +258,7 @@ void MissingPluginInstallerThread::execute() { for (;;) { std::vector details; { - osl::MutexGuard g(inst.mutex_); + std::unique_lock g(inst.mutex_); assert(!inst.currentDetails_.empty()); details.swap(inst.currentDetails_); } @@ -270,7 +271,7 @@ void MissingPluginInstallerThread::execute() { args.push_back(nullptr); gst_install_plugins_sync(args.data(), nullptr); { - osl::MutexGuard g(inst.mutex_); + std::unique_lock g(inst.mutex_); if (inst.queued_.empty() || inst.launchNewThread_) { inst.launchNewThread_ = true; break; -- cgit