conference: improve audio-only handling

1. When a audio-only participant leaves, the video mixer is updated
and all audio-only streams are now removed.
2. If a audio-only calls try to join a swarm-call, it was hanging
due to a bad number of medias. So ignore video for audio-only calls.

GitLab: #917
Change-Id: Ifdd66e2ab138c078ef9e9c1402a07a6ae6a36b00
This commit is contained in:
Sébastien Blin
2023-11-17 10:57:50 -05:00
committed by Adrien Béraud
parent cc98f1d0e8
commit 1f4cd3d548
3 changed files with 44 additions and 6 deletions

View File

@ -925,13 +925,17 @@ Conference::removeParticipant(const std::string& participant_id)
participantsMuted_.erase(call->getCallId());
if (auto* transport = call->getTransport())
handsRaised_.erase(std::string(transport->deviceId()));
if (videoMixer_) {
for (auto const& rtpSession : call->getRtpSessionList()) {
if (rtpSession->getMediaType() == MediaType::MEDIA_AUDIO)
videoMixer_->removeAudioOnlySource(participant_id, rtpSession->streamId());
if (videoMixer_->verifyActive(rtpSession->streamId()))
videoMixer_->resetActiveStream();
}
}
#ifdef ENABLE_VIDEO
auto sinkId = getConfId() + peerId;
// Remove if active
// TODO all streams
if (videoMixer_->verifyActive(
sip_utils::streamId(participant_id, sip_utils::DEFAULT_VIDEO_STREAMID)))
videoMixer_->resetActiveStream();
call->exitConference();
if (call->isPeerRecording())
call->peerRecording(false);

View File

@ -34,6 +34,7 @@
#include "sync_channel_handler.h"
#include "transfer_channel_handler.h"
#include "swarm/swarm_channel_handler.h"
#include "jami/media_const.h"
#include "sip/sdp.h"
#include "sip/sipvoiplink.h"
@ -542,7 +543,13 @@ JamiAccount::handleIncomingConversationCall(const std::string& callId,
JAMI_ERROR("Conference {} not found", confId);
return;
}
currentMediaList = conf->currentMediaList();
for (const auto& m: conf->currentMediaList()) {
if (m.at(libjami::Media::MediaAttributeKey::MEDIA_TYPE) == libjami::Media::MediaAttributeValue::VIDEO
&& !call->hasVideo()) {
continue;
}
currentMediaList.emplace_back(m);
}
}
Manager::instance().answerCall(*call, currentMediaList);

View File

@ -107,6 +107,7 @@ private:
void testPropagateRecording();
void testBrokenParticipantAudioAndVideo();
void testBrokenParticipantAudioOnly();
void testAudioOnlyLeaveLayout();
void testRemoveConferenceInOneOne();
CPPUNIT_TEST_SUITE(ConferenceTest);
@ -131,6 +132,7 @@ private:
CPPUNIT_TEST(testPropagateRecording);
CPPUNIT_TEST(testBrokenParticipantAudioAndVideo);
CPPUNIT_TEST(testBrokenParticipantAudioOnly);
CPPUNIT_TEST(testAudioOnlyLeaveLayout);
CPPUNIT_TEST(testRemoveConferenceInOneOne);
CPPUNIT_TEST_SUITE_END();
@ -1079,6 +1081,31 @@ ConferenceTest::testBrokenParticipantAudioOnly()
libjami::unregisterSignalHandlers();
}
void
ConferenceTest::testAudioOnlyLeaveLayout()
{
registerSignalHandlers();
// Start conference with four participants
startConference(true, true);
auto expectedNumberOfParticipants = 4u;
// Check participants number
CPPUNIT_ASSERT(
cv.wait_for(lk, 30s, [&] { return pInfos_.size() == expectedNumberOfParticipants; }));
// Carla Leave
Manager::instance().hangupCall(carlaId, carlaCall.callId);
// Check participants number
// It should have one less participant than in the conference start
CPPUNIT_ASSERT(
cv.wait_for(lk, 30s, [&] { return expectedNumberOfParticipants - 1 == pInfos_.size(); }));
hangupConference();
libjami::unregisterSignalHandlers();
}
void
ConferenceTest::testRemoveConferenceInOneOne()
{