avmedia/source/gstreamer/gstplayer.cxx |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

New commits:
commit 4d54aeb67a43a42acf8f3cd94d83584f6870ade2
Author:     Arnaud Versini <arnaud.vers...@libreoffice.org>
AuthorDate: Sun Oct 24 16:49:50 2021 +0200
Commit:     Arnaud Versini <arnaud.vers...@libreoffice.org>
CommitDate: Tue Aug 8 14:35:37 2023 +0200

    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 <arnaud.vers...@libreoffice.org>

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 <cstddef>
 #include <cstring>
 #include <map>
+#include <mutex>
 #include <set>
 #include <vector>
 #include <math.h>
@@ -98,7 +99,7 @@ private:
 
     DECL_STATIC_LINK(MissingPluginInstaller, launchUi, void*, void);
 
-    osl::Mutex mutex_;
+    std::recursive_mutex mutex_;
     std::set<OString> reported_;
     std::map<OString, std::set<rtl::Reference<Player>>> queued_;
     rtl::Reference<MissingPluginInstallerThread> 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<MissingPluginInstallerThread> join;
     rtl::Reference<MissingPluginInstallerThread> 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<rtl::Reference<Player>> & set, 
Player const * source)
 void MissingPluginInstaller::detach(Player const * source) {
     rtl::Reference<MissingPluginInstallerThread> 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<OString> 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;

Reply via email to