OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... | |
29 // base->DeleteChannel(ch); | 29 // base->DeleteChannel(ch); |
30 // base->Terminate(); | 30 // base->Terminate(); |
31 // base->Release(); | 31 // base->Release(); |
32 // VoiceEngine::Delete(voe); | 32 // VoiceEngine::Delete(voe); |
33 // | 33 // |
34 #ifndef WEBRTC_VOICE_ENGINE_VOE_BASE_H | 34 #ifndef WEBRTC_VOICE_ENGINE_VOE_BASE_H |
35 #define WEBRTC_VOICE_ENGINE_VOE_BASE_H | 35 #define WEBRTC_VOICE_ENGINE_VOE_BASE_H |
36 | 36 |
37 #include "webrtc/base/scoped_ref_ptr.h" | 37 #include "webrtc/base/scoped_ref_ptr.h" |
38 #include "webrtc/modules/audio_coding/codecs/audio_decoder_factory.h" | 38 #include "webrtc/modules/audio_coding/codecs/audio_decoder_factory.h" |
39 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" | |
39 #include "webrtc/common_types.h" | 40 #include "webrtc/common_types.h" |
40 | 41 |
41 namespace webrtc { | 42 namespace webrtc { |
42 | 43 |
43 class AudioDeviceModule; | 44 class AudioDeviceModule; |
44 class AudioProcessing; | 45 class AudioProcessing; |
45 class AudioTransport; | 46 class AudioTransport; |
46 class Config; | |
47 | |
48 const int kVoEDefault = -1; | |
49 | 47 |
50 // VoiceEngineObserver | 48 // VoiceEngineObserver |
51 class WEBRTC_DLLEXPORT VoiceEngineObserver { | 49 class WEBRTC_DLLEXPORT VoiceEngineObserver { |
52 public: | 50 public: |
53 // This method will be called after the occurrence of any runtime error | 51 // This method will be called after the occurrence of any runtime error |
54 // code, or warning notification, when the observer interface has been | 52 // code, or warning notification, when the observer interface has been |
55 // installed using VoEBase::RegisterVoiceEngineObserver(). | 53 // installed using VoEBase::RegisterVoiceEngineObserver(). |
56 virtual void CallbackOnError(int channel, int errCode) = 0; | 54 virtual void CallbackOnError(int channel, int errCode) = 0; |
57 | 55 |
58 protected: | 56 protected: |
59 virtual ~VoiceEngineObserver() {} | 57 virtual ~VoiceEngineObserver() {} |
60 }; | 58 }; |
61 | 59 |
62 // VoiceEngine | 60 // VoiceEngine |
63 class WEBRTC_DLLEXPORT VoiceEngine { | 61 class WEBRTC_DLLEXPORT VoiceEngine { |
64 public: | 62 public: |
65 // Creates a VoiceEngine object, which can then be used to acquire | 63 // Creates a VoiceEngine object, which can then be used to acquire |
66 // sub-APIs. Returns NULL on failure. | 64 // sub-APIs. Returns NULL on failure. |
67 static VoiceEngine* Create(); | 65 static VoiceEngine* Create(); |
68 static VoiceEngine* Create(const Config& config); | |
69 | 66 |
70 // Deletes a created VoiceEngine object and releases the utilized resources. | 67 // Deletes a created VoiceEngine object and releases the utilized resources. |
71 // Note that if there are outstanding references held via other interfaces, | 68 // Note that if there are outstanding references held via other interfaces, |
72 // the voice engine instance will not actually be deleted until those | 69 // the voice engine instance will not actually be deleted until those |
73 // references have been released. | 70 // references have been released. |
74 static bool Delete(VoiceEngine*& voiceEngine); | 71 static bool Delete(VoiceEngine*& voiceEngine); |
75 | 72 |
76 // Specifies the amount and type of trace information which will be | 73 // Specifies the amount and type of trace information which will be |
77 // created by the VoiceEngine. | 74 // created by the VoiceEngine. |
78 static int SetTraceFilter(unsigned int filter); | 75 static int SetTraceFilter(unsigned int filter); |
(...skipping 13 matching lines...) Expand all Loading... | |
92 static std::string GetVersionString(); | 89 static std::string GetVersionString(); |
93 | 90 |
94 protected: | 91 protected: |
95 VoiceEngine() {} | 92 VoiceEngine() {} |
96 ~VoiceEngine() {} | 93 ~VoiceEngine() {} |
97 }; | 94 }; |
98 | 95 |
99 // VoEBase | 96 // VoEBase |
100 class WEBRTC_DLLEXPORT VoEBase { | 97 class WEBRTC_DLLEXPORT VoEBase { |
101 public: | 98 public: |
99 struct ChannelConfig { | |
hlundin-webrtc
2016/09/05 11:28:42
We tend to let the Config struct of a class reside
kwiberg-webrtc
2016/09/05 14:36:24
+1
the sun
2016/09/05 15:25:04
Agree in principle, but
-2
The Channel class is
hlundin-webrtc
2016/09/06 12:07:21
Acknowledged.
| |
100 AudioCodingModule::Config acm_config; | |
101 bool enable_voice_pacing = false; | |
102 }; | |
103 | |
102 // Factory for the VoEBase sub-API. Increases an internal reference | 104 // Factory for the VoEBase sub-API. Increases an internal reference |
103 // counter if successful. Returns NULL if the API is not supported or if | 105 // counter if successful. Returns NULL if the API is not supported or if |
104 // construction fails. | 106 // construction fails. |
105 static VoEBase* GetInterface(VoiceEngine* voiceEngine); | 107 static VoEBase* GetInterface(VoiceEngine* voiceEngine); |
106 | 108 |
107 // Releases the VoEBase sub-API and decreases an internal reference | 109 // Releases the VoEBase sub-API and decreases an internal reference |
108 // counter. Returns the new reference count. This value should be zero | 110 // counter. Returns the new reference count. This value should be zero |
109 // for all sub-APIs before the VoiceEngine object can be safely deleted. | 111 // for all sub-APIs before the VoiceEngine object can be safely deleted. |
110 virtual int Release() = 0; | 112 virtual int Release() = 0; |
111 | 113 |
(...skipping 27 matching lines...) Expand all Loading... | |
139 | 141 |
140 // This method is WIP - DO NOT USE! | 142 // This method is WIP - DO NOT USE! |
141 // Returns NULL before Init() is called. | 143 // Returns NULL before Init() is called. |
142 virtual AudioDeviceModule* audio_device_module() = 0; | 144 virtual AudioDeviceModule* audio_device_module() = 0; |
143 | 145 |
144 // Terminates all VoiceEngine functions and releases allocated resources. | 146 // Terminates all VoiceEngine functions and releases allocated resources. |
145 // Returns 0. | 147 // Returns 0. |
146 virtual int Terminate() = 0; | 148 virtual int Terminate() = 0; |
147 | 149 |
148 // Creates a new channel and allocates the required resources for it. | 150 // Creates a new channel and allocates the required resources for it. |
149 // One can use |config| to configure the channel. Currently that is used for | 151 // The second version accepts a |config| struct which includes an Audio Coding |
150 // choosing between ACM1 and ACM2, when creating Audio Coding Module. | 152 // Module config and an option to enable voice pacing. |
151 // Returns channel ID or -1 in case of an error. | 153 // Returns channel ID or -1 in case of an error. |
152 virtual int CreateChannel() = 0; | 154 virtual int CreateChannel() = 0; |
153 virtual int CreateChannel(const Config& config) = 0; | 155 virtual int CreateChannel(const ChannelConfig& config) = 0; |
154 | 156 |
155 // Deletes an existing channel and releases the utilized resources. | 157 // Deletes an existing channel and releases the utilized resources. |
156 // Returns -1 in case of an error, 0 otherwise. | 158 // Returns -1 in case of an error, 0 otherwise. |
157 virtual int DeleteChannel(int channel) = 0; | 159 virtual int DeleteChannel(int channel) = 0; |
158 | 160 |
159 // Prepares and initiates the VoiceEngine for reception of | 161 // Prepares and initiates the VoiceEngine for reception of |
160 // incoming RTP/RTCP packets on the specified |channel|. | 162 // incoming RTP/RTCP packets on the specified |channel|. |
161 virtual int StartReceive(int channel) = 0; | 163 virtual int StartReceive(int channel) = 0; |
162 | 164 |
163 // Stops receiving incoming RTP/RTCP packets on the specified |channel|. | 165 // Stops receiving incoming RTP/RTCP packets on the specified |channel|. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 virtual int AssociateSendChannel(int channel, int accociate_send_channel) = 0; | 197 virtual int AssociateSendChannel(int channel, int accociate_send_channel) = 0; |
196 | 198 |
197 protected: | 199 protected: |
198 VoEBase() {} | 200 VoEBase() {} |
199 virtual ~VoEBase() {} | 201 virtual ~VoEBase() {} |
200 }; | 202 }; |
201 | 203 |
202 } // namespace webrtc | 204 } // namespace webrtc |
203 | 205 |
204 #endif // WEBRTC_VOICE_ENGINE_VOE_BASE_H | 206 #endif // WEBRTC_VOICE_ENGINE_VOE_BASE_H |
OLD | NEW |