blob: 92f1539d5ad3ba58b87ca5f3515e2c3d8cf261d7 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
kma@webrtc.orgde66b912012-02-01 18:39:44 +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#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.orgde66b912012-02-01 18:39:44 +000016#include "module_common_types.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000017#include "shared_data.h"
18
19namespace webrtc
20{
21
22class ProcessThread;
23
tommi@webrtc.org851becd2012-04-04 14:57:19 +000024class VoEBaseImpl: public VoEBase,
niklase@google.com470e71d2011-07-07 08:21:25 +000025 public AudioTransport,
26 public AudioDeviceObserver
27{
28public:
niklase@google.com470e71d2011-07-07 08:21:25 +000029 virtual int RegisterVoiceEngineObserver(VoiceEngineObserver& observer);
30
31 virtual int DeRegisterVoiceEngineObserver();
32
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000033 virtual int Init(AudioDeviceModule* external_adm = NULL,
34 AudioProcessing* audioproc = NULL);
35 virtual AudioProcessing* audio_processing() {
36 return _shared->audio_processing();
37 }
niklase@google.com470e71d2011-07-07 08:21:25 +000038
39 virtual int Terminate();
40
41 virtual int MaxNumOfChannels();
42
43 virtual int CreateChannel();
44
45 virtual int DeleteChannel(int channel);
46
niklase@google.com470e71d2011-07-07 08:21:25 +000047 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.com470e71d2011-07-07 08:21:25 +000063 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.org907bc552012-03-09 08:59:19 +000075 RecordedDataIsAvailable(const void* audioSamples,
niklase@google.com470e71d2011-07-07 08:21:25 +000076 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.org907bc552012-03-09 08:59:19 +000089 void* audioSamples,
niklase@google.com470e71d2011-07-07 08:21:25 +000090 WebRtc_UWord32& nSamplesOut);
91
92 // AudioDeviceObserver
93 virtual void OnErrorIsReported(const ErrorCode error);
94 virtual void OnWarningIsReported(const WarningCode warning);
95
96protected:
tommi@webrtc.org851becd2012-04-04 14:57:19 +000097 VoEBaseImpl(voe::SharedData* shared);
niklase@google.com470e71d2011-07-07 08:21:25 +000098 virtual ~VoEBaseImpl();
99
100private:
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.com470e71d2011-07-07 08:21:25 +0000109#ifdef WEBRTC_VOE_EXTERNAL_REC_AND_PLAYOUT
110 WebRtc_Word32 AddExternalRecAndPlayoutBuild(char* str) const;
111#endif
niklase@google.com470e71d2011-07-07 08:21:25 +0000112 VoiceEngineObserver* _voiceEngineObserverPtr;
113 CriticalSectionWrapper& _callbackCritSect;
114
115 bool _voiceEngineObserver;
116 WebRtc_UWord32 _oldVoEMicLevel;
117 WebRtc_UWord32 _oldMicLevel;
kma@webrtc.orgde66b912012-02-01 18:39:44 +0000118 AudioFrame _audioFrame;
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000119 voe::SharedData* _shared;
niklase@google.com470e71d2011-07-07 08:21:25 +0000120};
121
122} // namespace webrtc
123
124#endif // WEBRTC_VOICE_ENGINE_VOE_BASE_IMPL_H