From f00082da37e2118784054c0a2823aac81e517a24 Mon Sep 17 00:00:00 2001 From: "henrik.lundin" Date: Mon, 5 Dec 2016 02:22:12 -0800 Subject: [PATCH] Move WEBRTC_VOICE_ENGINE_TYPING_DETECTION to transmit_mixer.h BUG=webrtc:6506 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_rel_ng;master.tryserver.chromium.mac:mac_chromium_rel_ng,ios-device;master.tryserver.chromium.win:win_chromium_rel_ng;master.tryserver.chromium.android:android_compile_dbg,linux_android_rel_ng Review-Url: https://codereview.webrtc.org/2544123003 Cr-Commit-Position: refs/heads/master@{#15414} --- webrtc/voice_engine/transmit_mixer.cc | 12 ++++++------ webrtc/voice_engine/transmit_mixer.h | 12 +++++++++--- webrtc/voice_engine/voe_audio_processing_impl.cc | 6 +++--- webrtc/voice_engine_configurations.h | 12 ------------ 4 files changed, 18 insertions(+), 24 deletions(-) diff --git a/webrtc/voice_engine/transmit_mixer.cc b/webrtc/voice_engine/transmit_mixer.cc index 8876e337ab..c7a09df5bc 100644 --- a/webrtc/voice_engine/transmit_mixer.cc +++ b/webrtc/voice_engine/transmit_mixer.cc @@ -34,7 +34,7 @@ TransmitMixer::OnPeriodicProcess() WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, -1), "TransmitMixer::OnPeriodicProcess()"); -#if defined(WEBRTC_VOICE_ENGINE_TYPING_DETECTION) +#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION bool send_typing_noise_warning = false; bool typing_noise_detected = false; { @@ -191,7 +191,7 @@ TransmitMixer::TransmitMixer(uint32_t instanceId) : _fileRecording(false), _fileCallRecording(false), _audioLevel(), -#ifdef WEBRTC_VOICE_ENGINE_TYPING_DETECTION +#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION _typingNoiseWarningPending(false), _typingNoiseDetected(false), #endif @@ -342,7 +342,7 @@ TransmitMixer::PrepareDemux(const void* audioSamples, AudioFrameOperations::SwapStereoChannels(&_audioFrame); // --- Annoying typing detection (utilizes the APM/VAD decision) -#ifdef WEBRTC_VOICE_ENGINE_TYPING_DETECTION +#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION TypingDetection(keyPressed); #endif @@ -1167,7 +1167,7 @@ void TransmitMixer::ProcessAudio(int delay_ms, int clock_drift, _saturationWarning |= agc->stream_is_saturated(); } -#ifdef WEBRTC_VOICE_ENGINE_TYPING_DETECTION +#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION void TransmitMixer::TypingDetection(bool keyPressed) { // We let the VAD determine if we're using this feature or not. @@ -1198,7 +1198,7 @@ int TransmitMixer::GetMixingFrequency() return _audioFrame.sample_rate_hz_; } -#ifdef WEBRTC_VOICE_ENGINE_TYPING_DETECTION +#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION int TransmitMixer::TimeSinceLastTyping(int &seconds) { // We check in VoEAudioProcessingImpl that this is only called when @@ -1208,7 +1208,7 @@ int TransmitMixer::TimeSinceLastTyping(int &seconds) } #endif -#ifdef WEBRTC_VOICE_ENGINE_TYPING_DETECTION +#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION int TransmitMixer::SetTypingDetectionParameters(int timeWindow, int costPerTyping, int reportingThreshold, diff --git a/webrtc/voice_engine/transmit_mixer.h b/webrtc/voice_engine/transmit_mixer.h index f697d3aded..3147c1036f 100644 --- a/webrtc/voice_engine/transmit_mixer.h +++ b/webrtc/voice_engine/transmit_mixer.h @@ -25,6 +25,12 @@ #include "webrtc/voice_engine/monitor_module.h" #include "webrtc/voice_engine/voice_engine_defines.h" +#if !defined(WEBRTC_ANDROID) && !defined(WEBRTC_IOS) +#define WEBRTC_VOICE_ENGINE_TYPING_DETECTION 1 +#else +#define WEBRTC_VOICE_ENGINE_TYPING_DETECTION 0 +#endif + namespace webrtc { class AudioProcessing; @@ -151,7 +157,7 @@ public: void RecordFileEnded(int32_t id); -#ifdef WEBRTC_VOICE_ENGINE_TYPING_DETECTION +#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION // Typing detection int TimeSinceLastTyping(int &seconds); int SetTypingDetectionParameters(int timeWindow, @@ -183,7 +189,7 @@ private: void ProcessAudio(int delay_ms, int clock_drift, int current_mic_level, bool key_pressed); -#ifdef WEBRTC_VOICE_ENGINE_TYPING_DETECTION +#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION void TypingDetection(bool keyPressed); #endif @@ -212,7 +218,7 @@ private: rtc::CriticalSection _critSect; rtc::CriticalSection _callbackCritSect; -#ifdef WEBRTC_VOICE_ENGINE_TYPING_DETECTION +#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION webrtc::TypingDetection _typingDetection; bool _typingNoiseWarningPending; bool _typingNoiseDetected; diff --git a/webrtc/voice_engine/voe_audio_processing_impl.cc b/webrtc/voice_engine/voe_audio_processing_impl.cc index 953263db9e..3ee0e9562f 100644 --- a/webrtc/voice_engine/voe_audio_processing_impl.cc +++ b/webrtc/voice_engine/voe_audio_processing_impl.cc @@ -681,7 +681,7 @@ int VoEAudioProcessingImpl::StopDebugRecording() { int VoEAudioProcessingImpl::SetTypingDetectionStatus(bool enable) { WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), "SetTypingDetectionStatus()"); -#if !defined(WEBRTC_VOICE_ENGINE_TYPING_DETECTION) +#if !WEBRTC_VOICE_ENGINE_TYPING_DETECTION NOT_SUPPORTED(_shared->statistics()); #else if (!_shared->statistics().Initialized()) { @@ -723,7 +723,7 @@ int VoEAudioProcessingImpl::GetTypingDetectionStatus(bool& enabled) { } int VoEAudioProcessingImpl::TimeSinceLastTyping(int& seconds) { -#if !defined(WEBRTC_VOICE_ENGINE_TYPING_DETECTION) +#if !WEBRTC_VOICE_ENGINE_TYPING_DETECTION NOT_SUPPORTED(_shared->statistics()); #else if (!_shared->statistics().Initialized()) { @@ -750,7 +750,7 @@ int VoEAudioProcessingImpl::SetTypingDetectionParameters(int timeWindow, int typeEventDelay) { WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), "SetTypingDetectionParameters()"); -#if !defined(WEBRTC_VOICE_ENGINE_TYPING_DETECTION) +#if !WEBRTC_VOICE_ENGINE_TYPING_DETECTION NOT_SUPPORTED(_shared->statistics()); #else if (!_shared->statistics().Initialized()) { diff --git a/webrtc/voice_engine_configurations.h b/webrtc/voice_engine_configurations.h index 71840019d4..f801ba1ebc 100644 --- a/webrtc/voice_engine_configurations.h +++ b/webrtc/voice_engine_configurations.h @@ -13,16 +13,4 @@ #include "webrtc/typedefs.h" -// ============================================================================ -// VoiceEngine -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Settings for VoiceEngine -// ---------------------------------------------------------------------------- - -#if !defined(WEBRTC_ANDROID) && !defined(WEBRTC_IOS) -#define WEBRTC_VOICE_ENGINE_TYPING_DETECTION // Typing detection -#endif - #endif // WEBRTC_VOICE_ENGINE_CONFIGURATIONS_H_