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 |
11 #include "webrtc/voice_engine/voe_neteq_stats_impl.h" | 11 #include "webrtc/voice_engine/voe_neteq_stats_impl.h" |
12 | 12 |
13 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" | 13 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" |
14 #include "webrtc/system_wrappers/include/trace.h" | 14 #include "webrtc/system_wrappers/include/trace.h" |
15 #include "webrtc/voice_engine/channel.h" | 15 #include "webrtc/voice_engine/channel.h" |
16 #include "webrtc/voice_engine/include/voe_errors.h" | 16 #include "webrtc/voice_engine/include/voe_errors.h" |
17 #include "webrtc/voice_engine/voice_engine_impl.h" | 17 #include "webrtc/voice_engine/voice_engine_impl.h" |
18 | 18 |
19 namespace webrtc { | 19 namespace webrtc { |
20 | 20 |
21 VoENetEqStats* VoENetEqStats::GetInterface(VoiceEngine* voiceEngine) { | 21 VoENetEqStats* VoENetEqStats::GetInterface(VoiceEngine* voiceEngine) { |
22 if (NULL == voiceEngine) { | 22 if (nullptr == voiceEngine) { |
23 return NULL; | 23 return nullptr; |
24 } | 24 } |
25 VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine); | 25 VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine); |
26 s->AddRef(); | 26 s->AddRef(); |
27 return s; | 27 return s; |
28 } | 28 } |
29 | 29 |
30 VoENetEqStatsImpl::VoENetEqStatsImpl(voe::SharedData* shared) | 30 VoENetEqStatsImpl::VoENetEqStatsImpl(voe::SharedData* shared) |
31 : _shared(shared) { | 31 : _shared(shared) { |
32 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), | 32 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), |
33 "VoENetEqStatsImpl::VoENetEqStatsImpl() - ctor"); | 33 "VoENetEqStatsImpl::VoENetEqStatsImpl() - ctor"); |
34 } | 34 } |
35 | 35 |
36 VoENetEqStatsImpl::~VoENetEqStatsImpl() { | 36 VoENetEqStatsImpl::~VoENetEqStatsImpl() { |
37 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), | 37 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), |
38 "VoENetEqStatsImpl::~VoENetEqStatsImpl() - dtor"); | 38 "VoENetEqStatsImpl::~VoENetEqStatsImpl() - dtor"); |
39 } | 39 } |
40 | 40 |
41 int VoENetEqStatsImpl::GetNetworkStatistics(int channel, | 41 int VoENetEqStatsImpl::GetNetworkStatistics(int channel, |
42 NetworkStatistics& stats) { | 42 NetworkStatistics& stats) { |
43 if (!_shared->statistics().Initialized()) { | 43 if (!_shared->statistics().Initialized()) { |
44 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 44 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
45 return -1; | 45 return -1; |
46 } | 46 } |
47 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 47 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
48 voe::Channel* channelPtr = ch.channel(); | 48 voe::Channel* channelPtr = ch.channel(); |
49 if (channelPtr == NULL) { | 49 if (channelPtr == nullptr) { |
50 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 50 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
51 "GetNetworkStatistics() failed to locate channel"); | 51 "GetNetworkStatistics() failed to locate channel"); |
52 return -1; | 52 return -1; |
53 } | 53 } |
54 | 54 |
55 return channelPtr->GetNetworkStatistics(stats); | 55 return channelPtr->GetNetworkStatistics(stats); |
56 } | 56 } |
57 | 57 |
58 int VoENetEqStatsImpl::GetDecodingCallStatistics( | 58 int VoENetEqStatsImpl::GetDecodingCallStatistics( |
59 int channel, AudioDecodingCallStats* stats) const { | 59 int channel, AudioDecodingCallStats* stats) const { |
60 if (!_shared->statistics().Initialized()) { | 60 if (!_shared->statistics().Initialized()) { |
61 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 61 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
62 return -1; | 62 return -1; |
63 } | 63 } |
64 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 64 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
65 voe::Channel* channelPtr = ch.channel(); | 65 voe::Channel* channelPtr = ch.channel(); |
66 if (channelPtr == NULL) { | 66 if (channelPtr == nullptr) { |
67 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 67 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
68 "GetDecodingCallStatistics() failed to locate " | 68 "GetDecodingCallStatistics() failed to locate " |
69 "channel"); | 69 "channel"); |
70 return -1; | 70 return -1; |
71 } | 71 } |
72 | 72 |
73 channelPtr->GetDecodingCallStatistics(stats); | 73 channelPtr->GetDecodingCallStatistics(stats); |
74 return 0; | 74 return 0; |
75 } | 75 } |
76 | 76 |
77 } // namespace webrtc | 77 } // namespace webrtc |
OLD | NEW |