mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
videomanager: protect double video input creation
getVideoInput is called in two different place: + openVideoInput from the client + VideoRtpSession::startSender() from the daemon Nothing is blocking both sides to do it at the same time. In this case, two VideoInputs can be created, causing the second one to fail because the device is busy (used by the first one) and causing weird results (i.e. sometimes the video is not shown). Change-Id: I23e34a95efe4972fbe111c19f0f0989f5e8ae8a9
This commit is contained in:
@ -699,6 +699,7 @@ std::shared_ptr<video::VideoInput>
|
||||
getVideoInput(const std::string& id, video::VideoInputMode inputMode)
|
||||
{
|
||||
auto& vmgr = Manager::instance().getVideoManager();
|
||||
std::lock_guard<std::mutex> lk(vmgr.videoMutex);
|
||||
auto it = vmgr.videoInputs.find(id);
|
||||
if (it != vmgr.videoInputs.end()) {
|
||||
if (auto input = it->second.lock()) {
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
std::map<std::string, std::weak_ptr<AudioInput>, std::less<>> audioInputs;
|
||||
std::map<std::string, std::weak_ptr<video::VideoInput>, std::less<>> videoInputs;
|
||||
std::mutex audioMutex;
|
||||
std::mutex videoMutex;
|
||||
bool hasRunningPlayers();
|
||||
std::shared_ptr<video::VideoInput> getVideoInput(std::string_view id) const
|
||||
{
|
||||
|
Reference in New Issue
Block a user