Commit 4210e60f authored by Adrien Béraud's avatar Adrien Béraud

sip: fix ICE negotiation when video is disabled

Change-Id: I17e6df2dfd38731df306e565c94b08ba7758e287
Tuleap: #261
parent 6a7a44d1
......@@ -685,15 +685,22 @@ std::vector<std::string>
Sdp::getIceCandidates(unsigned media_index) const
{
auto session = activeRemoteSession_ ? activeRemoteSession_ : remoteSession_;
auto localSession = activeLocalSession_ ? activeLocalSession_ : localSession_;
if (not session) {
RING_ERR("getIceCandidates failed: no remote session");
return {};
}
if (media_index >= session->media_count) {
if (media_index >= session->media_count || media_index >= localSession->media_count) {
RING_ERR("getIceCandidates failed: cannot access media#%u (may be deactivated)", media_index);
return {};
}
auto media = session->media[media_index];
auto localMedia = localSession->media[media_index];
if (media->desc.port == 0 || localMedia->desc.port == 0) {
RING_ERR("getIceCandidates failed: media#%u is disabled", media_index);
return {};
}
std::vector<std::string> candidates;
for (unsigned i=0; i < media->attr_count; i++) {
......
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