diff --git a/src/3rdparty/chromium/media/video/BUILD.gn b/src/3rdparty/chromium/media/video/BUILD.gn
index ef5c9c6c0..7e439852d 100644
--- a/src/3rdparty/chromium/media/video/BUILD.gn
+++ b/src/3rdparty/chromium/media/video/BUILD.gn
@@ -2,7 +2,17 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.

+import("//build/config/linux/pkg_config.gni")
 import("//media/media_options.gni")
+import("//third_party/webrtc/webrtc.gni")
+
+if (rtc_use_h264 && rtc_use_system_openh264) {
+  pkg_config("openh264") {
+    packages = [
+      "openh264",
+    ]
+  }
+}

 source_set("video") {
   # Do not expand the visibility here without double-checking with OWNERS, this
@@ -114,7 +124,12 @@ source_set("video") {
       "openh264_video_encoder.cc",
       "openh264_video_encoder.h",
     ]
-    deps += [ "//third_party/openh264:encoder" ]
+
+    if (rtc_use_system_openh264) {
+      configs += [":openh264"]
+    } else {
+      deps += [ "//third_party/openh264:encoder" ]
+    }
   }

   if (is_apple) {
