diff --git a/src/conference.cpp b/src/conference.cpp index df14909432cb962efbaaeb7b409f8994790169ea..8d3fb3e3a25b7e0d03f8b7eff33c6f0d69a2585d 100644 --- a/src/conference.cpp +++ b/src/conference.cpp @@ -90,10 +90,7 @@ Conference::Conference() } auto active = false; if (auto videoMixer = shared->getVideoMixer()) - active = info.source == videoMixer->getActiveParticipant() - or (uri.empty() - and not videoMixer->getActiveParticipant()); // by default, local - // is shown as active + active = info.source == videoMixer->getActiveParticipant(); subCalls.erase(it->second); std::string_view partURI = uri; partURI = string_remove_suffix(partURI, '@'); @@ -216,6 +213,10 @@ Conference::setActiveParticipant(const std::string& participant_id) { if (!videoMixer_) return; + if (isHost(participant_id)) { + videoMixer_->setActiveHost(); + return; + } for (const auto& item : participants_) { if (auto call = Manager::instance().callFactory.getCall<SIPCall>(item)) { if (participant_id == item @@ -225,7 +226,7 @@ Conference::setActiveParticipant(const std::string& participant_id) } } } - // Set local by default + // Unset active participant by default videoMixer_->setActiveParticipant(nullptr); } @@ -235,6 +236,9 @@ Conference::setLayout(int layout) switch (layout) { case 0: getVideoMixer()->setVideoLayout(video::Layout::GRID); + // The layout shouldn't have an active participant + if (videoMixer_->getActiveParticipant()) + videoMixer_->setActiveParticipant(nullptr); break; case 1: getVideoMixer()->setVideoLayout(video::Layout::ONE_BIG_WITH_SMALL); diff --git a/src/media/video/video_mixer.cpp b/src/media/video/video_mixer.cpp index f41ea02064c041bf0e0ff9852b815f5a5f6a9de9..3371c06a72f998bb8b597f3ecc38581c5fc04573 100644 --- a/src/media/video/video_mixer.cpp +++ b/src/media/video/video_mixer.cpp @@ -136,10 +136,17 @@ VideoMixer::stopInput() } } +void +VideoMixer::setActiveHost() +{ + activeSource_ = videoLocal_.get(); + layoutUpdated_ += 1; +} + void VideoMixer::setActiveParticipant(Observable<std::shared_ptr<MediaFrame>>* ob) { - activeSource_ = ob ? ob : videoLocal_.get(); + activeSource_ = ob; layoutUpdated_ += 1; } diff --git a/src/media/video/video_mixer.h b/src/media/video/video_mixer.h index aef08af2faf14c506c49438c4eaaa9c70f50d72c..10a1c796a170919dba41ecd4ba87b5325f9bfdb2 100644 --- a/src/media/video/video_mixer.h +++ b/src/media/video/video_mixer.h @@ -72,6 +72,7 @@ public: void stopInput(); void setActiveParticipant(Observable<std::shared_ptr<MediaFrame>>* ob); + void setActiveHost(); Observable<std::shared_ptr<MediaFrame>>* getActiveParticipant() { return activeSource_; }