Skip to content
Snippets Groups Projects
Commit 0cbecf88 authored by Alexandre Lision's avatar Alexandre Lision Committed by Edric Milaret
Browse files

video: fix deadlock

stopDecoding was blocking when making a conference because no semaphore were
available. Semaphore shouldn't have been placed here in the first place

Issue: #81116
Change-Id: Ia686601f40c430ba716c91b2667268e4fb108446
parent 595c1469
Branches
Tags
No related merge requests found
...@@ -55,7 +55,7 @@ VideoManagerInterface::~VideoManagerInterface() ...@@ -55,7 +55,7 @@ VideoManagerInterface::~VideoManagerInterface()
} }
VideoManagerSignalProxy::VideoManagerSignalProxy(VideoManagerInterface* parent) : QObject(parent), VideoManagerSignalProxy::VideoManagerSignalProxy(VideoManagerInterface* parent) : QObject(parent),
m_pParent(parent), m_pSem(new QSemaphore(3)) m_pParent(parent)
{} {}
void VideoManagerSignalProxy::slotDeviceEvent() void VideoManagerSignalProxy::slotDeviceEvent()
...@@ -68,21 +68,13 @@ void VideoManagerSignalProxy::slotDeviceEvent() ...@@ -68,21 +68,13 @@ void VideoManagerSignalProxy::slotDeviceEvent()
void VideoManagerSignalProxy::slotStartedDecoding(const QString &id, const QString &shmPath, int width, int height, bool isMixer) void VideoManagerSignalProxy::slotStartedDecoding(const QString &id, const QString &shmPath, int width, int height, bool isMixer)
{ {
QTimer::singleShot(0, [=] { QTimer::singleShot(0, [=] {
if(m_pSem->available() == 3)
emit m_pParent->startedDecoding(id,shmPath,width,height,isMixer); emit m_pParent->startedDecoding(id,shmPath,width,height,isMixer);
else {
QTimer::singleShot(0, [=] {
slotStartedDecoding(id,shmPath,width,height,isMixer);
});
}
}); });
} }
void VideoManagerSignalProxy::slotStoppedDecoding(const QString &id, const QString &shmPath, bool isMixer) void VideoManagerSignalProxy::slotStoppedDecoding(const QString &id, const QString &shmPath, bool isMixer)
{ {
m_pSem->acquire(1);
QTimer::singleShot(0, [=] { QTimer::singleShot(0, [=] {
emit m_pParent->stoppedDecoding(id,shmPath,isMixer); emit m_pParent->stoppedDecoding(id,shmPath,isMixer);
m_pSem->release(1);
}); });
} }
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <QtCore/QThread> #include <QtCore/QThread>
#include <QtCore/QList> #include <QtCore/QList>
#include <QtCore/QMap> #include <QtCore/QMap>
#include <QtCore/QSemaphore>
#include <QtCore/QString> #include <QtCore/QString>
#include <QtCore/QStringList> #include <QtCore/QStringList>
#include <QtCore/QVariant> #include <QtCore/QVariant>
...@@ -41,7 +40,6 @@ ...@@ -41,7 +40,6 @@
#include "conversions_wrap.hpp" #include "conversions_wrap.hpp"
class VideoManagerInterface; class VideoManagerInterface;
class QSemaphore;
class VideoManagerSignalProxy : public QObject class VideoManagerSignalProxy : public QObject
{ {
...@@ -56,7 +54,6 @@ public Q_SLOTS: ...@@ -56,7 +54,6 @@ public Q_SLOTS:
private: private:
VideoManagerInterface* m_pParent; VideoManagerInterface* m_pParent;
QSemaphore* m_pSem;
}; };
class VideoManagerProxySender : public QObject class VideoManagerProxySender : public QObject
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment