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 |
| 74 | virtual WebRtc_Word32 |
henrika@webrtc.org | 907bc55 | 2012-03-09 08:59:19 +0000 | [diff] [blame] | 75 | RecordedDataIsAvailable(const void* audioSamples, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 76 | const WebRtc_UWord32 nSamples, |
| 77 | const WebRtc_UWord8 nBytesPerSample, |
| 78 | const WebRtc_UWord8 nChannels, |
| 79 | const WebRtc_UWord32 samplesPerSec, |
| 80 | const WebRtc_UWord32 totalDelayMS, |
| 81 | const WebRtc_Word32 clockDrift, |
| 82 | const WebRtc_UWord32 currentMicLevel, |
| 83 | WebRtc_UWord32& newMicLevel); |
| 84 | |
| 85 | virtual WebRtc_Word32 NeedMorePlayData(const WebRtc_UWord32 nSamples, |
| 86 | const WebRtc_UWord8 nBytesPerSample, |
| 87 | const WebRtc_UWord8 nChannels, |
| 88 | const WebRtc_UWord32 samplesPerSec, |
henrika@webrtc.org | 907bc55 | 2012-03-09 08:59:19 +0000 | [diff] [blame] | 89 | void* audioSamples, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 90 | WebRtc_UWord32& nSamplesOut); |
| 91 | |
| 92 | // AudioDeviceObserver |
| 93 | virtual void OnErrorIsReported(const ErrorCode error); |
| 94 | virtual void OnWarningIsReported(const WarningCode warning); |
| 95 | |
| 96 | protected: |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 97 | VoEBaseImpl(voe::SharedData* shared); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 98 | virtual ~VoEBaseImpl(); |
| 99 | |
| 100 | private: |
| 101 | WebRtc_Word32 StartPlayout(); |
| 102 | WebRtc_Word32 StopPlayout(); |
| 103 | WebRtc_Word32 StartSend(); |
| 104 | WebRtc_Word32 StopSend(); |
| 105 | WebRtc_Word32 TerminateInternal(); |
| 106 | |
| 107 | WebRtc_Word32 AddBuildInfo(char* str) const; |
| 108 | WebRtc_Word32 AddVoEVersion(char* str) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 109 | #ifdef WEBRTC_VOE_EXTERNAL_REC_AND_PLAYOUT |
| 110 | WebRtc_Word32 AddExternalRecAndPlayoutBuild(char* str) const; |
| 111 | #endif |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 112 | VoiceEngineObserver* _voiceEngineObserverPtr; |
| 113 | CriticalSectionWrapper& _callbackCritSect; |
| 114 | |
| 115 | bool _voiceEngineObserver; |
| 116 | WebRtc_UWord32 _oldVoEMicLevel; |
| 117 | WebRtc_UWord32 _oldMicLevel; |
kma@webrtc.org | de66b91 | 2012-02-01 18:39:44 +0000 | [diff] [blame] | 118 | AudioFrame _audioFrame; |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 119 | voe::SharedData* _shared; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 120 | }; |
| 121 | |
| 122 | } // namespace webrtc |
| 123 | |
| 124 | #endif // WEBRTC_VOICE_ENGINE_VOE_BASE_IMPL_H |