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