diff --git a/src/conference.cpp b/src/conference.cpp index 9d079cc49548b43dcb3dc56c7eeeae1604b12339..fd594646ffa50afa19d620e337e4a9602cb762e2 100644 --- a/src/conference.cpp +++ b/src/conference.cpp @@ -209,6 +209,19 @@ Conference::Conference(const std::shared_ptr<Account>& account) shared->updateConferenceInfo(std::move(newInfo)); }); }); + + auto conf_res = split_string_to_unsigned(jami::Manager::instance() + .videoPreferences.getConferenceResolution(), + 'x'); + if (conf_res.size() == 2u) { +#if defined(__APPLE__) && TARGET_OS_MAC + videoMixer_->setParameters(conf_res[0], conf_res[1], AV_PIX_FMT_NV12); +#else + videoMixer_->setParameters(conf_res[0], conf_res[1]); +#endif + } else { + JAMI_ERR("Conference resolution is invalid"); + } #endif parser_.onVersion([&](uint32_t) {}); // TODO @@ -430,7 +443,7 @@ Conference::isMediaSourceMuted(MediaType type) const } for (const auto& source : hostSources_) { - if (source.muted_) + if (source.muted_ && source.type_ == type) return true; if (source.type_ == MediaType::MEDIA_NONE) { JAMI_WARN("The host source for %s is not set. The mute state is meaningless", @@ -541,7 +554,7 @@ Conference::requestMediaChange(const std::vector<DRing::MediaMap>& mediaList) for (auto const& mediaAttr : mediaAttrList) { // Find media auto oldIdx = std::find_if(hostSources_.begin(), hostSources_.end(), [&](auto oldAttr) { - return oldAttr.sourceUri_ == mediaAttr.sourceUri_; + return oldAttr.sourceUri_ == mediaAttr.sourceUri_ && oldAttr.type_ == mediaAttr.type_; }); // If video, add to newVideoInputs // NOTE: For now, only supports video diff --git a/src/media/video/video_rtp_session.cpp b/src/media/video/video_rtp_session.cpp index a21b4e77926626867fb22c43517342103a93833a..65672a14b50ee211d1546d27f386b2d15f7cfc17 100644 --- a/src/media/video/video_rtp_session.cpp +++ b/src/media/video/video_rtp_session.cpp @@ -505,23 +505,9 @@ VideoRtpSession::enterConference(Conference& conference) exitConference(); conference_ = &conference; + videoMixer_ = conference.getVideoMixer(); JAMI_DBG("[%p] enterConference (conf: %s)", this, conference.getConfId().c_str()); - // TODO is this correct? The video Mixer should be enabled for a detached conference even if we - // are not sending values - videoMixer_ = conference.getVideoMixer(); - auto conf_res = split_string_to_unsigned(jami::Manager::instance() - .videoPreferences.getConferenceResolution(), - 'x'); - if (conf_res.size() != 2 or conf_res[0] <= 0 or conf_res[1] <= 0) { - JAMI_ERR("Conference resolution is invalid"); - return; - } -#if defined(__APPLE__) && TARGET_OS_MAC - videoMixer_->setParameters(conf_res[0], conf_res[1], AV_PIX_FMT_NV12); -#else - videoMixer_->setParameters(conf_res[0], conf_res[1]); -#endif if (send_.enabled or receiveThread_) { // Restart encoder with conference parameter ON in order to unlink HW encoder // from HW decoder. diff --git a/test/unitTest/call/conference.cpp b/test/unitTest/call/conference.cpp index 058058b6cd1ecd70a5b6ac138a5959e46001d6ed..578a655ec6cfdc894286fae29c3583859fef198c 100644 --- a/test/unitTest/call/conference.cpp +++ b/test/unitTest/call/conference.cpp @@ -92,7 +92,7 @@ private: void testDevices(); void testUnauthorizedSetActive(); void testHangup(); - void testIsConferenceParticipant(); + void testAudioConferenceConfInfo(); CPPUNIT_TEST_SUITE(ConferenceTest); CPPUNIT_TEST(testGetConference); @@ -108,7 +108,7 @@ private: CPPUNIT_TEST(testDevices); CPPUNIT_TEST(testUnauthorizedSetActive); CPPUNIT_TEST(testHangup); - CPPUNIT_TEST(testIsConferenceParticipant); + CPPUNIT_TEST(testAudioConferenceConfInfo); CPPUNIT_TEST_SUITE_END(); // Common parts @@ -128,7 +128,7 @@ private: std::condition_variable cv; void registerSignalHandlers(); - void startConference(); + void startConference(bool audioOnly = false); void hangupConference(); }; @@ -253,7 +253,7 @@ ConferenceTest::registerSignalHandlers() } void -ConferenceTest::startConference() +ConferenceTest::startConference(bool audioOnly) { auto aliceAccount = Manager::instance().getAccount<JamiAccount>(aliceId); auto bobAccount = Manager::instance().getAccount<JamiAccount>(bobId); @@ -261,14 +261,26 @@ ConferenceTest::startConference() auto bobUri = bobAccount->getUsername(); auto carlaUri = carlaAccount->getUsername(); + std::vector<std::map<std::string, std::string>> mediaList; + if (audioOnly) { + std::map<std::string, std::string> mediaAttribute + = {{DRing::Media::MediaAttributeKey::MEDIA_TYPE, + DRing::Media::MediaAttributeValue::AUDIO}, + {DRing::Media::MediaAttributeKey::ENABLED, TRUE_STR}, + {DRing::Media::MediaAttributeKey::MUTED, FALSE_STR}, + {DRing::Media::MediaAttributeKey::SOURCE, ""}, + {DRing::Media::MediaAttributeKey::LABEL, "audio_0"}}; + mediaList.emplace_back(mediaAttribute); + } + JAMI_INFO("Start call between Alice and Bob"); - auto call1 = DRing::placeCallWithMedia(aliceId, bobUri, {}); + auto call1 = DRing::placeCallWithMedia(aliceId, bobUri, mediaList); CPPUNIT_ASSERT(cv.wait_for(lk, 20s, [&] { return !bobCall.callId.empty(); })); Manager::instance().answerCall(bobId, bobCall.callId); CPPUNIT_ASSERT(cv.wait_for(lk, 20s, [&] { return bobCall.hostState == "CURRENT"; })); JAMI_INFO("Start call between Alice and Carla"); - auto call2 = DRing::placeCallWithMedia(aliceId, carlaUri, {}); + auto call2 = DRing::placeCallWithMedia(aliceId, carlaUri, mediaList); CPPUNIT_ASSERT(cv.wait_for(lk, 20s, [&] { return !carlaCall.callId.empty(); })); Manager::instance().answerCall(carlaId, carlaCall.callId); CPPUNIT_ASSERT(cv.wait_for(lk, 20s, [&] { return carlaCall.hostState == "CURRENT"; })); @@ -749,6 +761,16 @@ ConferenceTest::testIsConferenceParticipant() DRing::unregisterSignalHandlers(); } +void +ConferenceTest::testAudioConferenceConfInfo() +{ + registerSignalHandlers(); + + startConference(true); + + DRing::unregisterSignalHandlers(); +} + } // namespace test } // namespace jami