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}
This commit is contained in:
Sergey Silkin 2018-06-25 16:22:38 +02:00 committed by Commit Bot
parent df3bcdbe88
commit fe288eb687
3 changed files with 1 additions and 44 deletions

View File

@ -301,9 +301,6 @@ rtc_static_library("webrtc_h264") {
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 @@ rtc_static_library("webrtc_h264") {
"//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" ]
}

View File

@ -45,21 +45,6 @@ enum H264DecoderImplEvent {
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 @@ int32_t H264DecoderImpl::InitDecode(const VideoCodec* codec_settings,
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) {

View File

@ -122,8 +122,7 @@ declare_args() {
# 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 @@ declare_args() {
# 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