From dad5e42cf81563735f18715b3e6c897a9c79d414 Mon Sep 17 00:00:00 2001 From: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com> Date: Thu, 9 Mar 2023 11:49:34 -0300 Subject: [PATCH] swarmcalls: avoid grayscale video in macos Change-Id: I5283d3a0459e031baa7eb0b1d481333aa683c79b --- .gitignore | 1 + contrib/.gitignore | 1 + src/media/video/video_mixer.cpp | 14 ++++++++++++++ 3 files changed, 16 insertions(+) diff --git a/.gitignore b/.gitignore index 75c13a86ec..08d7b17975 100644 --- a/.gitignore +++ b/.gitignore @@ -104,6 +104,7 @@ tools/.vscode/ # Mac .DS_Store +build-macos* # Android /build-android-*/ diff --git a/contrib/.gitignore b/contrib/.gitignore index ed60462eac..bcbe182949 100644 --- a/contrib/.gitignore +++ b/contrib/.gitignore @@ -5,3 +5,4 @@ x86_64-* arm* aarch64* i686* +apple* diff --git a/src/media/video/video_mixer.cpp b/src/media/video/video_mixer.cpp index 26629ecc33..33025aa39f 100644 --- a/src/media/video/video_mixer.cpp +++ b/src/media/video/video_mixer.cpp @@ -469,6 +469,15 @@ VideoMixer::calc_position(std::unique_ptr<VideoMixerSource>& source, } else { cell_width = width_ / zoom; cell_height = height_ / zoom; + + if (n == 1) { + // On some platforms (at least macOS/android) - Having one frame at the same + // size of the mixer cause it to be grey. + // Removing some pixels solve this. We use 16 because it's a multiple of 8 + // (value that we prefer for video management) + cell_width -= 16; + cell_height -= 16; + } } if (currentLayout_ == Layout::ONE_BIG_WITH_SMALL) { if (index == 0) { @@ -487,6 +496,11 @@ VideoMixer::calc_position(std::unique_ptr<VideoMixerSource>& source, cellW_off += (width_ - (n % zoom) * cell_width) / 2; } cellH_off = (index / zoom) * cell_height; + if (n == 1) { + // Centerize (cellwidth = width_ - 16) + cellW_off += 8; + cellH_off += 8; + } } // Compute frame size/position -- GitLab