Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 6fa1fec

Browse files
taste1981jianjunz
authored andcommitted
Avoid depending on ffmpeg by default (#131)
1 parent 036a1fd commit 6fa1fec

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

modules/video_coding/BUILD.gn

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -504,16 +504,22 @@ rtc_library("webrtc_h264") {
504504
visibility = [ "*" ]
505505
sources = [
506506
"codecs/h264/h264.cc",
507-
"codecs/h264/h264_color_space.cc",
508-
"codecs/h264/h264_color_space.h",
509-
"codecs/h264/h264_decoder_impl.cc",
510-
"codecs/h264/h264_decoder_impl.h",
511507
"codecs/h264/h264_encoder_impl.cc",
512508
"codecs/h264/h264_encoder_impl.h",
513509
"codecs/h264/include/h264.h",
514510
]
515511

516512
defines = []
513+
if (ffmpeg_branding == "Chrome" || ffmpeg_branding == "Chromium") {
514+
sources += [
515+
"codecs/h264/h264_color_space.cc",
516+
"codecs/h264/h264_color_space.h",
517+
"codecs/h264/h264_decoder_impl.cc",
518+
"codecs/h264/h264_decoder_impl.h",
519+
]
520+
defines += [ "OWT_USE_FFMPEG" ]
521+
}
522+
517523
deps = [
518524
":video_codec_interface",
519525
":video_coding_utility",
@@ -543,10 +549,12 @@ rtc_library("webrtc_h264") {
543549
]
544550

545551
if (rtc_use_h264) {
546-
deps += [
547-
"//third_party/ffmpeg",
548-
"//third_party/openh264:encoder",
549-
]
552+
deps += [ "//third_party/openh264:encoder" ]
553+
554+
if (ffmpeg_branding == "Chrome" || ffmpeg_branding == "Chromium") {
555+
deps += [ "//third_party/ffmpeg" ]
556+
}
557+
550558
if (!build_with_mozilla) {
551559
deps += [ "../../media:rtc_media_base" ]
552560
}

modules/video_coding/codecs/h264/h264.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
#include "rtc_base/trace_event.h"
2222

2323
#if defined(WEBRTC_USE_H264)
24+
#if defined (OWT_USE_FFMPEG)
2425
#include "modules/video_coding/codecs/h264/h264_decoder_impl.h"
26+
#endif
2527
#include "modules/video_coding/codecs/h264/h264_encoder_impl.h"
2628
#endif
2729

@@ -152,11 +154,16 @@ std::unique_ptr<H264Decoder> H264Decoder::Create() {
152154
#if defined(WEBRTC_USE_H264)
153155
RTC_CHECK(g_rtc_use_h264);
154156
RTC_LOG(LS_INFO) << "Creating H264DecoderImpl.";
157+
#if defined(OWT_USE_FFMPEG)
155158
return std::make_unique<H264DecoderImpl>();
156159
#else
157160
RTC_DCHECK_NOTREACHED();
158161
return nullptr;
159162
#endif
163+
#else
164+
RTC_NOTREACHED();
165+
return nullptr;
166+
#endif
160167
}
161168

162169
bool H264Decoder::IsSupported() {

0 commit comments

Comments
 (0)