niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
andrew@webrtc.org | 8012474 | 2012-03-08 17:54:24 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 3 | * |
| 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 |
solenberg | 06f240b | 2017-02-13 04:42:52 -0800 | [diff] [blame] | 13 | * platform specific settings. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #ifndef WEBRTC_VOICE_ENGINE_VOICE_ENGINE_DEFINES_H |
| 17 | #define WEBRTC_VOICE_ENGINE_VOICE_ENGINE_DEFINES_H |
| 18 | |
andrew@webrtc.org | 1e7ed7a | 2013-02-05 21:23:39 +0000 | [diff] [blame] | 19 | #include "webrtc/common_types.h" |
andrew@webrtc.org | f0a90c3 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 20 | #include "webrtc/modules/audio_processing/include/audio_processing.h" |
henrik.lundin | a9a6d4b | 2016-12-12 05:03:02 -0800 | [diff] [blame] | 21 | #include "webrtc/typedefs.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 22 | |
andrew@webrtc.org | 4a6f62d | 2013-02-01 23:42:44 +0000 | [diff] [blame] | 23 | namespace webrtc { |
| 24 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 25 | // VolumeControl |
| 26 | enum { kMinVolumeLevel = 0 }; |
| 27 | enum { kMaxVolumeLevel = 255 }; |
| 28 | // Min scale factor for per-channel volume scaling |
| 29 | const float kMinOutputVolumeScaling = 0.0f; |
| 30 | // Max scale factor for per-channel volume scaling |
| 31 | const float kMaxOutputVolumeScaling = 10.0f; |
| 32 | // Min scale factor for output volume panning |
| 33 | const float kMinOutputVolumePanning = 0.0f; |
| 34 | // Max scale factor for output volume panning |
| 35 | const float kMaxOutputVolumePanning = 1.0f; |
| 36 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 37 | // Audio processing |
andrew@webrtc.org | f0a90c3 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 38 | const NoiseSuppression::Level kDefaultNsMode = NoiseSuppression::kModerate; |
| 39 | const GainControl::Mode kDefaultAgcMode = |
| 40 | #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) |
Jelena Marusic | 0d26605 | 2015-05-04 14:15:32 +0200 | [diff] [blame] | 41 | GainControl::kAdaptiveDigital; |
andrew@webrtc.org | f0a90c3 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 42 | #else |
Jelena Marusic | 0d26605 | 2015-05-04 14:15:32 +0200 | [diff] [blame] | 43 | GainControl::kAdaptiveAnalog; |
andrew@webrtc.org | f0a90c3 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 44 | #endif |
| 45 | const bool kDefaultAgcState = |
| 46 | #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) |
Jelena Marusic | 0d26605 | 2015-05-04 14:15:32 +0200 | [diff] [blame] | 47 | false; |
andrew@webrtc.org | f0a90c3 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 48 | #else |
Jelena Marusic | 0d26605 | 2015-05-04 14:15:32 +0200 | [diff] [blame] | 49 | true; |
andrew@webrtc.org | f0a90c3 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 50 | #endif |
andrew@webrtc.org | 6c264cc | 2013-10-04 17:54:09 +0000 | [diff] [blame] | 51 | const GainControl::Mode kDefaultRxAgcMode = GainControl::kAdaptiveDigital; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 52 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 53 | // VideoSync |
| 54 | // Lowest minimum playout delay |
| 55 | enum { kVoiceEngineMinMinPlayoutDelayMs = 0 }; |
| 56 | // Highest minimum playout delay |
niklas.enbom@webrtc.org | 218c542 | 2013-01-17 22:25:49 +0000 | [diff] [blame] | 57 | enum { kVoiceEngineMaxMinPlayoutDelayMs = 10000 }; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 58 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 59 | // RTP/RTCP |
| 60 | // Min 4-bit ID for RTP extension (see section 4.2 in RFC 5285) |
| 61 | enum { kVoiceEngineMinRtpExtensionId = 1 }; |
| 62 | // Max 4-bit ID for RTP extension |
| 63 | enum { kVoiceEngineMaxRtpExtensionId = 14 }; |
| 64 | |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 65 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 66 | |
Jelena Marusic | 0d26605 | 2015-05-04 14:15:32 +0200 | [diff] [blame] | 67 | #define NOT_SUPPORTED(stat) \ |
| 68 | LOG_F(LS_ERROR) << "not supported"; \ |
| 69 | stat.SetLastError(VE_FUNC_NOT_SUPPORTED); \ |
andrew@webrtc.org | 1e7ed7a | 2013-02-05 21:23:39 +0000 | [diff] [blame] | 70 | return -1; |
| 71 | |
Jelena Marusic | 0d26605 | 2015-05-04 14:15:32 +0200 | [diff] [blame] | 72 | namespace webrtc { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 73 | |
Jelena Marusic | 0d26605 | 2015-05-04 14:15:32 +0200 | [diff] [blame] | 74 | inline 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.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 80 | } |
| 81 | |
Jelena Marusic | 0d26605 | 2015-05-04 14:15:32 +0200 | [diff] [blame] | 82 | inline int VoEModuleId(int veId, int chId) { |
| 83 | return (int)((veId << 16) + chId); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | // Convert module ID to internal VoE channel ID |
Jelena Marusic | 0d26605 | 2015-05-04 14:15:32 +0200 | [diff] [blame] | 87 | inline int VoEChannelId(int moduleId) { |
| 88 | return (int)(moduleId & 0xffff); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 89 | } |
| 90 | |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 91 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 92 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 93 | #if defined(_WIN32) |
Jelena Marusic | 0d26605 | 2015-05-04 14:15:32 +0200 | [diff] [blame] | 94 | #define WEBRTC_VOICE_ENGINE_DEFAULT_DEVICE \ |
| 95 | AudioDeviceModule::kDefaultCommunicationDevice |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 96 | #else |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 97 | #define WEBRTC_VOICE_ENGINE_DEFAULT_DEVICE 0 |
solenberg | 06f240b | 2017-02-13 04:42:52 -0800 | [diff] [blame] | 98 | #endif // #if (defined(_WIN32) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 99 | |
Jelena Marusic | 0d26605 | 2015-05-04 14:15:32 +0200 | [diff] [blame] | 100 | #endif // WEBRTC_VOICE_ENGINE_VOICE_ENGINE_DEFINES_H |