| 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 11 matching lines...) Expand all Loading... |
| 22 #include "webrtc/voice_engine/voice_engine_impl.h" | 22 #include "webrtc/voice_engine/voice_engine_impl.h" |
| 23 | 23 |
| 24 namespace webrtc { | 24 namespace webrtc { |
| 25 | 25 |
| 26 // Counter to be ensure that we can add a correct ID in all static trace | 26 // Counter to be ensure that we can add a correct ID in all static trace |
| 27 // methods. It is not the nicest solution, especially not since we already | 27 // methods. It is not the nicest solution, especially not since we already |
| 28 // have a counter in VoEBaseImpl. In other words, there is room for | 28 // have a counter in VoEBaseImpl. In other words, there is room for |
| 29 // improvement here. | 29 // improvement here. |
| 30 static int32_t gVoiceEngineInstanceCounter = 0; | 30 static int32_t gVoiceEngineInstanceCounter = 0; |
| 31 | 31 |
| 32 VoiceEngine* GetVoiceEngine(const Config* config, bool owns_config) { | 32 VoiceEngine* GetVoiceEngine() { |
| 33 VoiceEngineImpl* self = new VoiceEngineImpl(config, owns_config); | 33 VoiceEngineImpl* self = new VoiceEngineImpl(); |
| 34 if (self != NULL) { | 34 if (self != NULL) { |
| 35 self->AddRef(); // First reference. Released in VoiceEngine::Delete. | 35 self->AddRef(); // First reference. Released in VoiceEngine::Delete. |
| 36 gVoiceEngineInstanceCounter++; | 36 gVoiceEngineInstanceCounter++; |
| 37 } | 37 } |
| 38 return self; | 38 return self; |
| 39 } | 39 } |
| 40 | 40 |
| 41 int VoiceEngineImpl::AddRef() { | 41 int VoiceEngineImpl::AddRef() { |
| 42 return ++_ref_count; | 42 return ++_ref_count; |
| 43 } | 43 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 65 std::unique_ptr<voe::ChannelProxy> VoiceEngineImpl::GetChannelProxy( | 65 std::unique_ptr<voe::ChannelProxy> VoiceEngineImpl::GetChannelProxy( |
| 66 int channel_id) { | 66 int channel_id) { |
| 67 RTC_DCHECK(channel_id >= 0); | 67 RTC_DCHECK(channel_id >= 0); |
| 68 rtc::CritScope cs(crit_sec()); | 68 rtc::CritScope cs(crit_sec()); |
| 69 RTC_DCHECK(statistics().Initialized()); | 69 RTC_DCHECK(statistics().Initialized()); |
| 70 return std::unique_ptr<voe::ChannelProxy>( | 70 return std::unique_ptr<voe::ChannelProxy>( |
| 71 new voe::ChannelProxy(channel_manager().GetChannel(channel_id))); | 71 new voe::ChannelProxy(channel_manager().GetChannel(channel_id))); |
| 72 } | 72 } |
| 73 | 73 |
| 74 VoiceEngine* VoiceEngine::Create() { | 74 VoiceEngine* VoiceEngine::Create() { |
| 75 Config* config = new Config(); | 75 return GetVoiceEngine(); |
| 76 return GetVoiceEngine(config, true); | |
| 77 } | |
| 78 | |
| 79 VoiceEngine* VoiceEngine::Create(const Config& config) { | |
| 80 return GetVoiceEngine(&config, false); | |
| 81 } | 76 } |
| 82 | 77 |
| 83 int VoiceEngine::SetTraceFilter(unsigned int filter) { | 78 int VoiceEngine::SetTraceFilter(unsigned int filter) { |
| 84 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, | 79 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, |
| 85 VoEId(gVoiceEngineInstanceCounter, -1), | 80 VoEId(gVoiceEngineInstanceCounter, -1), |
| 86 "SetTraceFilter(filter=0x%x)", filter); | 81 "SetTraceFilter(filter=0x%x)", filter); |
| 87 | 82 |
| 88 // Remember old filter | 83 // Remember old filter |
| 89 uint32_t oldFilter = Trace::level_filter(); | 84 uint32_t oldFilter = Trace::level_filter(); |
| 90 Trace::set_level_filter(filter); | 85 Trace::set_level_filter(filter); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 144 |
| 150 std::string VoiceEngine::GetVersionString() { | 145 std::string VoiceEngine::GetVersionString() { |
| 151 std::string version = "VoiceEngine 4.1.0"; | 146 std::string version = "VoiceEngine 4.1.0"; |
| 152 #ifdef WEBRTC_EXTERNAL_TRANSPORT | 147 #ifdef WEBRTC_EXTERNAL_TRANSPORT |
| 153 version += " (External transport build)"; | 148 version += " (External transport build)"; |
| 154 #endif | 149 #endif |
| 155 return version; | 150 return version; |
| 156 } | 151 } |
| 157 | 152 |
| 158 } // namespace webrtc | 153 } // namespace webrtc |
| OLD | NEW |