blob: 3b86c6a7b7618409fe040f7952a9a3f70516467c [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
andrew@webrtc.org80124742012-03-08 17:54:24 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11/*
12 * This file contains common constants for VoiceEngine, as well as
solenberg06f240b2017-02-13 04:42:52 -080013 * platform specific settings.
niklase@google.com470e71d2011-07-07 08:21:25 +000014 */
15
16#ifndef WEBRTC_VOICE_ENGINE_VOICE_ENGINE_DEFINES_H
17#define WEBRTC_VOICE_ENGINE_VOICE_ENGINE_DEFINES_H
18
andrew@webrtc.org1e7ed7a2013-02-05 21:23:39 +000019#include "webrtc/common_types.h"
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000020#include "webrtc/modules/audio_processing/include/audio_processing.h"
henrik.lundina9a6d4b2016-12-12 05:03:02 -080021#include "webrtc/typedefs.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000022
andrew@webrtc.org4a6f62d2013-02-01 23:42:44 +000023namespace webrtc {
24
niklase@google.com470e71d2011-07-07 08:21:25 +000025// VolumeControl
26enum { kMinVolumeLevel = 0 };
27enum { kMaxVolumeLevel = 255 };
28// Min scale factor for per-channel volume scaling
29const float kMinOutputVolumeScaling = 0.0f;
30// Max scale factor for per-channel volume scaling
31const float kMaxOutputVolumeScaling = 10.0f;
32// Min scale factor for output volume panning
33const float kMinOutputVolumePanning = 0.0f;
34// Max scale factor for output volume panning
35const float kMaxOutputVolumePanning = 1.0f;
36
niklase@google.com470e71d2011-07-07 08:21:25 +000037// Audio processing
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000038const NoiseSuppression::Level kDefaultNsMode = NoiseSuppression::kModerate;
39const GainControl::Mode kDefaultAgcMode =
40#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
Jelena Marusic0d266052015-05-04 14:15:32 +020041 GainControl::kAdaptiveDigital;
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000042#else
Jelena Marusic0d266052015-05-04 14:15:32 +020043 GainControl::kAdaptiveAnalog;
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000044#endif
45const bool kDefaultAgcState =
46#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
Jelena Marusic0d266052015-05-04 14:15:32 +020047 false;
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000048#else
Jelena Marusic0d266052015-05-04 14:15:32 +020049 true;
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000050#endif
andrew@webrtc.org6c264cc2013-10-04 17:54:09 +000051const GainControl::Mode kDefaultRxAgcMode = GainControl::kAdaptiveDigital;
niklase@google.com470e71d2011-07-07 08:21:25 +000052
niklase@google.com470e71d2011-07-07 08:21:25 +000053// VideoSync
54// Lowest minimum playout delay
55enum { kVoiceEngineMinMinPlayoutDelayMs = 0 };
56// Highest minimum playout delay
niklas.enbom@webrtc.org218c5422013-01-17 22:25:49 +000057enum { kVoiceEngineMaxMinPlayoutDelayMs = 10000 };
niklase@google.com470e71d2011-07-07 08:21:25 +000058
niklase@google.com470e71d2011-07-07 08:21:25 +000059// RTP/RTCP
60// Min 4-bit ID for RTP extension (see section 4.2 in RFC 5285)
61enum { kVoiceEngineMinRtpExtensionId = 1 };
62// Max 4-bit ID for RTP extension
63enum { kVoiceEngineMaxRtpExtensionId = 14 };
64
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000065} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000066
Jelena Marusic0d266052015-05-04 14:15:32 +020067#define NOT_SUPPORTED(stat) \
68 LOG_F(LS_ERROR) << "not supported"; \
69 stat.SetLastError(VE_FUNC_NOT_SUPPORTED); \
andrew@webrtc.org1e7ed7a2013-02-05 21:23:39 +000070 return -1;
71
Jelena Marusic0d266052015-05-04 14:15:32 +020072namespace webrtc {
niklase@google.com470e71d2011-07-07 08:21:25 +000073
Jelena Marusic0d266052015-05-04 14:15:32 +020074inline int VoEId(int veId, int chId) {
75 if (chId == -1) {
76 const int dummyChannel(99);
77 return (int)((veId << 16) + dummyChannel);
78 }
79 return (int)((veId << 16) + chId);
niklase@google.com470e71d2011-07-07 08:21:25 +000080}
81
Jelena Marusic0d266052015-05-04 14:15:32 +020082inline int VoEModuleId(int veId, int chId) {
83 return (int)((veId << 16) + chId);
niklase@google.com470e71d2011-07-07 08:21:25 +000084}
85
86// Convert module ID to internal VoE channel ID
Jelena Marusic0d266052015-05-04 14:15:32 +020087inline int VoEChannelId(int moduleId) {
88 return (int)(moduleId & 0xffff);
niklase@google.com470e71d2011-07-07 08:21:25 +000089}
90
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000091} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000092
niklase@google.com470e71d2011-07-07 08:21:25 +000093#if defined(_WIN32)
Jelena Marusic0d266052015-05-04 14:15:32 +020094#define WEBRTC_VOICE_ENGINE_DEFAULT_DEVICE \
95 AudioDeviceModule::kDefaultCommunicationDevice
niklase@google.com470e71d2011-07-07 08:21:25 +000096#else
niklase@google.com470e71d2011-07-07 08:21:25 +000097#define WEBRTC_VOICE_ENGINE_DEFAULT_DEVICE 0
solenberg06f240b2017-02-13 04:42:52 -080098#endif // #if (defined(_WIN32)
niklase@google.com470e71d2011-07-07 08:21:25 +000099
Jelena Marusic0d266052015-05-04 14:15:32 +0200100#endif // WEBRTC_VOICE_ENGINE_VOICE_ENGINE_DEFINES_H