niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
kma@webrtc.org | de66b91 | 2012-02-01 18:39:44 +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 | #ifndef WEBRTC_VOICE_ENGINE_VOE_BASE_IMPL_H |
| 12 | #define WEBRTC_VOICE_ENGINE_VOE_BASE_IMPL_H |
| 13 | |
| 14 | #include "voe_base.h" |
| 15 | |
kma@webrtc.org | de66b91 | 2012-02-01 18:39:44 +0000 | [diff] [blame] | 16 | #include "module_common_types.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 17 | #include "shared_data.h" |
| 18 | |
| 19 | namespace webrtc |
| 20 | { |
| 21 | |
| 22 | class ProcessThread; |
| 23 | |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 24 | class VoEBaseImpl: public VoEBase, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 25 | public AudioTransport, |
| 26 | public AudioDeviceObserver |
| 27 | { |
| 28 | public: |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 29 | virtual int RegisterVoiceEngineObserver(VoiceEngineObserver& observer); |
| 30 | |
| 31 | virtual int DeRegisterVoiceEngineObserver(); |
| 32 | |
andrew@webrtc.org | f0a90c3 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 33 | virtual int Init(AudioDeviceModule* external_adm = NULL, |
| 34 | AudioProcessing* audioproc = NULL); |
| 35 | virtual AudioProcessing* audio_processing() { |
| 36 | return _shared->audio_processing(); |
| 37 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 38 | |
| 39 | virtual int Terminate(); |
| 40 | |
| 41 | virtual int MaxNumOfChannels(); |
| 42 | |
| 43 | virtual int CreateChannel(); |
| 44 | |
| 45 | virtual int DeleteChannel(int channel); |
| 46 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 47 | virtual int StartReceive(int channel); |
| 48 | |
| 49 | virtual int StartPlayout(int channel); |
| 50 | |
| 51 | virtual int StartSend(int channel); |
| 52 | |
| 53 | virtual int StopReceive(int channel); |
| 54 | |
| 55 | virtual int StopPlayout(int channel); |
| 56 | |
| 57 | virtual int StopSend(int channel); |
| 58 | |
| 59 | virtual int SetNetEQPlayoutMode(int channel, NetEqModes mode); |
| 60 | |
| 61 | virtual int GetNetEQPlayoutMode(int channel, NetEqModes& mode); |
| 62 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 63 | virtual int SetOnHoldStatus(int channel, |
| 64 | bool enable, |
| 65 | OnHoldModes mode = kHoldSendAndPlay); |
| 66 | |
| 67 | virtual int GetOnHoldStatus(int channel, bool& enabled, OnHoldModes& mode); |
| 68 | |
| 69 | virtual int GetVersion(char version[1024]); |
| 70 | |
| 71 | virtual int LastError(); |
| 72 | |
| 73 | // AudioTransport |
pbos@webrtc.org | 6141e13 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 74 | virtual int32_t |
henrika@webrtc.org | 907bc55 | 2012-03-09 08:59:19 +0000 | [diff] [blame] | 75 | RecordedDataIsAvailable(const void* audioSamples, |
pbos@webrtc.org | 9213521 | 2013-05-14 08:31:39 +0000 | [diff] [blame^] | 76 | uint32_t nSamples, |
| 77 | uint8_t nBytesPerSample, |
| 78 | uint8_t nChannels, |
| 79 | uint32_t samplesPerSec, |
| 80 | uint32_t totalDelayMS, |
| 81 | int32_t clockDrift, |
| 82 | uint32_t currentMicLevel, |
| 83 | bool keyPressed, |
pbos@webrtc.org | 6141e13 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 84 | uint32_t& newMicLevel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 85 | |
pbos@webrtc.org | 9213521 | 2013-05-14 08:31:39 +0000 | [diff] [blame^] | 86 | virtual int32_t NeedMorePlayData(uint32_t nSamples, |
| 87 | uint8_t nBytesPerSample, |
| 88 | uint8_t nChannels, |
| 89 | uint32_t samplesPerSec, |
pbos@webrtc.org | 6141e13 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 90 | void* audioSamples, |
| 91 | uint32_t& nSamplesOut); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 92 | |
| 93 | // AudioDeviceObserver |
pbos@webrtc.org | 9213521 | 2013-05-14 08:31:39 +0000 | [diff] [blame^] | 94 | virtual void OnErrorIsReported(ErrorCode error); |
| 95 | virtual void OnWarningIsReported(WarningCode warning); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 96 | |
| 97 | protected: |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 98 | VoEBaseImpl(voe::SharedData* shared); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 99 | virtual ~VoEBaseImpl(); |
| 100 | |
| 101 | private: |
pbos@webrtc.org | 6141e13 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 102 | int32_t StartPlayout(); |
| 103 | int32_t StopPlayout(); |
| 104 | int32_t StartSend(); |
| 105 | int32_t StopSend(); |
| 106 | int32_t TerminateInternal(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 107 | |
pbos@webrtc.org | 6141e13 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 108 | int32_t AddBuildInfo(char* str) const; |
| 109 | int32_t AddVoEVersion(char* str) const; |
pwestin@webrtc.org | 684f057 | 2013-03-13 23:20:57 +0000 | [diff] [blame] | 110 | #ifdef WEBRTC_EXTERNAL_TRANSPORT |
pbos@webrtc.org | 6141e13 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 111 | int32_t AddExternalTransportBuild(char* str) const; |
pwestin@webrtc.org | 684f057 | 2013-03-13 23:20:57 +0000 | [diff] [blame] | 112 | #endif |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 113 | #ifdef WEBRTC_VOE_EXTERNAL_REC_AND_PLAYOUT |
pbos@webrtc.org | 6141e13 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 114 | int32_t AddExternalRecAndPlayoutBuild(char* str) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 115 | #endif |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 116 | VoiceEngineObserver* _voiceEngineObserverPtr; |
| 117 | CriticalSectionWrapper& _callbackCritSect; |
| 118 | |
| 119 | bool _voiceEngineObserver; |
pbos@webrtc.org | 6141e13 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 120 | uint32_t _oldVoEMicLevel; |
| 121 | uint32_t _oldMicLevel; |
kma@webrtc.org | de66b91 | 2012-02-01 18:39:44 +0000 | [diff] [blame] | 122 | AudioFrame _audioFrame; |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 123 | voe::SharedData* _shared; |
pwestin@webrtc.org | 684f057 | 2013-03-13 23:20:57 +0000 | [diff] [blame] | 124 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 125 | }; |
| 126 | |
| 127 | } // namespace webrtc |
| 128 | |
| 129 | #endif // WEBRTC_VOICE_ENGINE_VOE_BASE_IMPL_H |