Commit 7787ae57 authored by Guillaume Roguez's avatar Guillaume Roguez Committed by gerrit2

sip: fix audio/video muting

Refs #75157

Change-Id: I1abcdd2bb407b579c5db5c31cf15bc1d1d403c4c
parent 11d8d0bd
......@@ -173,7 +173,9 @@ DBusClient::initLibrary(int flags)
exportable_callback<CallSignal::ZrtpNotSuppOther>(bind(&DBusCallManager::zrtpNotSuppOther, callM, _1)),
exportable_callback<CallSignal::ZrtpNegotiationFailed>(bind(&DBusCallManager::zrtpNegotiationFailed, callM, _1, _2, _3)),
exportable_callback<CallSignal::RtcpReportReceived>(bind(&DBusCallManager::onRtcpReportReceived, callM, _1, _2)),
exportable_callback<CallSignal::PeerHold>(bind(&DBusCallManager::peerHold, callM, _1, _2))
exportable_callback<CallSignal::PeerHold>(bind(&DBusCallManager::peerHold, callM, _1, _2)),
exportable_callback<CallSignal::AudioMuted>(bind(&DBusCallManager::audioMuted, callM, _1, _2)),
exportable_callback<CallSignal::VideoMuted>(bind(&DBusCallManager::videoMuted, callM, _1, _2))
};
// Configuration event handlers
......
......@@ -29,11 +29,11 @@
* as that of the covered work.
*/
#ifndef __RTP_SESSION_H__
#define __RTP_SESSION_H__
#pragma once
#include "socket_pair.h"
#include "sip/sip_utils.h"
#include "media/media_codec.h"
#include <string>
#include <memory>
......@@ -57,6 +57,9 @@ public:
receive_ = receive;
}
bool isSending() { return send_.enabled; }
bool isReceiving() { return receive_.enabled; }
protected:
std::recursive_mutex mutex_;
std::unique_ptr<SocketPair> socketPair_;
......@@ -71,5 +74,3 @@ protected:
};
} // namespace ring
#endif // __RTP_SESSION_H__
......@@ -847,7 +847,20 @@ SIPCall::startAllMedia()
ice_comp_id += 2;
} else
rtp->start();
switch (local.type) {
#ifdef RING_VIDEO
case MEDIA_VIDEO:
isVideoMuted_ = videoInput_.empty();
break;
#endif
case MEDIA_AUDIO:
isAudioMuted_ = not rtp->isSending();
break;
default: break;
}
}
if (peerHolding_ != peer_holding) {
peerHolding_ = peer_holding;
emitSignal<DRing::CallSignal::PeerHold>(getCallId(), peerHolding_);
......@@ -865,19 +878,21 @@ SIPCall::stopAllMedia()
}
void
SIPCall::muteMedia(const std::string& mediaType, bool isMuted)
SIPCall::muteMedia(const std::string& mediaType, bool mute)
{
if (mediaType.compare(DRing::Media::Details::MEDIA_TYPE_VIDEO) == 0) {
#ifdef RING_VIDEO
RING_WARN("video muting %s", bool_to_str(isMuted));
isVideoMuted_ = isMuted;
if (mute == isVideoMuted_) return;
RING_WARN("video muting %s", bool_to_str(mute));
isVideoMuted_ = mute;
videoInput_ = isVideoMuted_ ? "" : videoManager.videoDeviceMonitor.getMRLForDefaultDevice();
DRing::switchInput(getCallId(), videoInput_);
emitSignal<DRing::CallSignal::VideoMuted>(getCallId(), isVideoMuted_);
#endif
} else if (mediaType.compare(DRing::Media::Details::MEDIA_TYPE_AUDIO) == 0) {
RING_WARN("audio muting %s", bool_to_str(isMuted));
isAudioMuted_ = isMuted;
if (mute == isAudioMuted_) return;
RING_WARN("audio muting %s", bool_to_str(mute));
isAudioMuted_ = mute;
avformatrtp_->setMuted(isAudioMuted_);
emitSignal<DRing::CallSignal::AudioMuted>(getCallId(), isAudioMuted_);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment