Use conference functions for mute instead of call object as per the documentation.

This commit is contained in:
Julien Wadel 2025-07-18 15:54:07 +02:00
parent 66a85b2ab4
commit bef0660c85
5 changed files with 36 additions and 3 deletions

View file

@ -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());
}

View file

@ -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<linphone::Conference> & conference, const std::shared_ptr<const linphone::ParticipantDevice> & participantDevice, bool isMuted) {
emit participantDeviceIsMuted(participantDevice, isMuted);
}
void ConferenceListener::onParticipantDeviceIsSpeakingChanged(const std::shared_ptr<linphone::Conference> & conference, const std::shared_ptr<const linphone::ParticipantDevice> & participantDevice, bool isSpeaking) {
//qDebug() << "onParticipantDeviceIsSpeakingChanged: " << participantDevice->getAddress()->asString().c_str() << ". Speaking:" << isSpeaking;
emit participantDeviceIsSpeakingChanged(participantDevice, isSpeaking);

View file

@ -44,11 +44,13 @@ public:
virtual void onParticipantDeviceStateChanged(const std::shared_ptr<linphone::Conference> & conference, const std::shared_ptr<const linphone::ParticipantDevice> & device, linphone::ParticipantDevice::State state) override;
virtual void onParticipantDeviceMediaCapabilityChanged(const std::shared_ptr<linphone::Conference> & conference, const std::shared_ptr<const linphone::ParticipantDevice> & device) override;
virtual void onParticipantDeviceMediaAvailabilityChanged(const std::shared_ptr<linphone::Conference> & conference, const std::shared_ptr<const linphone::ParticipantDevice> & device) override;
virtual void onParticipantDeviceIsMuted(const std::shared_ptr<linphone::Conference> & conference, const std::shared_ptr<const linphone::ParticipantDevice> & participantDevice, bool isMuted) override;
virtual void onParticipantDeviceIsSpeakingChanged(const std::shared_ptr<linphone::Conference> & conference, const std::shared_ptr<const linphone::ParticipantDevice> & participantDevice, bool isSpeaking) override;
virtual void onParticipantDeviceScreenSharingChanged(const std::shared_ptr<linphone::Conference> & conference, const std::shared_ptr<const linphone::ParticipantDevice> & device, bool enabled) override;
virtual void onStateChanged(const std::shared_ptr<linphone::Conference> & conference, linphone::Conference::State newState) override;
virtual void onSubjectChanged(const std::shared_ptr<linphone::Conference> & conference, const std::string & subject) override;
virtual void onAudioDeviceChanged(const std::shared_ptr<linphone::Conference> & conference, const std::shared_ptr<const linphone::AudioDevice> & audioDevice) override;
//---------------------------------------------------------------------------
signals:
@ -61,6 +63,7 @@ signals:
void participantDeviceStateChanged(const std::shared_ptr<linphone::Conference> & conference, const std::shared_ptr<const linphone::ParticipantDevice> & device, linphone::ParticipantDevice::State state);
void participantDeviceMediaCapabilityChanged(const std::shared_ptr<const linphone::ParticipantDevice> & participantDevice);
void participantDeviceMediaAvailabilityChanged(const std::shared_ptr<const linphone::ParticipantDevice> & participantDevice);
void participantDeviceIsMuted(const std::shared_ptr<const linphone::ParticipantDevice> & participantDevice, bool isMuted);
void participantDeviceIsSpeakingChanged(const std::shared_ptr<const linphone::ParticipantDevice> & participantDevice, bool isSpeaking);
void participantDeviceScreenSharingChanged( const std::shared_ptr<const linphone::ParticipantDevice> & device, bool enabled);
void conferenceStateChanged(linphone::Conference::State newState);

View file

@ -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<const linphone::ParticipantDevice> & participantDevice, bool isMuted){
emit participantDeviceIsMuted(participantDevice, isMuted);
}
void ConferenceModel::onParticipantDeviceIsSpeakingChanged(const std::shared_ptr<const linphone::ParticipantDevice> & participantDevice, bool isSpeaking){
emit participantDeviceIsSpeakingChanged(participantDevice, isSpeaking);
}

View file

@ -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<linphone::Conference> getConference()const;
@ -77,6 +80,7 @@ public:
virtual void onParticipantDeviceRemoved(const std::shared_ptr<const linphone::ParticipantDevice> & participantDevice);
virtual void onParticipantDeviceMediaCapabilityChanged(const std::shared_ptr<const linphone::ParticipantDevice> & device);
virtual void onParticipantDeviceMediaAvailabilityChanged(const std::shared_ptr<const linphone::ParticipantDevice> & device);
virtual void onParticipantDeviceIsMuted(const std::shared_ptr<const linphone::ParticipantDevice> & device, bool isMuted);
virtual void onParticipantDeviceIsSpeakingChanged(const std::shared_ptr<const linphone::ParticipantDevice> & device, bool isSpeaking);
virtual void onParticipantDeviceScreenSharingChanged(const std::shared_ptr<const linphone::ParticipantDevice> & device, bool enabled);
virtual void onParticipantDeviceStateChanged(const std::shared_ptr<linphone::Conference> & conference, const std::shared_ptr<const linphone::ParticipantDevice> & device, linphone::ParticipantDevice::State state);
@ -96,6 +100,7 @@ signals:
void participantDeviceRemoved(const std::shared_ptr<const linphone::ParticipantDevice> & participantDevice);
void participantDeviceMediaCapabilityChanged(const std::shared_ptr<const linphone::ParticipantDevice> & participantDevice);
void participantDeviceMediaAvailabilityChanged(const std::shared_ptr<const linphone::ParticipantDevice> & participantDevice);
void participantDeviceIsMuted(const std::shared_ptr<const linphone::ParticipantDevice> & device, bool isMuted);
void participantDeviceIsSpeakingChanged(const std::shared_ptr<const linphone::ParticipantDevice> & device, bool isSpeaking);
void participantDeviceScreenSharingChanged( const std::shared_ptr<const linphone::ParticipantDevice> & device, bool enabled);
void participantDeviceStateChanged(const std::shared_ptr<const linphone::ParticipantDevice> & 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);