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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 delete this; | 58 delete this; |
59 } | 59 } |
60 | 60 |
61 return new_ref; | 61 return new_ref; |
62 } | 62 } |
63 | 63 |
64 std::unique_ptr<voe::ChannelProxy> VoiceEngineImpl::GetChannelProxy( | 64 std::unique_ptr<voe::ChannelProxy> VoiceEngineImpl::GetChannelProxy( |
65 int channel_id) { | 65 int channel_id) { |
66 RTC_DCHECK(channel_id >= 0); | 66 RTC_DCHECK(channel_id >= 0); |
67 rtc::CritScope cs(crit_sec()); | 67 rtc::CritScope cs(crit_sec()); |
68 RTC_DCHECK(statistics().Initialized()); | |
69 return std::unique_ptr<voe::ChannelProxy>( | 68 return std::unique_ptr<voe::ChannelProxy>( |
70 new voe::ChannelProxy(channel_manager().GetChannel(channel_id))); | 69 new voe::ChannelProxy(channel_manager().GetChannel(channel_id))); |
71 } | 70 } |
72 | 71 |
73 VoiceEngine* VoiceEngine::Create() { | 72 VoiceEngine* VoiceEngine::Create() { |
74 return GetVoiceEngine(); | 73 return GetVoiceEngine(); |
75 } | 74 } |
76 | 75 |
77 bool VoiceEngine::Delete(VoiceEngine*& voiceEngine) { | 76 bool VoiceEngine::Delete(VoiceEngine*& voiceEngine) { |
78 if (voiceEngine == NULL) | 77 if (voiceEngine == NULL) |
79 return false; | 78 return false; |
80 | 79 |
81 VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine); | 80 VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine); |
82 // Release the reference that was added in GetVoiceEngine. | 81 // Release the reference that was added in GetVoiceEngine. |
83 int ref = s->Release(); | 82 int ref = s->Release(); |
84 voiceEngine = NULL; | 83 voiceEngine = NULL; |
85 | 84 |
86 if (ref != 0) { | 85 if (ref != 0) { |
87 WEBRTC_TRACE( | 86 WEBRTC_TRACE( |
88 kTraceWarning, kTraceVoice, -1, | 87 kTraceWarning, kTraceVoice, -1, |
89 "VoiceEngine::Delete did not release the very last reference. " | 88 "VoiceEngine::Delete did not release the very last reference. " |
90 "%d references remain.", | 89 "%d references remain.", |
91 ref); | 90 ref); |
92 } | 91 } |
93 | 92 |
94 return true; | 93 return true; |
95 } | 94 } |
96 } // namespace webrtc | 95 } // namespace webrtc |
OLD | NEW |