avmedia : use std::recursive_mutex instead of osl::Mutex.

Mostly reverts 621143588b 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.versini@libreoffice.org>
This commit is contained in:
Arnaud Versini 2021-10-24 16:49:50 +02:00
parent 4582cea56e
commit 4d54aeb67a

View file

@ -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;