diff options
author | tnakamura@webrtc.org <tnakamura@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-07-16 19:25:04 +0000 |
---|---|---|
committer | tnakamura@webrtc.org <tnakamura@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-07-16 19:25:04 +0000 |
commit | 0ba496bf33feea212277927f212b4b02556c8f8b (patch) | |
tree | eabccaba985d5ee504a512dde757988fe73f8a0e /voice_engine/voe_network_impl.cc | |
parent | 2eb721ebb84bca84978adaa024a2c09eb9a3b923 (diff) | |
download | webrtc-0ba496bf33feea212277927f212b4b02556c8f8b.tar.gz |
Revert r4301
R=mikhal@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/1809004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@4357 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'voice_engine/voe_network_impl.cc')
-rw-r--r-- | voice_engine/voe_network_impl.cc | 154 |
1 files changed, 154 insertions, 0 deletions
diff --git a/voice_engine/voe_network_impl.cc b/voice_engine/voe_network_impl.cc index ee875627..62521706 100644 --- a/voice_engine/voe_network_impl.cc +++ b/voice_engine/voe_network_impl.cc @@ -165,4 +165,158 @@ int VoENetworkImpl::ReceivedRTCPPacket(int channel, const void* data, } return channelPtr->ReceivedRTCPPacket((const int8_t*) data, length); } + +int VoENetworkImpl::SetPacketTimeoutNotification(int channel, + bool enable, + int timeoutSeconds) +{ + WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), + "SetPacketTimeoutNotification(channel=%d, enable=%d, " + "timeoutSeconds=%d)", + channel, (int) enable, timeoutSeconds); + if (!_shared->statistics().Initialized()) + { + _shared->SetLastError(VE_NOT_INITED, kTraceError); + return -1; + } + if (enable && + ((timeoutSeconds < kVoiceEngineMinPacketTimeoutSec) || + (timeoutSeconds > kVoiceEngineMaxPacketTimeoutSec))) + { + _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError, + "SetPacketTimeoutNotification() invalid timeout size"); + return -1; + } + voe::ScopedChannel sc(_shared->channel_manager(), channel); + voe::Channel* channelPtr = sc.ChannelPtr(); + if (channelPtr == NULL) + { + _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, + "SetPacketTimeoutNotification() failed to locate channel"); + return -1; + } + return channelPtr->SetPacketTimeoutNotification(enable, timeoutSeconds); +} + +int VoENetworkImpl::GetPacketTimeoutNotification(int channel, + bool& enabled, + int& timeoutSeconds) +{ + WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), + "GetPacketTimeoutNotification(channel=%d, enabled=?," + " timeoutSeconds=?)", channel); + if (!_shared->statistics().Initialized()) + { + _shared->SetLastError(VE_NOT_INITED, kTraceError); + return -1; + } + voe::ScopedChannel sc(_shared->channel_manager(), channel); + voe::Channel* channelPtr = sc.ChannelPtr(); + if (channelPtr == NULL) + { + _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, + "GetPacketTimeoutNotification() failed to locate channel"); + return -1; + } + return channelPtr->GetPacketTimeoutNotification(enabled, timeoutSeconds); +} + +int VoENetworkImpl::RegisterDeadOrAliveObserver(int channel, + VoEConnectionObserver& + observer) +{ + WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), + "RegisterDeadOrAliveObserver(channel=%d, observer=0x%x)", + channel, &observer); + if (!_shared->statistics().Initialized()) + { + _shared->SetLastError(VE_NOT_INITED, kTraceError); + return -1; + } + voe::ScopedChannel sc(_shared->channel_manager(), channel); + voe::Channel* channelPtr = sc.ChannelPtr(); + if (channelPtr == NULL) + { + _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, + "RegisterDeadOrAliveObserver() failed to locate channel"); + return -1; + } + return channelPtr->RegisterDeadOrAliveObserver(observer); +} + +int VoENetworkImpl::DeRegisterDeadOrAliveObserver(int channel) +{ + WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), + "DeRegisterDeadOrAliveObserver(channel=%d)", channel); + if (!_shared->statistics().Initialized()) + { + _shared->SetLastError(VE_NOT_INITED, kTraceError); + return -1; + } + voe::ScopedChannel sc(_shared->channel_manager(), channel); + voe::Channel* channelPtr = sc.ChannelPtr(); + if (channelPtr == NULL) + { + _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, + "DeRegisterDeadOrAliveObserver() failed to locate channel"); + return -1; + } + return channelPtr->DeRegisterDeadOrAliveObserver(); +} + +int VoENetworkImpl::SetPeriodicDeadOrAliveStatus(int channel, bool enable, + int sampleTimeSeconds) +{ + WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), + "SetPeriodicDeadOrAliveStatus(channel=%d, enable=%d," + " sampleTimeSeconds=%d)", + channel, enable, sampleTimeSeconds); + if (!_shared->statistics().Initialized()) + { + _shared->SetLastError(VE_NOT_INITED, kTraceError); + return -1; + } + if (enable && + ((sampleTimeSeconds < kVoiceEngineMinSampleTimeSec) || + (sampleTimeSeconds > kVoiceEngineMaxSampleTimeSec))) + { + _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError, + "SetPeriodicDeadOrAliveStatus() invalid sample time"); + return -1; + } + voe::ScopedChannel sc(_shared->channel_manager(), channel); + voe::Channel* channelPtr = sc.ChannelPtr(); + if (channelPtr == NULL) + { + _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, + "SetPeriodicDeadOrAliveStatus() failed to locate channel"); + return -1; + } + return channelPtr->SetPeriodicDeadOrAliveStatus(enable, sampleTimeSeconds); +} + +int VoENetworkImpl::GetPeriodicDeadOrAliveStatus(int channel, + bool& enabled, + int& sampleTimeSeconds) +{ + WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), + "GetPeriodicDeadOrAliveStatus(channel=%d, enabled=?," + " sampleTimeSeconds=?)", channel); + if (!_shared->statistics().Initialized()) + { + _shared->SetLastError(VE_NOT_INITED, kTraceError); + return -1; + } + voe::ScopedChannel sc(_shared->channel_manager(), channel); + voe::Channel* channelPtr = sc.ChannelPtr(); + if (channelPtr == NULL) + { + _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, + "GetPeriodicDeadOrAliveStatus() failed to locate channel"); + return -1; + } + return channelPtr->GetPeriodicDeadOrAliveStatus(enabled, + sampleTimeSeconds); +} + } // namespace webrtc |