diff --git a/BUILD.gn b/BUILD.gn index 1cb920e9ec..a62bb028d1 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -406,13 +406,19 @@ if (!build_with_chromium) { "video", ] - # Include audio and video codecs by default. - deps += [ - "api/audio_codecs:builtin_audio_decoder_factory", - "api/audio_codecs:builtin_audio_encoder_factory", - "api/video_codecs:builtin_video_decoder_factory", - "api/video_codecs:builtin_video_encoder_factory", - ] + if (rtc_include_builtin_audio_codecs) { + deps += [ + "api/audio_codecs:builtin_audio_decoder_factory", + "api/audio_codecs:builtin_audio_encoder_factory", + ] + } + + if (rtc_include_builtin_video_codecs) { + deps += [ + "api/video_codecs:builtin_video_decoder_factory", + "api/video_codecs:builtin_video_encoder_factory", + ] + } if (build_with_mozilla) { deps += [ "api/video:video_frame" ] diff --git a/webrtc.gni b/webrtc.gni index 2239d61eba..d716d7d2d1 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -180,6 +180,18 @@ declare_args() { # Determines whether Metal is available on iOS/macOS. rtc_use_metal_rendering = is_mac || (is_ios && current_cpu == "arm64") + + # When set to false, builtin audio encoder/decoder factories and all the + # audio codecs they depend on will not be included in libwebrtc.{a|lib} + # (they will still be included in libjingle_peerconnection_so.so and + # WebRTC.framework) + rtc_include_builtin_audio_codecs = true + + # When set to false, builtin video encoder/decoder factories and all the + # video codecs they depends on will not be included in libwebrtc.{a|lib} + # (they will still be included in libjingle_peerconnection_so.so and + # WebRTC.framework) + rtc_include_builtin_video_codecs = true } if (!build_with_mozilla) {