From c4b580a2deeb1f780e9b1be0a97cb3fa3ad389ba Mon Sep 17 00:00:00 2001
From: philippegorley <philippe.gorley@savoirfairelinux.com>
Date: Wed, 21 Feb 2018 17:10:42 -0500
Subject: [PATCH] video: don't blacken frame if not needed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The function yuv422_clear_to_black is called up to 3 times per frame.
Remove the superfluous calls. This function only does useful in a
conference, when there can be blank space in a frame.

Change-Id: I64588adba59daaf3677bad419a519432eec41dff
Reviewed-by: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
---
 src/media/media_encoder.cpp     | 5 -----
 src/media/video/video_mixer.cpp | 2 --
 2 files changed, 7 deletions(-)

diff --git a/src/media/media_encoder.cpp b/src/media/media_encoder.cpp
index ccbae447ef..506f5dc8ae 100644
--- a/src/media/media_encoder.cpp
+++ b/src/media/media_encoder.cpp
@@ -273,11 +273,6 @@ int
 MediaEncoder::encode(VideoFrame& input, bool is_keyframe,
                      int64_t frame_number)
 {
-    /* Prepare a frame suitable to our encoder frame format,
-     * keeping also the input aspect ratio.
-     */
-    yuv422_clear_to_black(scaledFrame_); // to fill blank space left by the "keep aspect"
-
     scaler_.scale_with_aspect(input, scaledFrame_);
 
     auto frame = scaledFrame_.pointer();
diff --git a/src/media/video/video_mixer.cpp b/src/media/video/video_mixer.cpp
index 654a06f780..85f6cbe790 100644
--- a/src/media/video/video_mixer.cpp
+++ b/src/media/video/video_mixer.cpp
@@ -189,8 +189,6 @@ VideoMixer::setDimensions(int width, int height)
 
     // cleanup the previous frame to have a nice copy in rendering method
     std::shared_ptr<VideoFrame> previous_p(obtainLastFrame());
-    if (previous_p)
-        yuv422_clear_to_black(*previous_p);
 
     start_sink();
 }
-- 
GitLab