Commit 3ce6034d authored by Guillaume Roguez's avatar Guillaume Roguez Committed by gerrit2

sip/media: fix crash when video codec change on non-video call

Prevents usage of SIPCall::useVideoCodec on a non-sending video RTP session.
This patch also changes the error SDP message about empty media slots
by using a warn type msg.

Issue: #78344
Change-Id: I5675ea80a14d468a909844bc3bd62908214ba48f
parent 2377c0f8
......@@ -58,8 +58,8 @@ public:
receive_ = receive;
}
bool isSending() { return send_.enabled; }
bool isReceiving() { return receive_.enabled; }
bool isSending() const noexcept { return send_.enabled; }
bool isReceiving() const noexcept { return receive_.enabled; }
protected:
std::recursive_mutex mutex_;
......
......@@ -803,7 +803,9 @@ SIPCall::startIce()
bool
SIPCall::useVideoCodec(const AccountVideoCodecInfo* codec) const
{
return videortp_.useCodec(codec);
if (videortp_.isSending())
return videortp_.useCodec(codec);
return false;
}
void
......@@ -839,11 +841,11 @@ SIPCall::startAllMedia()
continue;
if (!local.codec) {
RING_ERR("No codec defined in local media slot");
RING_WARN("SDP: No codec defined in local media slot");
continue;
}
if (!remote.codec) {
RING_ERR("No codec defined in remote media slot");
RING_WARN("SDP: No codec defined in remote media slot");
continue;
}
......
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