Don't call deprecated FFmpeg API.
This removes call of av_register_all(), which is deprecated, and
related code.
Bug: webrtc:9352
Change-Id: Ib7de5931c900eaf1023ecf3046f560feaaeec8ef
Reviewed-on: https://webrtc-review.googlesource.com/85347
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23743}
diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn
index 0ed9da2..bff40c9 100644
--- a/modules/video_coding/BUILD.gn
+++ b/modules/video_coding/BUILD.gn
@@ -301,9 +301,6 @@
if (rtc_use_h264) {
defines += [ "WEBRTC_USE_H264" ]
- if (rtc_initialize_ffmpeg) {
- defines += [ "WEBRTC_INITIALIZE_FFMPEG" ]
- }
sources += [
"codecs/h264/h264_decoder_impl.cc",
"codecs/h264/h264_decoder_impl.h",
@@ -316,11 +313,6 @@
"//third_party/openh264:encoder",
]
- # TODO(bugs.webrtc.org/9352): Stop using ffmpeg deprecated functions.
- if (!is_win) {
- cflags = [ "-Wno-deprecated-declarations" ]
- }
-
if (!build_with_mozilla) {
deps += [ "../../media:rtc_media_base" ]
}
diff --git a/modules/video_coding/codecs/h264/h264_decoder_impl.cc b/modules/video_coding/codecs/h264/h264_decoder_impl.cc
index a2be91c..e91def4 100644
--- a/modules/video_coding/codecs/h264/h264_decoder_impl.cc
+++ b/modules/video_coding/codecs/h264/h264_decoder_impl.cc
@@ -45,21 +45,6 @@
kH264DecoderEventMax = 16,
};
-#if defined(WEBRTC_INITIALIZE_FFMPEG)
-
-rtc::CriticalSection ffmpeg_init_lock;
-bool ffmpeg_initialized = false;
-
-void InitializeFFmpeg() {
- rtc::CritScope cs(&ffmpeg_init_lock);
- if (!ffmpeg_initialized) {
- av_register_all();
- ffmpeg_initialized = true;
- }
-}
-
-#endif // defined(WEBRTC_INITIALIZE_FFMPEG)
-
} // namespace
int H264DecoderImpl::AVGetBuffer2(
@@ -171,18 +156,6 @@
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
}
- // FFmpeg must have been initialized (with |av_register_all|) before we
- // proceed. |InitializeFFmpeg| does this, which makes sense for WebRTC
- // standalone. In other cases, such as Chromium, FFmpeg is initialized
- // externally and calling |InitializeFFmpeg| would be thread-unsafe and result
- // in FFmpeg being initialized twice, which could break other FFmpeg usage.
- // See the |rtc_initialize_ffmpeg| flag.
-#if defined(WEBRTC_INITIALIZE_FFMPEG)
- // Make sure FFmpeg has been initialized. Subsequent |InitializeFFmpeg| calls
- // do nothing.
- InitializeFFmpeg();
-#endif
-
// Release necessary in case of re-initializing.
int32_t ret = Release();
if (ret != WEBRTC_VIDEO_CODEC_OK) {
diff --git a/webrtc.gni b/webrtc.gni
index bdbc2dd..3b49508 100644
--- a/webrtc.gni
+++ b/webrtc.gni
@@ -122,8 +122,7 @@
# all platforms except Android and iOS. Because FFmpeg can be built
# with/without H.264 support, |ffmpeg_branding| has to separately be set to a
# value that includes H.264, for example "Chrome". If FFmpeg is built without
- # H.264, compilation succeeds but |H264DecoderImpl| fails to initialize. See
- # also: |rtc_initialize_ffmpeg|.
+ # H.264, compilation succeeds but |H264DecoderImpl| fails to initialize.
# CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
# http://www.openh264.org, https://www.ffmpeg.org/
rtc_use_h264 = proprietary_codecs && !is_android && !is_ios
@@ -142,13 +141,6 @@
# as data dependencies. This is to enable memcheck execution on swarming bots.
rtc_use_memcheck = false
- # FFmpeg must be initialized for |H264DecoderImpl| to work. This can be done
- # by WebRTC during |H264DecoderImpl::InitDecode| or externally. FFmpeg must
- # only be initialized once. Projects that initialize FFmpeg externally, such
- # as Chromium, must turn this flag off so that WebRTC does not also
- # initialize.
- rtc_initialize_ffmpeg = !build_with_chromium
-
# Disable this to build without support for built-in software codecs.
rtc_use_builtin_sw_codecs = true