blob: 1c2d55d39a1cb28cee45a7f5fdc3ae84e23c685d [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
Jelena Marusic0d266052015-05-04 14:15:32 +020037enum { kVoiceEngineMaxIpPacketSizeBytes = 1500 }; // assumes Ethernet
niklase@google.com470e71d2011-07-07 08:21:25 +000038
niklase@google.com470e71d2011-07-07 08:21:25 +000039// Audio processing
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000040const NoiseSuppression::Level kDefaultNsMode = NoiseSuppression::kModerate;
41const GainControl::Mode kDefaultAgcMode =
42#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
Jelena Marusic0d266052015-05-04 14:15:32 +020043 GainControl::kAdaptiveDigital;
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000044#else
Jelena Marusic0d266052015-05-04 14:15:32 +020045 GainControl::kAdaptiveAnalog;
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000046#endif
47const bool kDefaultAgcState =
48#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
Jelena Marusic0d266052015-05-04 14:15:32 +020049 false;
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000050#else
Jelena Marusic0d266052015-05-04 14:15:32 +020051 true;
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000052#endif
andrew@webrtc.org6c264cc2013-10-04 17:54:09 +000053const GainControl::Mode kDefaultRxAgcMode = GainControl::kAdaptiveDigital;
niklase@google.com470e71d2011-07-07 08:21:25 +000054
niklase@google.com470e71d2011-07-07 08:21:25 +000055// VideoSync
56// Lowest minimum playout delay
57enum { kVoiceEngineMinMinPlayoutDelayMs = 0 };
58// Highest minimum playout delay
niklas.enbom@webrtc.org218c5422013-01-17 22:25:49 +000059enum { kVoiceEngineMaxMinPlayoutDelayMs = 10000 };
niklase@google.com470e71d2011-07-07 08:21:25 +000060
niklase@google.com470e71d2011-07-07 08:21:25 +000061// RTP/RTCP
62// Min 4-bit ID for RTP extension (see section 4.2 in RFC 5285)
63enum { kVoiceEngineMinRtpExtensionId = 1 };
64// Max 4-bit ID for RTP extension
65enum { kVoiceEngineMaxRtpExtensionId = 14 };
66
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000067} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000068
Jelena Marusic0d266052015-05-04 14:15:32 +020069#define NOT_SUPPORTED(stat) \
70 LOG_F(LS_ERROR) << "not supported"; \
71 stat.SetLastError(VE_FUNC_NOT_SUPPORTED); \
andrew@webrtc.org1e7ed7a2013-02-05 21:23:39 +000072 return -1;
73
Jelena Marusic0d266052015-05-04 14:15:32 +020074namespace webrtc {
niklase@google.com470e71d2011-07-07 08:21:25 +000075
Jelena Marusic0d266052015-05-04 14:15:32 +020076inline int VoEId(int veId, int chId) {
77 if (chId == -1) {
78 const int dummyChannel(99);
79 return (int)((veId << 16) + dummyChannel);
80 }
81 return (int)((veId << 16) + chId);
niklase@google.com470e71d2011-07-07 08:21:25 +000082}
83
Jelena Marusic0d266052015-05-04 14:15:32 +020084inline int VoEModuleId(int veId, int chId) {
85 return (int)((veId << 16) + chId);
niklase@google.com470e71d2011-07-07 08:21:25 +000086}
87
88// Convert module ID to internal VoE channel ID
Jelena Marusic0d266052015-05-04 14:15:32 +020089inline int VoEChannelId(int moduleId) {
90 return (int)(moduleId & 0xffff);
niklase@google.com470e71d2011-07-07 08:21:25 +000091}
92
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000093} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000094
niklase@google.com470e71d2011-07-07 08:21:25 +000095#if defined(_WIN32)
Jelena Marusic0d266052015-05-04 14:15:32 +020096#define WEBRTC_VOICE_ENGINE_DEFAULT_DEVICE \
97 AudioDeviceModule::kDefaultCommunicationDevice
niklase@google.com470e71d2011-07-07 08:21:25 +000098#else
niklase@google.com470e71d2011-07-07 08:21:25 +000099#define WEBRTC_VOICE_ENGINE_DEFAULT_DEVICE 0
solenberg06f240b2017-02-13 04:42:52 -0800100#endif // #if (defined(_WIN32)
niklase@google.com470e71d2011-07-07 08:21:25 +0000101
Jelena Marusic0d266052015-05-04 14:15:32 +0200102#endif // WEBRTC_VOICE_ENGINE_VOICE_ENGINE_DEFINES_H