From bef0660c859a9306c1ff9499aa780b49ebd1af14 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Fri, 18 Jul 2025 15:54:07 +0200 Subject: [PATCH] Use conference functions for mute instead of call object as per the documentation. --- linphone-app/src/components/call/CallModel.cpp | 9 ++++++--- .../conference/ConferenceListener.cpp | 3 +++ .../conference/ConferenceListener.hpp | 3 +++ .../components/conference/ConferenceModel.cpp | 18 ++++++++++++++++++ .../components/conference/ConferenceModel.hpp | 6 ++++++ 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/linphone-app/src/components/call/CallModel.cpp b/linphone-app/src/components/call/CallModel.cpp index b39934bbe..d0286a89a 100644 --- a/linphone-app/src/components/call/CallModel.cpp +++ b/linphone-app/src/components/call/CallModel.cpp @@ -774,14 +774,17 @@ void CallModel::setSpeakerMuted (bool status) { // ----------------------------------------------------------------------------- bool CallModel::getMicroMuted () const { - return mCall && mCall->getMicrophoneMuted(); + if (isConference()) + return mConferenceModel && mConferenceModel->getMicroMuted(); + else + return mCall && mCall->getMicrophoneMuted(); } void CallModel::setMicroMuted (bool status) { if (status == getMicroMuted()) return; - if(mCall) - mCall->setMicrophoneMuted(status); + if (isConference()) mConferenceModel->setMicroMuted(status); + else if(mCall) mCall->setMicrophoneMuted(status); emit microMutedChanged(getMicroMuted()); } diff --git a/linphone-app/src/components/conference/ConferenceListener.cpp b/linphone-app/src/components/conference/ConferenceListener.cpp index f3d821759..14356d028 100644 --- a/linphone-app/src/components/conference/ConferenceListener.cpp +++ b/linphone-app/src/components/conference/ConferenceListener.cpp @@ -83,6 +83,9 @@ void ConferenceListener::onParticipantDeviceMediaAvailabilityChanged(const std:: qDebug() << "onParticipantDeviceMediaAvailabilityChanged: " << (int)participantDevice->getStreamAvailability(linphone::StreamType::Video) << ". Device: " << participantDevice->getAddress()->asString().c_str(); emit participantDeviceMediaAvailabilityChanged(participantDevice); } +void ConferenceListener::onParticipantDeviceIsMuted(const std::shared_ptr & conference, const std::shared_ptr & participantDevice, bool isMuted) { + emit participantDeviceIsMuted(participantDevice, isMuted); +} void ConferenceListener::onParticipantDeviceIsSpeakingChanged(const std::shared_ptr & conference, const std::shared_ptr & participantDevice, bool isSpeaking) { //qDebug() << "onParticipantDeviceIsSpeakingChanged: " << participantDevice->getAddress()->asString().c_str() << ". Speaking:" << isSpeaking; emit participantDeviceIsSpeakingChanged(participantDevice, isSpeaking); diff --git a/linphone-app/src/components/conference/ConferenceListener.hpp b/linphone-app/src/components/conference/ConferenceListener.hpp index fe1d15250..d5df43f6f 100644 --- a/linphone-app/src/components/conference/ConferenceListener.hpp +++ b/linphone-app/src/components/conference/ConferenceListener.hpp @@ -44,11 +44,13 @@ public: virtual void onParticipantDeviceStateChanged(const std::shared_ptr & conference, const std::shared_ptr & device, linphone::ParticipantDevice::State state) override; virtual void onParticipantDeviceMediaCapabilityChanged(const std::shared_ptr & conference, const std::shared_ptr & device) override; virtual void onParticipantDeviceMediaAvailabilityChanged(const std::shared_ptr & conference, const std::shared_ptr & device) override; + virtual void onParticipantDeviceIsMuted(const std::shared_ptr & conference, const std::shared_ptr & participantDevice, bool isMuted) override; virtual void onParticipantDeviceIsSpeakingChanged(const std::shared_ptr & conference, const std::shared_ptr & participantDevice, bool isSpeaking) override; virtual void onParticipantDeviceScreenSharingChanged(const std::shared_ptr & conference, const std::shared_ptr & device, bool enabled) override; virtual void onStateChanged(const std::shared_ptr & conference, linphone::Conference::State newState) override; virtual void onSubjectChanged(const std::shared_ptr & conference, const std::string & subject) override; virtual void onAudioDeviceChanged(const std::shared_ptr & conference, const std::shared_ptr & audioDevice) override; + //--------------------------------------------------------------------------- signals: @@ -61,6 +63,7 @@ signals: void participantDeviceStateChanged(const std::shared_ptr & conference, const std::shared_ptr & device, linphone::ParticipantDevice::State state); void participantDeviceMediaCapabilityChanged(const std::shared_ptr & participantDevice); void participantDeviceMediaAvailabilityChanged(const std::shared_ptr & participantDevice); + void participantDeviceIsMuted(const std::shared_ptr & participantDevice, bool isMuted); void participantDeviceIsSpeakingChanged(const std::shared_ptr & participantDevice, bool isSpeaking); void participantDeviceScreenSharingChanged( const std::shared_ptr & device, bool enabled); void conferenceStateChanged(linphone::Conference::State newState); diff --git a/linphone-app/src/components/conference/ConferenceModel.cpp b/linphone-app/src/components/conference/ConferenceModel.cpp index 3a7a89c81..4264db69e 100644 --- a/linphone-app/src/components/conference/ConferenceModel.cpp +++ b/linphone-app/src/components/conference/ConferenceModel.cpp @@ -43,6 +43,7 @@ void ConferenceModel::connectTo(ConferenceListener * listener){ connect(listener, &ConferenceListener::participantDeviceStateChanged, this, &ConferenceModel::onParticipantDeviceStateChanged); connect(listener, &ConferenceListener::participantDeviceMediaCapabilityChanged, this, &ConferenceModel::onParticipantDeviceMediaCapabilityChanged); connect(listener, &ConferenceListener::participantDeviceMediaAvailabilityChanged, this, &ConferenceModel::onParticipantDeviceMediaAvailabilityChanged); + connect(listener, &ConferenceListener::participantDeviceIsMuted, this, &ConferenceModel::onParticipantDeviceIsMuted); connect(listener, &ConferenceListener::participantDeviceIsSpeakingChanged, this, &ConferenceModel::onParticipantDeviceIsSpeakingChanged); connect(listener, &ConferenceListener::participantDeviceScreenSharingChanged, this, &ConferenceModel::onParticipantDeviceScreenSharingChanged); connect(listener, &ConferenceListener::conferenceStateChanged, this, &ConferenceModel::onConferenceStateChanged); @@ -174,6 +175,20 @@ void ConferenceModel::setIsReady(bool state){ emit isReadyChanged(); } } + +// ----------------------------------------------------------------------------- + +bool ConferenceModel::getMicroMuted () const { + return mConference && mConference->getMicrophoneMuted(); +} + +void ConferenceModel::setMicroMuted (bool status) { + if (status == getMicroMuted()) + return; + else if(mConference) mConference->setMicrophoneMuted(status); + emit microMutedChanged(getMicroMuted()); +} + //----------------------------------------------------------------------------------------------------------------------- // LINPHONE LISTENERS //----------------------------------------------------------------------------------------------------------------------- @@ -223,6 +238,9 @@ void ConferenceModel::onParticipantDeviceMediaAvailabilityChanged(const std::sha qDebug() << "ConferenceModel::onParticipantDeviceMediaAvailabilityChanged: " << (int)participantDevice->getStreamAvailability(linphone::StreamType::Video) << ". Me devices : " << mConference->getMe()->getDevices().size(); emit participantDeviceMediaAvailabilityChanged(participantDevice); } +void ConferenceModel::onParticipantDeviceIsMuted(const std::shared_ptr & participantDevice, bool isMuted){ + emit participantDeviceIsMuted(participantDevice, isMuted); +} void ConferenceModel::onParticipantDeviceIsSpeakingChanged(const std::shared_ptr & participantDevice, bool isSpeaking){ emit participantDeviceIsSpeakingChanged(participantDevice, isSpeaking); } diff --git a/linphone-app/src/components/conference/ConferenceModel.hpp b/linphone-app/src/components/conference/ConferenceModel.hpp index a9e6be8df..e9f6a1374 100644 --- a/linphone-app/src/components/conference/ConferenceModel.hpp +++ b/linphone-app/src/components/conference/ConferenceModel.hpp @@ -56,6 +56,9 @@ public: Q_INVOKABLE void toggleScreenSharing(); bool isLocalScreenSharingEnabled() const; bool isScreenSharingEnabled() const; + + bool getMicroMuted () const; + void setMicroMuted (bool status); std::shared_ptr getConference()const; @@ -77,6 +80,7 @@ public: virtual void onParticipantDeviceRemoved(const std::shared_ptr & participantDevice); virtual void onParticipantDeviceMediaCapabilityChanged(const std::shared_ptr & device); virtual void onParticipantDeviceMediaAvailabilityChanged(const std::shared_ptr & device); + virtual void onParticipantDeviceIsMuted(const std::shared_ptr & device, bool isMuted); virtual void onParticipantDeviceIsSpeakingChanged(const std::shared_ptr & device, bool isSpeaking); virtual void onParticipantDeviceScreenSharingChanged(const std::shared_ptr & device, bool enabled); virtual void onParticipantDeviceStateChanged(const std::shared_ptr & conference, const std::shared_ptr & device, linphone::ParticipantDevice::State state); @@ -96,6 +100,7 @@ signals: void participantDeviceRemoved(const std::shared_ptr & participantDevice); void participantDeviceMediaCapabilityChanged(const std::shared_ptr & participantDevice); void participantDeviceMediaAvailabilityChanged(const std::shared_ptr & participantDevice); + void participantDeviceIsMuted(const std::shared_ptr & device, bool isMuted); void participantDeviceIsSpeakingChanged(const std::shared_ptr & device, bool isSpeaking); void participantDeviceScreenSharingChanged( const std::shared_ptr & device, bool enabled); void participantDeviceStateChanged(const std::shared_ptr & device, linphone::ParticipantDevice::State state); @@ -105,6 +110,7 @@ signals: void participantDeviceCountChanged(); void localScreenSharingChanged(bool enabled); void isScreenSharingEnabledChanged(); + void microMutedChanged (bool status); private: void connectTo(ConferenceListener * listener);