From 4c43f650437eeaf2360509221cc401b0ac4290c9 Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
Date: Thu, 2 Aug 2012 15:39:24 -0400
Subject: [PATCH] * #12426: sdp/video: don't bother parsing empty SDP
 descriptions

---
 daemon/src/sip/sdp.cpp                 | 2 +-
 daemon/src/video/video_rtp_session.cpp | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/daemon/src/sip/sdp.cpp b/daemon/src/sip/sdp.cpp
index cd9e477a69..c2607c2d41 100644
--- a/daemon/src/sip/sdp.cpp
+++ b/daemon/src/sip/sdp.cpp
@@ -473,7 +473,7 @@ string Sdp::getIncomingVideoDescription() const
 
     if (videoIdx == activeLocalSession_->media_count) {
         DEBUG("No video present in local session");
-        return ss.str();
+        return "";
     }
 
     // get direction string
diff --git a/daemon/src/video/video_rtp_session.cpp b/daemon/src/video/video_rtp_session.cpp
index 2976598dca..8c89092aba 100644
--- a/daemon/src/video/video_rtp_session.cpp
+++ b/daemon/src/video/video_rtp_session.cpp
@@ -53,13 +53,17 @@ void VideoRtpSession::updateSDP(const Sdp &sdp)
 {
     string desc(sdp.getIncomingVideoDescription());
     // if port has changed
-    if (desc != rxArgs_["receiving_sdp"]) {
+    if (not desc.empty() and desc != rxArgs_["receiving_sdp"]) {
         rxArgs_["receiving_sdp"] = desc;
         DEBUG("Updated incoming SDP to:\n %s",
               rxArgs_["receiving_sdp"].c_str());
     }
 
-    if (desc.find("sendrecv") != string::npos) {
+    if (desc.empty()) {
+        DEBUG("Video is inactive");
+        receiving_ = false;
+        sending_ = false;
+    } else if (desc.find("sendrecv") != string::npos) {
         DEBUG("Sending and receiving video");
         receiving_ = true;
         sending_ = true;
-- 
GitLab