diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn index a5defb2b118..f59ca1693ff 100644 --- a/modules/video_coding/BUILD.gn +++ b/modules/video_coding/BUILD.gn @@ -504,16 +504,22 @@ rtc_library("webrtc_h264") { visibility = [ "*" ] sources = [ "codecs/h264/h264.cc", - "codecs/h264/h264_color_space.cc", - "codecs/h264/h264_color_space.h", - "codecs/h264/h264_decoder_impl.cc", - "codecs/h264/h264_decoder_impl.h", "codecs/h264/h264_encoder_impl.cc", "codecs/h264/h264_encoder_impl.h", "codecs/h264/include/h264.h", ] defines = [] + if (ffmpeg_branding == "Chrome" || ffmpeg_branding == "Chromium") { + sources += [ + "codecs/h264/h264_color_space.cc", + "codecs/h264/h264_color_space.h", + "codecs/h264/h264_decoder_impl.cc", + "codecs/h264/h264_decoder_impl.h", + ] + defines += [ "OWT_USE_FFMPEG" ] + } + deps = [ ":video_codec_interface", ":video_coding_utility", @@ -543,10 +549,12 @@ rtc_library("webrtc_h264") { ] if (rtc_use_h264) { - deps += [ - "//third_party/ffmpeg", - "//third_party/openh264:encoder", - ] + deps += [ "//third_party/openh264:encoder" ] + + if (ffmpeg_branding == "Chrome" || ffmpeg_branding == "Chromium") { + deps += [ "//third_party/ffmpeg" ] + } + if (!build_with_mozilla) { deps += [ "../../media:rtc_media_base" ] } diff --git a/modules/video_coding/codecs/h264/h264.cc b/modules/video_coding/codecs/h264/h264.cc index 23580d7a4a7..ad2d2774676 100644 --- a/modules/video_coding/codecs/h264/h264.cc +++ b/modules/video_coding/codecs/h264/h264.cc @@ -21,7 +21,9 @@ #include "rtc_base/trace_event.h" #if defined(WEBRTC_USE_H264) +#if defined (OWT_USE_FFMPEG) #include "modules/video_coding/codecs/h264/h264_decoder_impl.h" +#endif #include "modules/video_coding/codecs/h264/h264_encoder_impl.h" #endif @@ -152,11 +154,16 @@ std::unique_ptr H264Decoder::Create() { #if defined(WEBRTC_USE_H264) RTC_CHECK(g_rtc_use_h264); RTC_LOG(LS_INFO) << "Creating H264DecoderImpl."; +#if defined(OWT_USE_FFMPEG) return std::make_unique(); #else RTC_DCHECK_NOTREACHED(); return nullptr; #endif +#else + RTC_NOTREACHED(); + return nullptr; +#endif } bool H264Decoder::IsSupported() {