summaryrefslogtreecommitdiff
path: root/voice_engine/voice_engine_impl.cc
diff options
context:
space:
mode:
authorminyue@webrtc.org <minyue@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2013-09-12 17:03:00 +0000
committerminyue@webrtc.org <minyue@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2013-09-12 17:03:00 +0000
commit4489c51faaf5b7e9f8845c5fb661f6ae91f7da48 (patch)
tree6a21867a3a7578e9a35451dea75bc03b0a55cd76 /voice_engine/voice_engine_impl.cc
parent66bfae29aeb1ebbddac83471da9e1305a7edaf73 (diff)
downloadwebrtc-4489c51faaf5b7e9f8845c5fb661f6ae91f7da48.tar.gz
This issue is related to
https://chromereviews.googleplex.com/9908014/ I was thinking about shipping ACM2 from the signal repository. There seems to be too many changes in one CL. BUG= R=andrew@webrtc.org, turaj@webrtc.org, xians@webrtc.org Review URL: https://webrtc-codereview.appspot.com/2171004 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@4733 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'voice_engine/voice_engine_impl.cc')
-rw-r--r--voice_engine/voice_engine_impl.cc49
1 files changed, 26 insertions, 23 deletions
diff --git a/voice_engine/voice_engine_impl.cc b/voice_engine/voice_engine_impl.cc
index 4c923ebc..703b6a44 100644
--- a/voice_engine/voice_engine_impl.cc
+++ b/voice_engine/voice_engine_impl.cc
@@ -16,6 +16,7 @@
#endif
#endif
+#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h"
#include "webrtc/system_wrappers/interface/trace.h"
#include "webrtc/voice_engine/voice_engine_impl.h"
@@ -28,13 +29,26 @@ namespace webrtc
// improvement here.
static int32_t gVoiceEngineInstanceCounter = 0;
-extern "C"
+VoiceEngine* GetVoiceEngine(const Config* config, bool owns_config)
{
-WEBRTC_DLLEXPORT VoiceEngine* GetVoiceEngine();
+#if (defined _WIN32)
+ HMODULE hmod = LoadLibrary(TEXT("VoiceEngineTestingDynamic.dll"));
+
+ if (hmod) {
+ typedef VoiceEngine* (*PfnGetVoiceEngine)(void);
+ PfnGetVoiceEngine pfn = (PfnGetVoiceEngine)GetProcAddress(
+ hmod,"GetVoiceEngine");
+ if (pfn) {
+ VoiceEngine* self = pfn();
+ if (owns_config) {
+ delete config;
+ }
+ return (self);
+ }
+ }
+#endif
-VoiceEngine* GetVoiceEngine()
-{
- VoiceEngineImpl* self = new VoiceEngineImpl();
+ VoiceEngineImpl* self = new VoiceEngineImpl(config, owns_config);
if (self != NULL)
{
self->AddRef(); // First reference. Released in VoiceEngine::Delete.
@@ -42,7 +56,6 @@ VoiceEngine* GetVoiceEngine()
}
return self;
}
-} // extern "C"
int VoiceEngineImpl::AddRef() {
return ++_ref_count;
@@ -63,25 +76,15 @@ int VoiceEngineImpl::Release() {
return new_ref;
}
-VoiceEngine* VoiceEngine::Create()
-{
-#if (defined _WIN32)
- HMODULE hmod_ = LoadLibrary(TEXT("VoiceEngineTestingDynamic.dll"));
+VoiceEngine* VoiceEngine::Create() {
+ Config* config = new Config();
+ config->Set<AudioCodingModuleFactory>(new AudioCodingModuleFactory());
- if (hmod_)
- {
- typedef VoiceEngine* (*PfnGetVoiceEngine)(void);
- PfnGetVoiceEngine pfn = (PfnGetVoiceEngine)GetProcAddress(
- hmod_,"GetVoiceEngine");
- if (pfn)
- {
- VoiceEngine* self = pfn();
- return (self);
- }
- }
-#endif
+ return GetVoiceEngine(config, true);
+}
- return GetVoiceEngine();
+VoiceEngine* VoiceEngine::Create(const Config& config) {
+ return GetVoiceEngine(&config, false);
}
int VoiceEngine::SetTraceFilter(unsigned int filter)