blob: 230e750e11fb031ea347eb302346bcec99d10d18 [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
pbos@webrtc.org6141e132013-04-09 10:09:10 +000074 virtual int32_t
henrika@webrtc.org907bc552012-03-09 08:59:19 +000075 RecordedDataIsAvailable(const void* audioSamples,
pbos@webrtc.org92135212013-05-14 08:31:39 +000076 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.org6141e132013-04-09 10:09:10 +000084 uint32_t& newMicLevel);
niklase@google.com470e71d2011-07-07 08:21:25 +000085
pbos@webrtc.org92135212013-05-14 08:31:39 +000086 virtual int32_t NeedMorePlayData(uint32_t nSamples,
87 uint8_t nBytesPerSample,
88 uint8_t nChannels,
89 uint32_t samplesPerSec,
pbos@webrtc.org6141e132013-04-09 10:09:10 +000090 void* audioSamples,
91 uint32_t& nSamplesOut);
niklase@google.com470e71d2011-07-07 08:21:25 +000092
93 // AudioDeviceObserver
pbos@webrtc.org92135212013-05-14 08:31:39 +000094 virtual void OnErrorIsReported(ErrorCode error);
95 virtual void OnWarningIsReported(WarningCode warning);
niklase@google.com470e71d2011-07-07 08:21:25 +000096
97protected:
tommi@webrtc.org851becd2012-04-04 14:57:19 +000098 VoEBaseImpl(voe::SharedData* shared);
niklase@google.com470e71d2011-07-07 08:21:25 +000099 virtual ~VoEBaseImpl();
100
101private:
pbos@webrtc.org6141e132013-04-09 10:09:10 +0000102 int32_t StartPlayout();
103 int32_t StopPlayout();
104 int32_t StartSend();
105 int32_t StopSend();
106 int32_t TerminateInternal();
niklase@google.com470e71d2011-07-07 08:21:25 +0000107
pbos@webrtc.org6141e132013-04-09 10:09:10 +0000108 int32_t AddBuildInfo(char* str) const;
109 int32_t AddVoEVersion(char* str) const;
pwestin@webrtc.org684f0572013-03-13 23:20:57 +0000110#ifdef WEBRTC_EXTERNAL_TRANSPORT
pbos@webrtc.org6141e132013-04-09 10:09:10 +0000111 int32_t AddExternalTransportBuild(char* str) const;
pwestin@webrtc.org684f0572013-03-13 23:20:57 +0000112#endif
niklase@google.com470e71d2011-07-07 08:21:25 +0000113#ifdef WEBRTC_VOE_EXTERNAL_REC_AND_PLAYOUT
pbos@webrtc.org6141e132013-04-09 10:09:10 +0000114 int32_t AddExternalRecAndPlayoutBuild(char* str) const;
niklase@google.com470e71d2011-07-07 08:21:25 +0000115#endif
niklase@google.com470e71d2011-07-07 08:21:25 +0000116 VoiceEngineObserver* _voiceEngineObserverPtr;
117 CriticalSectionWrapper& _callbackCritSect;
118
119 bool _voiceEngineObserver;
pbos@webrtc.org6141e132013-04-09 10:09:10 +0000120 uint32_t _oldVoEMicLevel;
121 uint32_t _oldMicLevel;
kma@webrtc.orgde66b912012-02-01 18:39:44 +0000122 AudioFrame _audioFrame;
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000123 voe::SharedData* _shared;
pwestin@webrtc.org684f0572013-03-13 23:20:57 +0000124
niklase@google.com470e71d2011-07-07 08:21:25 +0000125};
126
127} // namespace webrtc
128
129#endif // WEBRTC_VOICE_ENGINE_VOE_BASE_IMPL_H