From 82edcbbfd095d44f92106f1ee3cb97bf8ab9cf45 Mon Sep 17 00:00:00 2001
From: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
Date: Mon, 19 Oct 2015 22:59:27 -0400
Subject: [PATCH] video: remove blink fx during conference

During a conference, video display blink on a full black image
at each video restart (due to adaptative bitrate algorithm).
This patch fixes this effect due to an unvoluntary mixer's sink
start/stop.

Issue: #82044
Change-Id: I181051de7230189d0a951f65f02b5673f202ffb5
---
 src/media/video/video_rtp_session.cpp | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/media/video/video_rtp_session.cpp b/src/media/video/video_rtp_session.cpp
index c2c7ff20f8..4a1571104a 100644
--- a/src/media/video/video_rtp_session.cpp
+++ b/src/media/video/video_rtp_session.cpp
@@ -115,12 +115,6 @@ VideoRtpSession::restartSender()
     std::lock_guard<std::recursive_mutex> lock(mutex_);
 
     startSender();
-
-    if (sender_) {
-        if (videoLocal_)
-            videoLocal_->attach(sender_.get());
-    }
-
     setupVideoPipeline();
 }
 
@@ -218,12 +212,12 @@ VideoRtpSession::setupVideoPipeline()
     }
 }
 
-void VideoRtpSession::setupConferenceVideoPipeline(Conference& conference)
+void
+VideoRtpSession::setupConferenceVideoPipeline(Conference& conference)
 {
     RING_DBG("[call:%s] Setup video pipeline on conference %s", callID_.c_str(),
              conference.getConfID().c_str());
     videoMixer_ = conference.getVideoMixer();
-    videoMixer_->setDimensions(localVideoParams_.width, localVideoParams_.height);
 
     if (sender_) {
         // Swap sender from local video to conference video mixer
@@ -240,7 +234,8 @@ void VideoRtpSession::setupConferenceVideoPipeline(Conference& conference)
         RING_WARN("[call:%s] no receiver", callID_.c_str());
 }
 
-void VideoRtpSession::enterConference(Conference* conference)
+void
+VideoRtpSession::enterConference(Conference* conference)
 {
     std::lock_guard<std::recursive_mutex> lock(mutex_);
 
@@ -250,8 +245,11 @@ void VideoRtpSession::enterConference(Conference* conference)
     RING_DBG("[call:%s] enterConference (conf: %s)", callID_.c_str(),
              conference->getConfID().c_str());
 
-    if (send_.enabled or receiveThread_)
+    if (send_.enabled or receiveThread_) {
+        videoMixer_ = conference->getVideoMixer();
+        videoMixer_->setDimensions(localVideoParams_.width, localVideoParams_.height);
         setupConferenceVideoPipeline(*conference_);
+    }
 }
 
 void VideoRtpSession::exitConference()
-- 
GitLab