diff options
author | wu@webrtc.org <wu@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-08-15 23:38:54 +0000 |
---|---|---|
committer | wu@webrtc.org <wu@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-08-15 23:38:54 +0000 |
commit | 7fc75bbb65cc1cd99fdf45d9fce44bcce1396dfa (patch) | |
tree | 604dea40012e66f2a2b22d3637de4ee97d0cb325 /voice_engine | |
parent | 1e817c3d470262a8dc0d7f151feb0519a65e0d26 (diff) | |
download | webrtc-7fc75bbb65cc1cd99fdf45d9fce44bcce1396dfa.tar.gz |
Update talk to 50918584.
Together with Stefan's http://review.webrtc.org/1960004/.
R=mallinath@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/2048004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@4556 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'voice_engine')
-rw-r--r-- | voice_engine/channel.cc | 378 | ||||
-rw-r--r-- | voice_engine/channel.h | 35 | ||||
-rw-r--r-- | voice_engine/include/voe_network.h | 25 | ||||
-rw-r--r-- | voice_engine/include/voe_video_sync.h | 4 | ||||
-rw-r--r-- | voice_engine/test/auto_test/standard/call_report_test.cc | 23 | ||||
-rw-r--r-- | voice_engine/test/auto_test/standard/network_test.cc | 94 | ||||
-rw-r--r-- | voice_engine/test/auto_test/voe_extended_test.cc | 228 | ||||
-rw-r--r-- | voice_engine/voe_network_impl.cc | 154 | ||||
-rw-r--r-- | voice_engine/voe_network_impl.h | 21 | ||||
-rw-r--r-- | voice_engine/voe_video_sync_impl.cc | 5 | ||||
-rw-r--r-- | voice_engine/voe_video_sync_impl.h | 3 |
11 files changed, 174 insertions, 796 deletions
diff --git a/voice_engine/channel.cc b/voice_engine/channel.cc index c9f4b8a8..f8f8bd2c 100644 --- a/voice_engine/channel.cc +++ b/voice_engine/channel.cc @@ -12,6 +12,10 @@ #include "webrtc/modules/audio_device/include/audio_device.h" #include "webrtc/modules/audio_processing/include/audio_processing.h" +#include "webrtc/modules/rtp_rtcp/interface/receive_statistics.h" +#include "webrtc/modules/rtp_rtcp/interface/rtp_payload_registry.h" +#include "webrtc/modules/rtp_rtcp/interface/rtp_receiver.h" +#include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" #include "webrtc/modules/utility/interface/audio_frame_operations.h" #include "webrtc/modules/utility/interface/process_thread.h" #include "webrtc/modules/utility/interface/rtp_dump.h" @@ -367,8 +371,8 @@ Channel::OnIncomingSSRCChanged(int32_t id, assert(channel == _channelId); // Reset RTP-module counters since a new incoming RTP stream is detected - _rtpRtcpModule->ResetReceiveDataCountersRTP(); - _rtpRtcpModule->ResetStatisticsRTP(); + rtp_receive_statistics_->ResetDataCounters(); + rtp_receive_statistics_->ResetStatistics(); if (_rtpObserver) { @@ -404,6 +408,10 @@ void Channel::OnIncomingCSRCChanged(int32_t id, } } +void Channel::ResetStatistics() { + rtp_receive_statistics_->ResetStatistics(); +} + void Channel::OnApplicationDataReceived(int32_t id, uint8_t subType, @@ -629,18 +637,16 @@ Channel::OnReceivedPayloadData(const uint8_t* payloadData, UpdatePacketDelay(rtpHeader->header.timestamp, rtpHeader->header.sequenceNumber); - if (kNackOff != _rtpRtcpModule->NACK()) { // Is NACK on? - uint16_t round_trip_time = 0; - _rtpRtcpModule->RTT(_rtpRtcpModule->RemoteSSRC(), &round_trip_time, - NULL, NULL, NULL); - - std::vector<uint16_t> nack_list = _audioCodingModule.GetNackList( - round_trip_time); - if (!nack_list.empty()) { - // Can't use nack_list.data() since it's not supported by all - // compilers. - ResendPackets(&(nack_list[0]), static_cast<int>(nack_list.size())); - } + uint16_t round_trip_time = 0; + _rtpRtcpModule->RTT(rtp_receiver_->SSRC(), &round_trip_time, + NULL, NULL, NULL); + + std::vector<uint16_t> nack_list = _audioCodingModule.GetNackList( + round_trip_time); + if (!nack_list.empty()) { + // Can't use nack_list.data() since it's not supported by all + // compilers. + ResendPackets(&(nack_list[0]), static_cast<int>(nack_list.size())); } return 0; } @@ -883,6 +889,15 @@ Channel::Channel(int32_t channelId, _instanceId(instanceId), _channelId(channelId), rtp_header_parser_(RtpHeaderParser::Create()), + rtp_payload_registry_( + new RTPPayloadRegistry(channelId, + RTPPayloadStrategy::CreateStrategy(true))), + rtp_receive_statistics_(ReceiveStatistics::Create( + Clock::GetRealTimeClock())), + rtp_receiver_(RtpReceiver::CreateAudioReceiver( + VoEModuleId(instanceId, channelId), Clock::GetRealTimeClock(), this, + this, this, rtp_payload_registry_.get())), + telephone_event_handler_(rtp_receiver_->GetTelephoneEventHandler()), _audioCodingModule(*AudioCodingModule::Create( VoEModuleId(instanceId, channelId))), _rtpDumpIn(*RtpDump::CreateRtpDump()), @@ -983,11 +998,10 @@ Channel::Channel(int32_t channelId, RtpRtcp::Configuration configuration; configuration.id = VoEModuleId(instanceId, channelId); configuration.audio = true; - configuration.incoming_data = this; - configuration.incoming_messages = this; configuration.outgoing_transport = this; configuration.rtcp_feedback = this; configuration.audio_messages = this; + configuration.receive_statistics = rtp_receive_statistics_.get(); _rtpRtcpModule.reset(RtpRtcp::CreateRtpRtcp(configuration)); @@ -1135,12 +1149,9 @@ Channel::Init() // disabled by the user. // After StopListen (when no sockets exists), RTCP packets will no longer // be transmitted since the Transport object will then be invalid. - - const bool rtpRtcpFail = - ((_rtpRtcpModule->SetTelephoneEventForwardToDecoder(true) == -1) || - // RTCP is enabled by default - (_rtpRtcpModule->SetRTCPStatus(kRtcpCompound) == -1)); - if (rtpRtcpFail) + telephone_event_handler_->SetTelephoneEventForwardToDecoder(true); + // RTCP is enabled by default. + if (_rtpRtcpModule->SetRTCPStatus(kRtcpCompound) == -1) { _engineStatisticsPtr->SetLastError( VE_RTP_RTCP_MODULE_ERROR, kTraceError, @@ -1171,7 +1182,12 @@ Channel::Init() { // Open up the RTP/RTCP receiver for all supported codecs if ((_audioCodingModule.Codec(idx, &codec) == -1) || - (_rtpRtcpModule->RegisterReceivePayload(codec) == -1)) + (rtp_receiver_->RegisterReceivePayload( + codec.plname, + codec.pltype, + codec.plfreq, + codec.channels, + (codec.rate < 0) ? 0 : codec.rate) == -1)) { WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,_channelId), @@ -1494,12 +1510,7 @@ Channel::StopReceiving() } // Recover DTMF detection status. - int32_t ret = _rtpRtcpModule->SetTelephoneEventForwardToDecoder(true); - if (ret != 0) { - _engineStatisticsPtr->SetLastError( - VE_INVALID_OPERATION, kTraceWarning, - "StopReceiving() failed to restore telephone-event status."); - } + telephone_event_handler_->SetTelephoneEventForwardToDecoder(true); RegisterReceiveCodecsToRTPModule(); _receiving = false; return 0; @@ -1751,10 +1762,15 @@ Channel::SetRecPayloadType(const CodecInst& codec) CodecInst rxCodec = codec; // Get payload type for the given codec - _rtpRtcpModule->ReceivePayloadType(rxCodec, &pltype); + rtp_payload_registry_->ReceivePayloadType( + rxCodec.plname, + rxCodec.plfreq, + rxCodec.channels, + (rxCodec.rate < 0) ? 0 : rxCodec.rate, + &pltype); rxCodec.pltype = pltype; - if (_rtpRtcpModule->DeRegisterReceivePayload(pltype) != 0) + if (rtp_receiver_->DeRegisterReceivePayload(pltype) != 0) { _engineStatisticsPtr->SetLastError( VE_RTP_RTCP_MODULE_ERROR, @@ -1773,11 +1789,21 @@ Channel::SetRecPayloadType(const CodecInst& codec) return 0; } - if (_rtpRtcpModule->RegisterReceivePayload(codec) != 0) + if (rtp_receiver_->RegisterReceivePayload( + codec.plname, + codec.pltype, + codec.plfreq, + codec.channels, + (codec.rate < 0) ? 0 : codec.rate) != 0) { // First attempt to register failed => de-register and try again - _rtpRtcpModule->DeRegisterReceivePayload(codec.pltype); - if (_rtpRtcpModule->RegisterReceivePayload(codec) != 0) + rtp_receiver_->DeRegisterReceivePayload(codec.pltype); + if (rtp_receiver_->RegisterReceivePayload( + codec.plname, + codec.pltype, + codec.plfreq, + codec.channels, + (codec.rate < 0) ? 0 : codec.rate) != 0) { _engineStatisticsPtr->SetLastError( VE_RTP_RTCP_MODULE_ERROR, kTraceError, @@ -1805,7 +1831,12 @@ Channel::GetRecPayloadType(CodecInst& codec) WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), "Channel::GetRecPayloadType()"); int8_t payloadType(-1); - if (_rtpRtcpModule->ReceivePayloadType(codec, &payloadType) != 0) + if (rtp_payload_registry_->ReceivePayloadType( + codec.plname, + codec.plfreq, + codec.channels, + (codec.rate < 0) ? 0 : codec.rate, + &payloadType) != 0) { _engineStatisticsPtr->SetLastError( VE_RTP_RTCP_MODULE_ERROR, kTraceWarning, @@ -2165,12 +2196,27 @@ int32_t Channel::ReceivedRTPPacket(const int8_t* data, int32_t length) { "IncomingPacket invalid RTP header"); return -1; } + header.payload_type_frequency = + rtp_payload_registry_->GetPayloadTypeFrequency(header.payloadType); + if (header.payload_type_frequency < 0) { + return -1; + } + bool retransmitted = IsPacketRetransmitted(header); + bool in_order = rtp_receiver_->InOrderPacket(header.sequenceNumber); + rtp_receive_statistics_->IncomingPacket(header, static_cast<uint16_t>(length), + retransmitted, in_order); + PayloadUnion payload_specific; + if (!rtp_payload_registry_->GetPayloadSpecifics(header.payloadType, + &payload_specific)) { + return -1; + } // Deliver RTP packet to RTP/RTCP module for parsing // The packet will be pushed back to the channel thru the // OnReceivedPayloadData callback so we don't push it to the ACM here - if (_rtpRtcpModule->IncomingRtpPacket(reinterpret_cast<const uint8_t*>(data), + if (!rtp_receiver_->IncomingRtpPacket(&header, + reinterpret_cast<const uint8_t*>(data), static_cast<uint16_t>(length), - header) == -1) { + payload_specific, in_order)) { _engineStatisticsPtr->SetLastError( VE_SOCKET_TRANSPORT_MODULE_ERROR, kTraceWarning, "Channel::IncomingRTPPacket() RTP packet is invalid"); @@ -2178,6 +2224,24 @@ int32_t Channel::ReceivedRTPPacket(const int8_t* data, int32_t length) { return 0; } +bool Channel::IsPacketRetransmitted(const RTPHeader& header) const { + bool rtx_enabled = false; + uint32_t rtx_ssrc = 0; + int rtx_payload_type = 0; + rtp_receiver_->RTXStatus(&rtx_enabled, &rtx_ssrc, &rtx_payload_type); + if (!rtx_enabled) { + // Check if this is a retransmission. + ReceiveStatistics::RtpReceiveStatistics stats; + if (rtp_receive_statistics_->Statistics(&stats, false)) { + uint16_t min_rtt = 0; + _rtpRtcpModule->RTT(rtp_receiver_->SSRC(), NULL, NULL, &min_rtt, NULL); + return rtp_receiver_->RetransmitOfOldPacket(header, stats.jitter, + min_rtt); + } + } + return false; +} + int32_t Channel::ReceivedRTCPPacket(const int8_t* data, int32_t length) { WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,_channelId), "Channel::ReceivedRTCPPacket()"); @@ -2202,141 +2266,6 @@ int32_t Channel::ReceivedRTCPPacket(const int8_t* data, int32_t length) { return 0; } -int32_t -Channel::SetPacketTimeoutNotification(bool enable, int timeoutSeconds) -{ - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), - "Channel::SetPacketTimeoutNotification()"); - if (enable) - { - const uint32_t RTPtimeoutMS = 1000*timeoutSeconds; - const uint32_t RTCPtimeoutMS = 0; - _rtpRtcpModule->SetPacketTimeout(RTPtimeoutMS, RTCPtimeoutMS); - _rtpPacketTimeOutIsEnabled = true; - _rtpTimeOutSeconds = timeoutSeconds; - } - else - { - _rtpRtcpModule->SetPacketTimeout(0, 0); - _rtpPacketTimeOutIsEnabled = false; - _rtpTimeOutSeconds = 0; - } - return 0; -} - -int32_t -Channel::GetPacketTimeoutNotification(bool& enabled, int& timeoutSeconds) -{ - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), - "Channel::GetPacketTimeoutNotification()"); - enabled = _rtpPacketTimeOutIsEnabled; - if (enabled) - { - timeoutSeconds = _rtpTimeOutSeconds; - } - WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId,-1), - "GetPacketTimeoutNotification() => enabled=%d," - " timeoutSeconds=%d", - enabled, timeoutSeconds); - return 0; -} - -int32_t -Channel::RegisterDeadOrAliveObserver(VoEConnectionObserver& observer) -{ - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), - "Channel::RegisterDeadOrAliveObserver()"); - CriticalSectionScoped cs(&_callbackCritSect); - - if (_connectionObserverPtr) - { - _engineStatisticsPtr->SetLastError(VE_INVALID_OPERATION, kTraceError, - "RegisterDeadOrAliveObserver() observer already enabled"); - return -1; - } - - _connectionObserverPtr = &observer; - _connectionObserver = true; - - return 0; -} - -int32_t -Channel::DeRegisterDeadOrAliveObserver() -{ - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), - "Channel::DeRegisterDeadOrAliveObserver()"); - CriticalSectionScoped cs(&_callbackCritSect); - - if (!_connectionObserverPtr) - { - _engineStatisticsPtr->SetLastError( - VE_INVALID_OPERATION, kTraceWarning, - "DeRegisterDeadOrAliveObserver() observer already disabled"); - return 0; - } - - _connectionObserver = false; - _connectionObserverPtr = NULL; - - return 0; -} - -int32_t -Channel::SetPeriodicDeadOrAliveStatus(bool enable, int sampleTimeSeconds) -{ - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), - "Channel::SetPeriodicDeadOrAliveStatus()"); - if (!_connectionObserverPtr) - { - WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,_channelId), - "SetPeriodicDeadOrAliveStatus() connection observer has" - " not been registered"); - } - if (enable) - { - ResetDeadOrAliveCounters(); - } - bool enabled(false); - uint8_t currentSampleTimeSec(0); - // Store last state (will be used later if dead-or-alive is disabled). - _rtpRtcpModule->PeriodicDeadOrAliveStatus(enabled, currentSampleTimeSec); - // Update the dead-or-alive state. - if (_rtpRtcpModule->SetPeriodicDeadOrAliveStatus( - enable, (uint8_t)sampleTimeSeconds) != 0) - { - _engineStatisticsPtr->SetLastError( - VE_RTP_RTCP_MODULE_ERROR, - kTraceError, - "SetPeriodicDeadOrAliveStatus() failed to set dead-or-alive " - "status"); - return -1; - } - if (!enable) - { - // Restore last utilized sample time. - // Without this, the sample time would always be reset to default - // (2 sec), each time dead-or-alived was disabled without sample-time - // parameter. - _rtpRtcpModule->SetPeriodicDeadOrAliveStatus(enable, - currentSampleTimeSec); - } - return 0; -} - -int32_t -Channel::GetPeriodicDeadOrAliveStatus(bool& enabled, int& sampleTimeSeconds) -{ - _rtpRtcpModule->PeriodicDeadOrAliveStatus( - enabled, - (uint8_t&)sampleTimeSeconds); - WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId,-1), - "GetPeriodicDeadOrAliveStatus() => enabled=%d," - " sampleTimeSeconds=%d", - enabled, sampleTimeSeconds); - return 0; -} - int Channel::StartPlayingFileLocally(const char* fileName, bool loop, FileFormats format, @@ -3145,8 +3074,8 @@ Channel::DeRegisterExternalEncryption() } int Channel::SendTelephoneEventOutband(unsigned char eventCode, - int lengthMs, int attenuationDb, - bool playDtmfEvent) + int lengthMs, int attenuationDb, + bool playDtmfEvent) { WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), "Channel::SendTelephoneEventOutband(..., playDtmfEvent=%d)", @@ -3675,7 +3604,7 @@ Channel::GetLocalSSRC(unsigned int& ssrc) int Channel::GetRemoteSSRC(unsigned int& ssrc) { - ssrc = _rtpRtcpModule->RemoteSSRC(); + ssrc = rtp_receiver_->SSRC(); WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId,_channelId), "GetRemoteSSRC() => ssrc=%lu", ssrc); @@ -3823,7 +3752,7 @@ Channel::GetRemoteRTCP_CNAME(char cName[256]) return -1; } char cname[RTCP_CNAME_SIZE]; - const uint32_t remoteSSRC = _rtpRtcpModule->RemoteSSRC(); + const uint32_t remoteSSRC = rtp_receiver_->SSRC(); if (_rtpRtcpModule->RemoteCNAME(remoteSSRC, cname) != 0) { _engineStatisticsPtr->SetLastError( @@ -3898,7 +3827,7 @@ Channel::GetRemoteRTCPData( return -1; } - uint32_t remoteSSRC = _rtpRtcpModule->RemoteSSRC(); + uint32_t remoteSSRC = rtp_receiver_->SSRC(); std::vector<RTCPReportBlock>::const_iterator it = remote_stats.begin(); for (; it != remote_stats.end(); ++it) { if (it->remoteSSRC == remoteSSRC) @@ -3990,24 +3919,15 @@ Channel::GetRTPStatistics( unsigned int& maxJitterMs, unsigned int& discardedPackets) { - uint8_t fraction_lost(0); - uint32_t cum_lost(0); - uint32_t ext_max(0); - uint32_t jitter(0); - uint32_t max_jitter(0); - // The jitter statistics is updated for each received RTP packet and is // based on received packets. - if (_rtpRtcpModule->StatisticsRTP(&fraction_lost, - &cum_lost, - &ext_max, - &jitter, - &max_jitter) != 0) - { - _engineStatisticsPtr->SetLastError( - VE_CANNOT_RETRIEVE_RTP_STAT, kTraceWarning, - "GetRTPStatistics() failed to read RTP statistics from the " - "RTP/RTCP module"); + ReceiveStatistics::RtpReceiveStatistics statistics; + if (!rtp_receive_statistics_->Statistics( + &statistics, _rtpRtcpModule->RTCP() == kRtcpOff)) { + _engineStatisticsPtr->SetLastError( + VE_CANNOT_RETRIEVE_RTP_STAT, kTraceWarning, + "GetRTPStatistics() failed to read RTP statistics from the " + "RTP/RTCP module"); } const int32_t playoutFrequency = @@ -4015,8 +3935,8 @@ Channel::GetRTPStatistics( if (playoutFrequency > 0) { // Scale RTP statistics given the current playout frequency - maxJitterMs = max_jitter / (playoutFrequency / 1000); - averageJitterMs = jitter / (playoutFrequency / 1000); + maxJitterMs = statistics.max_jitter / (playoutFrequency / 1000); + averageJitterMs = statistics.jitter / (playoutFrequency / 1000); } discardedPackets = _numberOfDiscardedPackets; @@ -4092,32 +4012,23 @@ int Channel::GetRemoteRTCPReportBlocks( int Channel::GetRTPStatistics(CallStatistics& stats) { - uint8_t fraction_lost(0); - uint32_t cum_lost(0); - uint32_t ext_max(0); - uint32_t jitter(0); - uint32_t max_jitter(0); - // --- Part one of the final structure (four values) // The jitter statistics is updated for each received RTP packet and is // based on received packets. - if (_rtpRtcpModule->StatisticsRTP(&fraction_lost, - &cum_lost, - &ext_max, - &jitter, - &max_jitter) != 0) - { - _engineStatisticsPtr->SetLastError( - VE_CANNOT_RETRIEVE_RTP_STAT, kTraceWarning, - "GetRTPStatistics() failed to read RTP statistics from the " - "RTP/RTCP module"); + ReceiveStatistics::RtpReceiveStatistics statistics; + if (!rtp_receive_statistics_->Statistics( + &statistics, _rtpRtcpModule->RTCP() == kRtcpOff)) { + _engineStatisticsPtr->SetLastError( + VE_CANNOT_RETRIEVE_RTP_STAT, kTraceWarning, + "GetRTPStatistics() failed to read RTP statistics from the " + "RTP/RTCP module"); } - stats.fractionLost = fraction_lost; - stats.cumulativeLost = cum_lost; - stats.extendedMax = ext_max; - stats.jitterSamples = jitter; + stats.fractionLost = statistics.fraction_lost; + stats.cumulativeLost = statistics.cumulative_lost; + stats.extendedMax = statistics.extended_max_sequence_number; + stats.jitterSamples = statistics.jitter; WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId, _channelId), @@ -4139,7 +4050,7 @@ Channel::GetRTPStatistics(CallStatistics& stats) } else { // The remote SSRC will be zero if no RTP packet has been received. - uint32_t remoteSSRC = _rtpRtcpModule->RemoteSSRC(); + uint32_t remoteSSRC = rtp_receiver_->SSRC(); if (remoteSSRC > 0) { uint16_t avgRTT(0); @@ -4176,10 +4087,10 @@ Channel::GetRTPStatistics(CallStatistics& stats) uint32_t bytesReceived(0); uint32_t packetsReceived(0); + rtp_receive_statistics_->GetDataCounters(&bytesReceived, &packetsReceived); + if (_rtpRtcpModule->DataCountersRTP(&bytesSent, - &packetsSent, - &bytesReceived, - &packetsReceived) != 0) + &packetsSent) != 0) { WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), @@ -4261,8 +4172,8 @@ Channel::GetFECStatus(bool& enabled, int& redPayloadtype) void Channel::SetNACKStatus(bool enable, int maxNumberOfPackets) { // None of these functions can fail. _rtpRtcpModule->SetStorePacketsStatus(enable, maxNumberOfPackets); - _rtpRtcpModule->SetNACKStatus(enable ? kNackRtcp : kNackOff, - maxNumberOfPackets); + rtp_receiver_->SetNACKStatus(enable ? kNackRtcp : kNackOff, + maxNumberOfPackets); if (enable) _audioCodingModule.EnableNack(maxNumberOfPackets); else @@ -4702,7 +4613,7 @@ Channel::ResetRTCPStatistics() WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), "Channel::ResetRTCPStatistics()"); uint32_t remoteSSRC(0); - remoteSSRC = _rtpRtcpModule->RemoteSSRC(); + remoteSSRC = rtp_receiver_->SSRC(); return _rtpRtcpModule->ResetRTT(remoteSSRC); } @@ -4731,7 +4642,7 @@ Channel::GetRoundTripTimeSummary(StatVal& delaysMs) const uint16_t maxRTT; uint16_t minRTT; // The remote SSRC will be zero if no RTP packet has been received. - remoteSSRC = _rtpRtcpModule->RemoteSSRC(); + remoteSSRC = rtp_receiver_->SSRC(); if (remoteSSRC == 0) { WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,_channelId), @@ -4941,11 +4852,12 @@ Channel::SetInitSequenceNumber(short sequenceNumber) } int -Channel::GetRtpRtcp(RtpRtcp* &rtpRtcpModule) const +Channel::GetRtpRtcp(RtpRtcp** rtpRtcpModule, RtpReceiver** rtp_receiver) const { WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), "Channel::GetRtpRtcp()"); - rtpRtcpModule = _rtpRtcpModule.get(); + *rtpRtcpModule = _rtpRtcpModule.get(); + *rtp_receiver = rtp_receiver_.get(); return 0; } @@ -5165,15 +5077,6 @@ Channel::UpdateDeadOrAliveCounters(bool alive) int Channel::GetDeadOrAliveCounters(int& countDead, int& countAlive) const { - bool enabled; - uint8_t timeSec; - - _rtpRtcpModule->PeriodicDeadOrAliveStatus(enabled, timeSec); - if (!enabled) - return (-1); - - countDead = static_cast<int> (_countDeadDetections); - countAlive = static_cast<int> (_countAliveDetections); return 0; } @@ -5273,7 +5176,12 @@ Channel::RegisterReceiveCodecsToRTPModule() { // Open up the RTP/RTCP receiver for all supported codecs if ((_audioCodingModule.Codec(idx, &codec) == -1) || - (_rtpRtcpModule->RegisterReceivePayload(codec) == -1)) + (rtp_receiver_->RegisterReceivePayload( + codec.plname, + codec.pltype, + codec.plfreq, + codec.channels, + (codec.rate < 0) ? 0 : codec.rate) == -1)) { WEBRTC_TRACE( kTraceWarning, diff --git a/voice_engine/channel.h b/voice_engine/channel.h index eb08b353..f88dca47 100644 --- a/voice_engine/channel.h +++ b/voice_engine/channel.h @@ -35,16 +35,21 @@ namespace webrtc { -class CriticalSectionWrapper; -class ProcessThread; class AudioDeviceModule; -class RtpRtcp; +class CriticalSectionWrapper; class FileWrapper; +class ProcessThread; +class ReceiveStatistics; class RtpDump; -class VoiceEngineObserver; +class RTPPayloadRegistry; +class RtpReceiver; +class RTPReceiverAudio; +class RtpRtcp; +class TelephoneEventHandler; class VoEMediaProcess; -class VoERTPObserver; class VoERTCPObserver; +class VoERTPObserver; +class VoiceEngineObserver; struct CallStatistics; struct ReportBlock; @@ -133,12 +138,6 @@ public: int32_t DeRegisterExternalTransport(); int32_t ReceivedRTPPacket(const int8_t* data, int32_t length); int32_t ReceivedRTCPPacket(const int8_t* data, int32_t length); - int32_t SetPacketTimeoutNotification(bool enable, int timeoutSeconds); - int32_t GetPacketTimeoutNotification(bool& enabled, int& timeoutSeconds); - int32_t RegisterDeadOrAliveObserver(VoEConnectionObserver& observer); - int32_t DeRegisterDeadOrAliveObserver(); - int32_t SetPeriodicDeadOrAliveStatus(bool enable, int sampleTimeSeconds); - int32_t GetPeriodicDeadOrAliveStatus(bool& enabled, int& sampleTimeSeconds); // VoEFile int StartPlayingFileLocally(const char* fileName, bool loop, @@ -215,7 +214,7 @@ public: int SetInitSequenceNumber(short sequenceNumber); // VoEVideoSyncExtended - int GetRtpRtcp(RtpRtcp* &rtpRtcpModule) const; + int GetRtpRtcp(RtpRtcp** rtpRtcpModule, RtpReceiver** rtp_receiver) const; // VoEEncryption int RegisterExternalEncryption(Encryption& encryption); @@ -307,6 +306,11 @@ public: uint16_t payloadSize, const WebRtcRTPHeader* rtpHeader); + bool OnRecoveredPacket(const uint8_t* packet, int packet_length) { + // Generic FEC not supported for audio. + return true; + } + public: // From RtpFeedback in the RTP/RTCP module int32_t OnInitializeDecoder( @@ -330,6 +334,8 @@ public: void OnIncomingCSRCChanged(int32_t id, uint32_t CSRC, bool added); + void ResetStatistics(); + public: // From RtcpFeedback in the RTP/RTCP module void OnApplicationDataReceived(int32_t id, @@ -433,6 +439,7 @@ public: uint32_t EncodeAndSend(); private: + bool IsPacketRetransmitted(const RTPHeader& header) const; int ResendPackets(const uint16_t* sequence_numbers, int length); int InsertInbandDtmfTone(); int32_t MixOrReplaceAudioWithFile(int mixingFrequency); @@ -453,6 +460,10 @@ private: private: scoped_ptr<RtpHeaderParser> rtp_header_parser_; + scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_; + scoped_ptr<ReceiveStatistics> rtp_receive_statistics_; + scoped_ptr<RtpReceiver> rtp_receiver_; + TelephoneEventHandler* telephone_event_handler_; scoped_ptr<RtpRtcp> _rtpRtcpModule; AudioCodingModule& _audioCodingModule; RtpDump& _rtpDumpIn; diff --git a/voice_engine/include/voe_network.h b/voice_engine/include/voe_network.h index 7bcf9033..8259e32f 100644 --- a/voice_engine/include/voe_network.h +++ b/voice_engine/include/voe_network.h @@ -89,31 +89,6 @@ public: virtual int ReceivedRTCPPacket( int channel, const void* data, unsigned int length) = 0; - // Enables or disables warnings that report if packets have not been - // received in |timeoutSeconds| seconds for a specific |channel|. - virtual int SetPacketTimeoutNotification( - int channel, bool enable, int timeoutSeconds = 2) = 0; - - // Gets the current time-out notification status. - virtual int GetPacketTimeoutNotification( - int channel, bool& enabled, int& timeoutSeconds) = 0; - - // Installs the observer class implementation for a specified |channel|. - virtual int RegisterDeadOrAliveObserver( - int channel, VoEConnectionObserver& observer) = 0; - - // Removes the observer class implementation for a specified |channel|. - virtual int DeRegisterDeadOrAliveObserver(int channel) = 0; - - // Enables or disables the periodic dead-or-alive callback functionality - // for a specified |channel|. - virtual int SetPeriodicDeadOrAliveStatus( - int channel, bool enable, int sampleTimeSeconds = 2) = 0; - - // Gets the current dead-or-alive notification status. - virtual int GetPeriodicDeadOrAliveStatus( - int channel, bool& enabled, int& sampleTimeSeconds) = 0; - protected: VoENetwork() {} virtual ~VoENetwork() {} diff --git a/voice_engine/include/voe_video_sync.h b/voice_engine/include/voe_video_sync.h index ef811a96..cf16d3b3 100644 --- a/voice_engine/include/voe_video_sync.h +++ b/voice_engine/include/voe_video_sync.h @@ -37,6 +37,7 @@ namespace webrtc { +class RtpReceiver; class RtpRtcp; class VoiceEngine; @@ -92,7 +93,8 @@ public: // Get the received RTP timestamp virtual int GetPlayoutTimestamp(int channel, unsigned int& timestamp) = 0; - virtual int GetRtpRtcp (int channel, RtpRtcp* &rtpRtcpModule) = 0; + virtual int GetRtpRtcp (int channel, RtpRtcp** rtpRtcpModule, + RtpReceiver** rtp_receiver) = 0; protected: VoEVideoSync() { } diff --git a/voice_engine/test/auto_test/standard/call_report_test.cc b/voice_engine/test/auto_test/standard/call_report_test.cc index 26df80bc..ee98dc1e 100644 --- a/voice_engine/test/auto_test/standard/call_report_test.cc +++ b/voice_engine/test/auto_test/standard/call_report_test.cc @@ -54,29 +54,6 @@ TEST_F(CallReportTest, DISABLED_GetRoundTripTimesReturnsValuesIfRtcpIsOn) { EXPECT_NE(-1, delays.max); } -TEST_F(CallReportTest, DeadOrAliveSummaryFailsIfDeadOrAliveTrackingNotActive) { - int count_the_dead; - int count_the_living; - EXPECT_EQ(-1, voe_call_report_->GetDeadOrAliveSummary(channel_, - count_the_dead, - count_the_living)); -} - -TEST_F(CallReportTest, - DeadOrAliveSummarySucceedsIfDeadOrAliveTrackingIsActive) { - EXPECT_EQ(0, voe_network_->SetPeriodicDeadOrAliveStatus(channel_, true, 1)); - Sleep(1200); - - int count_the_dead; - int count_the_living; - EXPECT_EQ(0, voe_call_report_->GetDeadOrAliveSummary(channel_, - count_the_dead, - count_the_living)); - - EXPECT_GE(count_the_dead, 0); - EXPECT_GE(count_the_living, 0); -} - TEST_F(CallReportTest, WriteReportToFileFailsOnBadInput) { EXPECT_EQ(-1, voe_call_report_->WriteReportToFile(NULL)); } diff --git a/voice_engine/test/auto_test/standard/network_test.cc b/voice_engine/test/auto_test/standard/network_test.cc index 1c83799c..79daf59b 100644 --- a/voice_engine/test/auto_test/standard/network_test.cc +++ b/voice_engine/test/auto_test/standard/network_test.cc @@ -23,100 +23,6 @@ class NetworkTest : public AfterStreamingFixture { using ::testing::Between; -TEST_F(NetworkTest, - CallsObserverOnTimeoutAndRestartWhenPacketTimeoutNotificationIsEnabled) { - // First, get rid of the default, asserting observer and install our observer. - EXPECT_EQ(0, voe_base_->DeRegisterVoiceEngineObserver()); - webrtc::MockVoEObserver mock_observer; - EXPECT_EQ(0, voe_base_->RegisterVoiceEngineObserver(mock_observer)); - - // Define expectations. - int expected_error = VE_RECEIVE_PACKET_TIMEOUT; - EXPECT_CALL(mock_observer, CallbackOnError(channel_, expected_error)) - .Times(1); - expected_error = VE_PACKET_RECEIPT_RESTARTED; - EXPECT_CALL(mock_observer, CallbackOnError(channel_, expected_error)) - .Times(1); - - // Get some speech going. - Sleep(500); - - // Enable packet timeout. - EXPECT_EQ(0, voe_network_->SetPacketTimeoutNotification(channel_, true, 1)); - - // Trigger a timeout. - EXPECT_EQ(0, voe_base_->StopSend(channel_)); - Sleep(1500); - - // Trigger a restart event. - EXPECT_EQ(0, voe_base_->StartSend(channel_)); - Sleep(500); -} - -TEST_F(NetworkTest, DoesNotCallDeRegisteredObserver) { - // De-register the default observer. This test will fail if the observer gets - // called for any reason, so if this de-register doesn't work the test will - // fail. - EXPECT_EQ(0, voe_base_->DeRegisterVoiceEngineObserver()); - - // Get some speech going. - Sleep(500); - - // Enable packet timeout. - EXPECT_EQ(0, voe_network_->SetPacketTimeoutNotification(channel_, true, 1)); - - // Trigger a timeout. - EXPECT_EQ(0, voe_base_->StopSend(channel_)); - Sleep(1500); -} - -// TODO(phoglund): flaky on Linux -TEST_F(NetworkTest, - DISABLED_ON_LINUX(DeadOrAliveObserverSeesAliveMessagesIfEnabled)) { - if (!FLAGS_include_timing_dependent_tests) { - TEST_LOG("Skipping test - running in slow execution environment...\n"); - return; - } - - webrtc::MockVoeConnectionObserver mock_observer; - EXPECT_EQ(0, voe_network_->RegisterDeadOrAliveObserver( - channel_, mock_observer)); - - // We should be called about 4 times in four seconds, but 3 is OK too. - EXPECT_CALL(mock_observer, OnPeriodicDeadOrAlive(channel_, true)) - .Times(Between(3, 4)); - - EXPECT_EQ(0, voe_network_->SetPeriodicDeadOrAliveStatus(channel_, true, 1)); - Sleep(4000); - - EXPECT_EQ(0, voe_network_->DeRegisterDeadOrAliveObserver(channel_)); -} - -TEST_F(NetworkTest, DeadOrAliveObserverSeesDeadMessagesIfEnabled) { - if (!FLAGS_include_timing_dependent_tests) { - TEST_LOG("Skipping test - running in slow execution environment...\n"); - return; - } - - // "When do you see them?" - "All the time!" - webrtc::MockVoeConnectionObserver mock_observer; - EXPECT_EQ(0, voe_network_->RegisterDeadOrAliveObserver( - channel_, mock_observer)); - - Sleep(500); - - // We should be called about 4 times in four seconds, but 3 is OK too. - EXPECT_CALL(mock_observer, OnPeriodicDeadOrAlive(channel_, false)) - .Times(Between(3, 4)); - - EXPECT_EQ(0, voe_network_->SetPeriodicDeadOrAliveStatus(channel_, true, 1)); - EXPECT_EQ(0, voe_rtp_rtcp_->SetRTCPStatus(channel_, false)); - EXPECT_EQ(0, voe_base_->StopSend(channel_)); - Sleep(4000); - - EXPECT_EQ(0, voe_network_->DeRegisterDeadOrAliveObserver(channel_)); -} - TEST_F(NetworkTest, CanSwitchToExternalTransport) { EXPECT_EQ(0, voe_base_->StopReceive(channel_)); EXPECT_EQ(0, voe_base_->DeleteChannel(channel_)); diff --git a/voice_engine/test/auto_test/voe_extended_test.cc b/voice_engine/test/auto_test/voe_extended_test.cc index c569aaab..9b5b6d5d 100644 --- a/voice_engine/test/auto_test/voe_extended_test.cc +++ b/voice_engine/test/auto_test/voe_extended_test.cc @@ -1150,24 +1150,6 @@ int VoEExtendedTest::TestCallReport() { ANL(); */ - int nDead = 0; - int nAlive = 0; - TEST(GetDeadOrAliveSummary); - ANL(); - // All results should be -1 since dead-or-alive is not active - TEST_MUSTPASS(report->GetDeadOrAliveSummary(0, nDead, nAlive) != -1); - MARK(); - TEST_MUSTPASS(voe_network ->SetPeriodicDeadOrAliveStatus(0, true, 1)); - SleepMs(2000); - // All results should be >= 0 since dead-or-alive is active - TEST_MUSTPASS(report->GetDeadOrAliveSummary(0, nDead, nAlive)); - MARK(); - TEST_MUSTPASS(nDead == -1); - TEST_MUSTPASS(nAlive == -1) - TEST_MUSTPASS(voe_network ->SetPeriodicDeadOrAliveStatus(0, false)); - AOK(); - ANL(); - TEST(WriteReportToFile); ANL(); @@ -4174,218 +4156,8 @@ int VoEExtendedTest::TestNetwork() { // >> end of SetExternalTransport // ------------------------------------------------------------------------ - - // ------------------------------------------------------------------------ - // >> RegisterDeadOrAliveObserver - // >> DeRegisterDeadOrAliveObserver - // - // - VE initialized - // - no existing channels - // - no media - TEST(RegisterDeadOrAliveObserver); - ANL(); - TEST(DeRegisterDeadOrAliveObserver); - ANL(); - - // call without valid channel - TEST_MUSTPASS(!voe_network ->RegisterDeadOrAliveObserver(0, *this)); - MARK(); - TEST_ERROR(VE_CHANNEL_NOT_VALID); - - TEST_MUSTPASS(voe_base_->CreateChannel()); - - TEST_MUSTPASS(voe_network ->RegisterDeadOrAliveObserver(0, *this)); - MARK(); - TEST_MUSTPASS(!voe_network ->RegisterDeadOrAliveObserver(0, *this)); - MARK(); // already registered - TEST_ERROR(VE_INVALID_OPERATION); - TEST_MUSTPASS(voe_network ->DeRegisterDeadOrAliveObserver(0)); - MARK(); - TEST_MUSTPASS(voe_network ->DeRegisterDeadOrAliveObserver(0)); - MARK(); // OK to do it again - TEST_MUSTPASS(voe_network ->RegisterDeadOrAliveObserver(0, *this)); - MARK(); - TEST_MUSTPASS(voe_network ->DeRegisterDeadOrAliveObserver(0)); - MARK(); - - TEST_MUSTPASS(voe_base_->DeleteChannel(0)); - - // STATE: dead-or-alive observer is disabled - - // >> end of RegisterDeadOrAliveObserver - // ------------------------------------------------------------------------ - - // ------------------------------------------------------------------------ - // >> SetPeriodicDeadOrAliveStatus - // >> GetPeriodicDeadOrAliveStatus - // - // - VE initialized - // - no existing channels - // - no media - - // call without valid channel - TEST_MUSTPASS(!voe_network ->SetPeriodicDeadOrAliveStatus(0, false)); - MARK(); - TEST_ERROR(VE_CHANNEL_NOT_VALID); - - TEST_MUSTPASS(voe_base_->CreateChannel()); - - // Invalid paramters - TEST_MUSTPASS(!voe_network ->SetPeriodicDeadOrAliveStatus(0, true, 0)); - MARK(); - TEST_ERROR(VE_INVALID_ARGUMENT); - TEST_MUSTPASS(!voe_network ->SetPeriodicDeadOrAliveStatus(0, true, 151)); - MARK(); - TEST_ERROR(VE_INVALID_ARGUMENT); - TEST_MUSTPASS(!voe_network ->SetPeriodicDeadOrAliveStatus(1, true, 10)); - MARK(); - TEST_ERROR(VE_CHANNEL_NOT_VALID); - - int sampleTime(0); - bool enabled; - - // Valid parameters - TEST_MUSTPASS(voe_network ->SetPeriodicDeadOrAliveStatus(0, true, 1)); - MARK(); - TEST_MUSTPASS( - voe_network ->GetPeriodicDeadOrAliveStatus(0, enabled, sampleTime)); - TEST_MUSTPASS(enabled != true); - TEST_MUSTPASS(sampleTime != 1); - TEST_MUSTPASS(voe_network ->SetPeriodicDeadOrAliveStatus(0, true, 150)); - MARK(); - TEST_MUSTPASS( - voe_network ->GetPeriodicDeadOrAliveStatus(0, enabled, sampleTime)); - TEST_MUSTPASS(enabled != true); - TEST_MUSTPASS(sampleTime != 150); - TEST_MUSTPASS(voe_network ->SetPeriodicDeadOrAliveStatus(0, false)); - MARK(); - TEST_MUSTPASS( - voe_network ->GetPeriodicDeadOrAliveStatus(0, enabled, sampleTime)); - TEST_MUSTPASS(enabled != false); - TEST_MUSTPASS(sampleTime != 150); // ensure last set time isnt modified - - StartMedia(0, 2000, true, true, true); - - // STATE: full duplex media is active - - // test the dead-or-alive mechanism - TEST_MUSTPASS(voe_network ->RegisterDeadOrAliveObserver(0, *this)); - MARK(); - TEST_LOG("\nVerify that Alive callbacks are received (dT=2sec): "); - fflush(NULL); - TEST_MUSTPASS(voe_network ->SetPeriodicDeadOrAliveStatus(0, true, 2)); - SleepMs(6000); - TEST_LOG("\nChange dT to 1 second: "); - fflush(NULL); - TEST_MUSTPASS(voe_network ->SetPeriodicDeadOrAliveStatus(0, true, 1)); - SleepMs(6000); - TEST_LOG("\nDisable dead-or-alive callbacks: "); - fflush(NULL); - TEST_MUSTPASS(voe_network ->SetPeriodicDeadOrAliveStatus(0, false)); - SleepMs(6000); - TEST_LOG("\nStop sending and enable callbacks again.\n"); - TEST_LOG("Verify that Dead callbacks are received (dT=2sec): "); - fflush(NULL); - TEST_MUSTPASS(voe_base_->StopSend(0)); - TEST_MUSTPASS(voe_network ->SetPeriodicDeadOrAliveStatus(0, true, 2)); - SleepMs(6000); - TEST_MUSTPASS(voe_base_->StartSend(0)); - TEST_LOG("\nRestart sending.\n"); - TEST_LOG("Verify that Alive callbacks are received again (dT=2sec): "); - fflush(NULL); - SleepMs(6000); - TEST_LOG("\nDisable dead-or-alive callbacks."); - fflush(NULL); - TEST_MUSTPASS(voe_network ->SetPeriodicDeadOrAliveStatus(0, false)); - TEST_MUSTPASS(voe_network ->DeRegisterDeadOrAliveObserver(0)); - MARK(); - - StopMedia(0); - - TEST_MUSTPASS(voe_base_->DeleteChannel(0)); - ANL(); - AOK(); - ANL(); - ANL(); - - // >> end of SetPeriodicDeadOrAliveStatus - // ------------------------------------------------------------------------ - - // ------------------------------------------------------------------------ - // >> SetPacketTimeoutNotification - // >> GetPacketTimeoutNotification - // - // - VE initialized - // - no existing channels - // - no media - // - NOTE: dynamic tests are performed in standard test - - int timeOut(0); - - TEST(SetPacketTimeoutNotification); - ANL(); - TEST(GetPacketTimeoutNotification); - ANL(); - - // call without existing valid channel - TEST_MUSTPASS(!voe_network ->SetPacketTimeoutNotification(0, false)); - MARK(); - TEST_ERROR(VE_CHANNEL_NOT_VALID); - - TEST_MUSTPASS(voe_base_->CreateChannel()); - - // invalid function calls - TEST_MUSTPASS(!voe_network ->SetPacketTimeoutNotification(0, true, 0)); - MARK(); - TEST_ERROR(VE_INVALID_ARGUMENT); - TEST_MUSTPASS(!voe_network ->SetPacketTimeoutNotification(0, true, 151)); - MARK(); - TEST_ERROR(VE_INVALID_ARGUMENT); - - // valid function calls (no active media) - TEST_MUSTPASS(voe_network ->SetPacketTimeoutNotification(0, true, 2)); - MARK(); - TEST_MUSTPASS(voe_network ->GetPacketTimeoutNotification(0, enabled, - timeOut)); - MARK(); - TEST_MUSTPASS(enabled != true); - TEST_MUSTPASS(timeOut != 2); - TEST_MUSTPASS(voe_network ->SetPacketTimeoutNotification(0, false)); - MARK(); - TEST_MUSTPASS(voe_network ->GetPacketTimeoutNotification(0, enabled, - timeOut)); - MARK(); - TEST_MUSTPASS(enabled != false); - TEST_MUSTPASS(voe_network ->SetPacketTimeoutNotification(0, true, 10)); - MARK(); - TEST_MUSTPASS(voe_network ->GetPacketTimeoutNotification(0, enabled, - timeOut)); - MARK(); - TEST_MUSTPASS(enabled != true); - TEST_MUSTPASS(timeOut != 10); - TEST_MUSTPASS(voe_network ->SetPacketTimeoutNotification(0, true, 2)); - MARK(); - TEST_MUSTPASS(voe_network ->GetPacketTimeoutNotification(0, enabled, - timeOut)); - MARK(); - TEST_MUSTPASS(enabled != true); - TEST_MUSTPASS(timeOut != 2); - TEST_MUSTPASS(voe_network ->SetPacketTimeoutNotification(0, false)); - MARK(); - TEST_MUSTPASS(voe_network ->GetPacketTimeoutNotification(0, enabled, - timeOut)); - MARK(); - TEST_MUSTPASS(enabled != false); - - TEST_MUSTPASS(voe_base_->DeleteChannel(0)); - ANL(); - AOK(); - ANL(); - ANL(); return 0; } - // >> end of SetPacketTimeoutNotification - // ------------------------------------------------------------------------ // ---------------------------------------------------------------------------- // VoEExtendedTest::TestRTP_RTCP diff --git a/voice_engine/voe_network_impl.cc b/voice_engine/voe_network_impl.cc index 615fd6a0..0f4d5c28 100644 --- a/voice_engine/voe_network_impl.cc +++ b/voice_engine/voe_network_impl.cc @@ -165,158 +165,4 @@ 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::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); - voe::Channel* channelPtr = ch.channel(); - 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::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); - voe::Channel* channelPtr = ch.channel(); - 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::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); - voe::Channel* channelPtr = ch.channel(); - 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::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); - voe::Channel* channelPtr = ch.channel(); - 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::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); - voe::Channel* channelPtr = ch.channel(); - 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::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); - voe::Channel* channelPtr = ch.channel(); - if (channelPtr == NULL) - { - _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, - "GetPeriodicDeadOrAliveStatus() failed to locate channel"); - return -1; - } - return channelPtr->GetPeriodicDeadOrAliveStatus(enabled, - sampleTimeSeconds); -} - } // namespace webrtc diff --git a/voice_engine/voe_network_impl.h b/voice_engine/voe_network_impl.h index 194899b4..6a703cfa 100644 --- a/voice_engine/voe_network_impl.h +++ b/voice_engine/voe_network_impl.h @@ -34,27 +34,6 @@ public: const void* data, unsigned int length); - virtual int SetPacketTimeoutNotification(int channel, - bool enable, - int timeoutSeconds = 2); - - virtual int GetPacketTimeoutNotification(int channel, - bool& enabled, - int& timeoutSeconds); - - virtual int RegisterDeadOrAliveObserver(int channel, - VoEConnectionObserver& observer); - - virtual int DeRegisterDeadOrAliveObserver(int channel); - - virtual int SetPeriodicDeadOrAliveStatus(int channel, - bool enable, - int sampleTimeSeconds = 2); - - virtual int GetPeriodicDeadOrAliveStatus(int channel, - bool& enabled, - int& sampleTimeSeconds); - protected: VoENetworkImpl(voe::SharedData* shared); virtual ~VoENetworkImpl(); diff --git a/voice_engine/voe_video_sync_impl.cc b/voice_engine/voe_video_sync_impl.cc index 5b3312c6..cd377eb8 100644 --- a/voice_engine/voe_video_sync_impl.cc +++ b/voice_engine/voe_video_sync_impl.cc @@ -216,7 +216,8 @@ int VoEVideoSyncImpl::GetPlayoutBufferSize(int& bufferMs) return 0; } -int VoEVideoSyncImpl::GetRtpRtcp(int channel, RtpRtcp* &rtpRtcpModule) +int VoEVideoSyncImpl::GetRtpRtcp(int channel, RtpRtcp** rtpRtcpModule, + RtpReceiver** rtp_receiver) { WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), "GetRtpRtcp(channel=%i)", channel); @@ -234,7 +235,7 @@ int VoEVideoSyncImpl::GetRtpRtcp(int channel, RtpRtcp* &rtpRtcpModule) "GetPlayoutTimestamp() failed to locate channel"); return -1; } - return channelPtr->GetRtpRtcp(rtpRtcpModule); + return channelPtr->GetRtpRtcp(rtpRtcpModule, rtp_receiver); } int VoEVideoSyncImpl::GetLeastRequiredDelayMs(int channel) const { diff --git a/voice_engine/voe_video_sync_impl.h b/voice_engine/voe_video_sync_impl.h index e0ec3f2f..8c516fbc 100644 --- a/voice_engine/voe_video_sync_impl.h +++ b/voice_engine/voe_video_sync_impl.h @@ -38,7 +38,8 @@ public: virtual int GetPlayoutTimestamp(int channel, unsigned int& timestamp); - virtual int GetRtpRtcp(int channel, RtpRtcp* &rtpRtcpModule); + virtual int GetRtpRtcp(int channel, RtpRtcp** rtpRtcpModule, + RtpReceiver** rtp_receiver); protected: VoEVideoSyncImpl(voe::SharedData* shared); |