From c8c71b9d76bc2163da821dd9473a1ab495057a76 Mon Sep 17 00:00:00 2001 From: Mirko Bonadei Date: Mon, 16 Oct 2017 11:08:54 +0200 Subject: [PATCH] Stop using ANDROID macro in favour of WEBRTC_ANDROID. Since WEBRTC_ANDROID is defined by WebRTC while ANDROID is defined by Chromium we should stop using ANDROID in WebRTC source code. Bug: webrtc:8400 Change-Id: I1d59caaabd8af2423e86476b72e0e9185e6c7a3a No-Try: True Reviewed-on: https://webrtc-review.googlesource.com/10805 Reviewed-by: Rasmus Brandt Reviewed-by: Per Kjellander Commit-Queue: Mirko Bonadei Cr-Commit-Position: refs/heads/master@{#20306} --- media/engine/webrtcvoiceengine.cc | 14 +++++++++----- .../video_capture/test/video_capture_unittest.cc | 6 +++--- modules/video_capture/video_capture_factory.cc | 4 ++-- modules/video_coding/codecs/vp8/vp8_impl.cc | 14 +++++++++----- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/media/engine/webrtcvoiceengine.cc b/media/engine/webrtcvoiceengine.cc index c2e310a311..f3701e2cb7 100644 --- a/media/engine/webrtcvoiceengine.cc +++ b/media/engine/webrtcvoiceengine.cc @@ -367,7 +367,7 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) { options.echo_cancellation = rtc::Optional(false); options.extended_filter_aec = rtc::Optional(false); LOG(LS_INFO) << "Always disable AEC on iOS. Use built-in instead."; -#elif defined(ANDROID) +#elif defined(WEBRTC_ANDROID) ec_mode = webrtc::kEcAecm; options.extended_filter_aec = rtc::Optional(false); #endif @@ -393,7 +393,7 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) { options.typing_detection = rtc::Optional(false); options.experimental_ns = rtc::Optional(false); LOG(LS_INFO) << "Always disable NS on iOS. Use built-in instead."; -#elif defined(ANDROID) +#elif defined(WEBRTC_ANDROID) options.typing_detection = rtc::Optional(false); options.experimental_ns = rtc::Optional(false); #endif @@ -404,12 +404,16 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) { options.auto_gain_control = rtc::Optional(false); options.experimental_agc = rtc::Optional(false); LOG(LS_INFO) << "Always disable AGC on iOS. Use built-in instead."; -#elif defined(ANDROID) +#elif defined(WEBRTC_ANDROID) options.experimental_agc = rtc::Optional(false); #endif #if defined(WEBRTC_IOS) || defined(WEBRTC_ANDROID) - // Turn off the gain control if specified by the field trial. The purpose of the field trial is to reduce the amount of resampling performed inside the audio processing module on mobile platforms by whenever possible turning off the fixed AGC mode and the high-pass filter. (https://bugs.chromium.org/p/webrtc/issues/detail?id=6181). + // Turn off the gain control if specified by the field trial. + // The purpose of the field trial is to reduce the amount of resampling + // performed inside the audio processing module on mobile platforms by + // whenever possible turning off the fixed AGC mode and the high-pass filter. + // (https://bugs.chromium.org/p/webrtc/issues/detail?id=6181). if (webrtc::field_trial::IsEnabled( "WebRTC-Audio-MinimizeResamplingOnMobile")) { options.auto_gain_control = rtc::Optional(false); @@ -450,7 +454,7 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) { } webrtc::apm_helpers::SetEcStatus( apm(), *options.echo_cancellation, ec_mode); -#if !defined(ANDROID) +#if !defined(WEBRTC_ANDROID) webrtc::apm_helpers::SetEcMetricsStatus(apm(), *options.echo_cancellation); #endif if (ec_mode == webrtc::kEcAecm) { diff --git a/modules/video_capture/test/video_capture_unittest.cc b/modules/video_capture/test/video_capture_unittest.cc index 39d0489e43..16330b616f 100644 --- a/modules/video_capture/test/video_capture_unittest.cc +++ b/modules/video_capture/test/video_capture_unittest.cc @@ -74,7 +74,7 @@ class TestVideoCaptureCallback rtc::CritScope cs(&capture_cs_); int height = videoFrame.height(); int width = videoFrame.width(); -#if defined(ANDROID) && ANDROID +#if defined(WEBRTC_ANDROID) && WEBRTC_ANDROID // Android camera frames may be rotated depending on test device // orientation. EXPECT_TRUE(height == capability_.height || height == capability_.width); @@ -282,7 +282,7 @@ TEST_F(VideoCaptureTest, MAYBE_Capabilities) { EXPECT_EQ(0, module->StopCapture()); } -#if defined(ANDROID) && ANDROID +#if defined(WEBRTC_ANDROID) && WEBRTC_ANDROID // There's no reason for this to _necessarily_ be true, but in practice all // Android devices this test runs on in fact do support multiple capture // resolutions and multiple frame-rates per captured resolution, so we assert @@ -297,7 +297,7 @@ TEST_F(VideoCaptureTest, MAYBE_Capabilities) { ++it) { EXPECT_GT(it->second.size(), 1U) << it->first; } -#endif // ANDROID +#endif // WEBRTC_ANDROID } // NOTE: flaky, crashes sometimes. diff --git a/modules/video_capture/video_capture_factory.cc b/modules/video_capture/video_capture_factory.cc index 92ab75fd3c..28a61b825c 100644 --- a/modules/video_capture/video_capture_factory.cc +++ b/modules/video_capture/video_capture_factory.cc @@ -16,7 +16,7 @@ namespace webrtc { rtc::scoped_refptr VideoCaptureFactory::Create( const char* deviceUniqueIdUTF8) { -#if defined(ANDROID) +#if defined(WEBRTC_ANDROID) return nullptr; #else return videocapturemodule::VideoCaptureImpl::Create(deviceUniqueIdUTF8); @@ -29,7 +29,7 @@ rtc::scoped_refptr VideoCaptureFactory::Create( } VideoCaptureModule::DeviceInfo* VideoCaptureFactory::CreateDeviceInfo() { -#if defined(ANDROID) +#if defined(WEBRTC_ANDROID) return nullptr; #else return videocapturemodule::VideoCaptureImpl::CreateDeviceInfo(); diff --git a/modules/video_coding/codecs/vp8/vp8_impl.cc b/modules/video_coding/codecs/vp8/vp8_impl.cc index bebc749e22..53c198b2bb 100644 --- a/modules/video_coding/codecs/vp8/vp8_impl.cc +++ b/modules/video_coding/codecs/vp8/vp8_impl.cc @@ -580,7 +580,8 @@ int VP8EncoderImpl::InitEncode(const VideoCodec* inst, } int VP8EncoderImpl::SetCpuSpeed(int width, int height) { -#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || defined(ANDROID) +#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) \ + || defined(WEBRTC_ANDROID) // On mobile platform, use a lower speed setting for lower resolutions for // CPUs with 4 or more cores. RTC_DCHECK_GT(number_of_cores_, 0); @@ -605,7 +606,7 @@ int VP8EncoderImpl::SetCpuSpeed(int width, int height) { } int VP8EncoderImpl::NumberOfThreads(int width, int height, int cpus) { -#if defined(ANDROID) +#if defined(WEBRTC_ANDROID) if (width * height >= 320 * 180) { if (cpus >= 4) { // 3 threads for CPUs with 4 and more cores since most of times only 4 @@ -659,7 +660,8 @@ int VP8EncoderImpl::InitAndSetControlSettings() { // when encoding lower resolution streams. Would it work with the // multi-res encoding feature? denoiserState denoiser_state = kDenoiserOnYOnly; -#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || defined(ANDROID) +#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) \ + || defined(WEBRTC_ANDROID) denoiser_state = kDenoiserOnYOnly; #else denoiser_state = kDenoiserOnAdaptive; @@ -1056,7 +1058,8 @@ int VP8DecoderImpl::InitDecode(const VideoCodec* inst, int number_of_cores) { cfg.threads = 1; cfg.h = cfg.w = 0; // set after decode -#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || defined(ANDROID) +#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) \ + || defined(WEBRTC_ANDROID) vpx_codec_flags_t flags = use_postproc_arm_ ? VPX_CODEC_USE_POSTPROC : 0; #else vpx_codec_flags_t flags = VPX_CODEC_USE_POSTPROC; @@ -1095,7 +1098,8 @@ int VP8DecoderImpl::Decode(const EncodedImage& input_image, } // Post process configurations. -#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || defined(ANDROID) +#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) \ + || defined(WEBRTC_ANDROID) if (use_postproc_arm_) { vp8_postproc_cfg_t ppcfg; ppcfg.post_proc_flag = VP8_MFQE;