From e04ec346a81828c7d374e1ee29f5e2de37908ca3 Mon Sep 17 00:00:00 2001
From: Mohamed Chibani <mohamed.chibani@savoirfairelinux.com>
Date: Thu, 18 Mar 2021 18:45:41 -0400
Subject: [PATCH] AudioInput: apply mute/un-mute state when creating a new
 instance

In AudioRtpSession, when a new AudioInput instance is created, its mute state
is always set to default (un-muted) even if the AudioRtpSession is in mute
state.
Fixed by applying the mute state when a new AudioInput instance is created.

Gitlab: #482

Change-Id: I3f7e92cfcfd63bc5c6318f317e7fa96fe5f17a7c
---
 src/media/audio/audio_rtp_session.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/media/audio/audio_rtp_session.cpp b/src/media/audio/audio_rtp_session.cpp
index 544f5677e4..b86d1706e1 100644
--- a/src/media/audio/audio_rtp_session.cpp
+++ b/src/media/audio/audio_rtp_session.cpp
@@ -83,6 +83,7 @@ AudioRtpSession::startSender()
 
     // sender sets up input correctly, we just keep a reference in case startSender is called
     audioInput_ = jami::getAudioInput(callID_);
+    audioInput_->setMuted(muteState_);
     audioInput_->setSuccessfulSetupCb(onSuccessfulSetup_);
     auto newParams = audioInput_->switchInput(input_);
     try {
@@ -105,8 +106,8 @@ AudioRtpSession::startSender()
     try {
         sender_.reset();
         socketPair_->stopSendOp(false);
-        sender_.reset(new AudioSender(
-            callID_, getRemoteRtpUri(), send_, *socketPair_, initSeqVal_, mtu_));
+        sender_.reset(
+            new AudioSender(callID_, getRemoteRtpUri(), send_, *socketPair_, initSeqVal_, mtu_));
     } catch (const MediaEncoderException& e) {
         JAMI_ERR("%s", e.what());
         send_.enabled = false;
-- 
GitLab