From bb5a158ff01a02dbd9838094f57e0a429c248411 Mon Sep 17 00:00:00 2001
From: Allan Sandfeld Jensen <allan.jensen@qt.io>
Date: Thu, 9 Nov 2017 12:55:13 +0100
Subject: [PATCH] Fix widevine with proprietary codecs

Switched from define to buildflag.

Change-Id: I01b3e0aad7f54af1a485733e7d4ec25a31d14015
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
---
 src/core/content_client_qt.cpp                   |  3 ++-
 src/core/renderer/content_renderer_client_qt.cpp | 10 +++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp
index 1016db0d5..a3a460cb4 100644
--- a/src/core/content_client_qt.cpp
+++ b/src/core/content_client_qt.cpp
@@ -236,6 +236,7 @@ void AddPepperWidevine(std::vector<content::PepperPluginInfo>* plugins)
 #elif defined(Q_OS_LINUX)
         pluginPaths << QStringLiteral("/opt/google/chrome/libwidevinecdmadapter.so") // Google Chrome
                     << QStringLiteral("/usr/lib/chromium/libwidevinecdmadapter.so") // Arch
+                    << QStringLiteral("/usr/lib/chromium-browser/libwidevinecdmadapter.so") // Ubuntu/neon
                     << QStringLiteral("/usr/lib64/chromium/libwidevinecdmadapter.so"); // OpenSUSE style
 #endif
     }
@@ -257,7 +258,7 @@ void AddPepperWidevine(std::vector<content::PepperPluginInfo>* plugins)
             std::vector<std::string> codecs;
             codecs.push_back(kCdmSupportedCodecVp8);
             codecs.push_back(kCdmSupportedCodecVp9);
-#if defined(USE_PROPRIETARY_CODECS)
+#if BUILDFLAG(USE_PROPRIETARY_CODECS)
             codecs.push_back(kCdmSupportedCodecAvc1);
 #endif  // defined(USE_PROPRIETARY_CODECS)
             std::string codec_string =
diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp
index 83c4d719e..5980d7b84 100644
--- a/src/core/renderer/content_renderer_client_qt.cpp
+++ b/src/core/renderer/content_renderer_client_qt.cpp
@@ -262,11 +262,11 @@ public:
             return true;
 
         case media::EmeInitDataType::CENC:
-#if defined(USE_PROPRIETARY_CODECS)
+#if BUILDFLAG(USE_PROPRIETARY_CODECS)
             return true;
 #else
             return false;
-#endif  // defined(USE_PROPRIETARY_CODECS)
+#endif  // BUILDFLAG(USE_PROPRIETARY_CODECS)
 
         case media::EmeInitDataType::UNKNOWN:
             return false;
@@ -277,7 +277,7 @@ public:
 
     media::SupportedCodecs GetSupportedCodecs() const override
     {
-#if defined(USE_PROPRIETARY_CODECS)
+#if BUILDFLAG(USE_PROPRIETARY_CODECS)
         return media::EME_CODEC_MP4_ALL | media::EME_CODEC_WEBM_ALL;
 #else
         return media::EME_CODEC_WEBM_ALL;
@@ -390,10 +390,10 @@ static void AddPepperBasedWidevine(std::vector<std::unique_ptr<media::KeySystemP
     supported_codecs |= media::EME_CODEC_WEBM_VORBIS;
     supported_codecs |= media::EME_CODEC_WEBM_VP8;
     supported_codecs |= media::EME_CODEC_WEBM_VP9;
-#if defined(USE_PROPRIETARY_CODECS)
+#if BUILDFLAG(USE_PROPRIETARY_CODECS)
     supported_codecs |= media::EME_CODEC_MP4_AVC1;
     supported_codecs |= media::EME_CODEC_MP4_AAC;
-#endif  // defined(USE_PROPRIETARY_CODECS)
+#endif  // BUILDFLAG(USE_PROPRIETARY_CODECS)
 
     using Robustness = cdm::WidevineKeySystemProperties::Robustness;
     concrete_key_systems->emplace_back(new cdm::WidevineKeySystemProperties(
-- 
GitLab