Skip to content

Commit

Permalink
Avoid depending on ffmpeg by default (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
taste1981 authored and jianjunz committed Dec 13, 2022
1 parent 036a1fd commit 6fa1fec
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
24 changes: 16 additions & 8 deletions modules/video_coding/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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" ]
}
Expand Down
7 changes: 7 additions & 0 deletions modules/video_coding/codecs/h264/h264.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -152,11 +154,16 @@ std::unique_ptr<H264Decoder> 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<H264DecoderImpl>();
#else
RTC_DCHECK_NOTREACHED();
return nullptr;
#endif
#else
RTC_NOTREACHED();
return nullptr;
#endif
}

bool H264Decoder::IsSupported() {
Expand Down

0 comments on commit 6fa1fec

Please sign in to comment.