From 3e820e5109cf34b2bdb216a637a92a6ce8904816 Mon Sep 17 00:00:00 2001 From: "mflodman@webrtc.org" Date: Fri, 23 Mar 2012 09:41:44 +0000 Subject: [PATCH] Remove RTP Keep-alive from VoE and ViE. The RTP module functionality will be removed in a follow-up CL shortly. TEST=VoE autotest and ViE autotest Review URL: https://webrtc-codereview.appspot.com/458002 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1929 4adac7df-926f-26a2-2b94-8c16560cd09d --- src/video_engine/include/vie_rtp_rtcp.h | 18 ---- .../auto_test/source/vie_autotest_rtp_rtcp.cc | 67 +-------------- src/video_engine/vie_channel.cc | 82 +------------------ src/video_engine/vie_channel.h | 7 +- src/video_engine/vie_rtp_rtcp_impl.cc | 59 ------------- src/video_engine/vie_rtp_rtcp_impl.h | 10 --- .../main/interface/voe_rtp_rtcp.h | 15 +--- src/voice_engine/main/source/channel.cc | 54 ------------ src/voice_engine/main/source/channel.h | 4 - .../main/source/voe_rtp_rtcp_impl.cc | 54 ------------ .../main/source/voe_rtp_rtcp_impl.h | 11 --- .../rtp_rtcp_before_streaming_test.cc | 71 ---------------- .../main/test/auto_test/voe_extended_test.cc | 43 ---------- 13 files changed, 4 insertions(+), 491 deletions(-) diff --git a/src/video_engine/include/vie_rtp_rtcp.h b/src/video_engine/include/vie_rtp_rtcp.h index f618fae326..bbaeae33b8 100644 --- a/src/video_engine/include/vie_rtp_rtcp.h +++ b/src/video_engine/include/vie_rtp_rtcp.h @@ -15,7 +15,6 @@ // - Obtaining RTCP data from incoming RTCP sender reports. // - RTP and RTCP statistics (jitter, packet loss, RTT etc.). // - Forward Error Correction (FEC). -// - RTP Keep‐alive for maintaining the NAT mappings associated to RTP flows. // - Writing RTP and RTCP packets to binary files for off‐line analysis of the // call quality. // - Inserting extra RTP packets into active audio stream. @@ -257,23 +256,6 @@ class WEBRTC_DLLEXPORT ViERTP_RTCP { const int video_channel, unsigned int* estimated_bandwidth) const = 0; - // This function enables or disables an RTP keep-alive mechanism which can - // be used to maintain an existing Network Address Translator (NAT) mapping - // while regular RTP is no longer transmitted. - virtual int SetRTPKeepAliveStatus( - const int video_channel, - bool enable, - const int unknown_payload_type, - const unsigned int delta_transmit_time_seconds = - KDefaultDeltaTransmitTimeSeconds) = 0; - - // This function gets the RTP keep-alive status. - virtual int GetRTPKeepAliveStatus( - const int video_channel, - bool& enabled, - int& unkown_payload_type, - unsigned int& delta_transmit_time_seconds) const = 0; - // This function enables capturing of RTP packets to a binary file on a // specific channel and for a given direction. The file can later be // replayed using e.g. RTP Tools rtpplay since the binary file format is diff --git a/src/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc b/src/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc index c29c5dbe5b..c5f9365d09 100644 --- a/src/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc +++ b/src/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc @@ -282,34 +282,10 @@ void ViEAutoTest::ViERtpRtcpStandardTest() EXPECT_EQ(0, ViE.rtp_rtcp->SetNACKStatus(tbChannel.videoChannel, false)); - // - // Keepalive - // - ViETest::Log("Testing RTP keep alive...\n"); - EXPECT_EQ(0, ViE.base->StartReceive(tbChannel.videoChannel)); - + // Test to set SSRC myTransport.SetPacketLoss(0); myTransport.ClearStats(); - const char keepAlivePT = 109; - unsigned int deltaTimeSeconds = 2; - EXPECT_EQ(0, ViE.rtp_rtcp->SetRTPKeepAliveStatus( - tbChannel.videoChannel, true, keepAlivePT, deltaTimeSeconds)); - - AutoTestSleep(KAutoTestSleepTimeMs); - - EXPECT_EQ(0, ViE.rtp_rtcp->SetRTPKeepAliveStatus( - tbChannel.videoChannel, false, keepAlivePT, deltaTimeSeconds)); - - WebRtc_Word32 numRtpPackets = 0; - WebRtc_Word32 numDroppedPackets = 0; - WebRtc_Word32 numRtcpPackets = 0; - myTransport.GetStats(numRtpPackets, numDroppedPackets, numRtcpPackets); - WebRtc_Word32 expectedPackets = KAutoTestSleepTimeMs / (1000 * - static_cast(deltaTimeSeconds)); - EXPECT_EQ(expectedPackets, numRtpPackets); - - // Test to set SSRC unsigned int setSSRC = 0x01234567; ViETest::Log("Set SSRC %u", setSSRC); EXPECT_EQ(0, ViE.rtp_rtcp->SetLocalSSRC(tbChannel.videoChannel, setSSRC)); @@ -657,47 +633,6 @@ void ViEAutoTest::ViERtpRtcpAPITest() // Tested in SimpleTest(), we'll get errors if we haven't received a RTCP // packet. - // - // RTP Keepalive - // - { - int setPT = 123; - unsigned int setDeltaTime = 10; - bool enabled = false; - int getPT = 0; - unsigned int getDeltaTime = 0; - EXPECT_EQ(0, ViE.rtp_rtcp->SetRTPKeepAliveStatus( - tbChannel.videoChannel, true, 119)); - EXPECT_NE(0, ViE.rtp_rtcp->SetRTPKeepAliveStatus( - tbChannel.videoChannel, true, setPT, setDeltaTime)); - EXPECT_EQ(0, ViE.rtp_rtcp->SetRTPKeepAliveStatus( - tbChannel.videoChannel, false, setPT, setDeltaTime)); - EXPECT_EQ(0, ViE.rtp_rtcp->SetRTPKeepAliveStatus( - tbChannel.videoChannel, true, setPT, setDeltaTime)); - EXPECT_EQ(0, ViE.rtp_rtcp->GetRTPKeepAliveStatus( - tbChannel.videoChannel, enabled, getPT, getDeltaTime)); - - EXPECT_TRUE(enabled); - EXPECT_EQ(setPT, getPT); - EXPECT_EQ(setDeltaTime, getDeltaTime); - - EXPECT_EQ(0, ViE.rtp_rtcp->SetRTPKeepAliveStatus( - tbChannel.videoChannel, false, setPT, setDeltaTime)); - - EXPECT_EQ(0, ViE.base->StartSend(tbChannel.videoChannel)); - - EXPECT_EQ(0, ViE.rtp_rtcp->SetRTPKeepAliveStatus( - tbChannel.videoChannel, true, setPT, setDeltaTime)); - - EXPECT_NE(0, ViE.rtp_rtcp->SetRTPKeepAliveStatus( - tbChannel.videoChannel, true, setPT, setDeltaTime)); - - tbChannel.StopSend(); - EXPECT_NE(0, ViE.rtp_rtcp->SetRTPKeepAliveStatus( - tbChannel.videoChannel, enabled, getPT, 0)); - EXPECT_NE(0, ViE.rtp_rtcp->SetRTPKeepAliveStatus( - tbChannel.videoChannel, enabled, getPT, 61)); - } // // RTP Dump // diff --git a/src/video_engine/vie_channel.cc b/src/video_engine/vie_channel.cc index a0f14dc17f..1d4878db65 100644 --- a/src/video_engine/vie_channel.cc +++ b/src/video_engine/vie_channel.cc @@ -1053,78 +1053,6 @@ int ViEChannel::GetEstimatedReceiveBandwidth( return rtp_rtcp_.EstimatedReceiveBandwidth(estimated_bandwidth); } -WebRtc_Word32 ViEChannel::SetKeepAliveStatus( - const bool enable, - const int unknown_payload_type, - const WebRtc_UWord16 delta_transmit_timeMS) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s", __FUNCTION__); - - if (enable && rtp_rtcp_.RTPKeepalive()) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: RTP keepalive already enabled", __FUNCTION__); - return -1; - } else if (!enable && !rtp_rtcp_.RTPKeepalive()) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: RTP keepalive already disabled", __FUNCTION__); - return -1; - } - - if (rtp_rtcp_.SetRTPKeepaliveStatus(enable, unknown_payload_type, - delta_transmit_timeMS) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not set RTP keepalive status %d", __FUNCTION__, - enable); - if (enable == false && !rtp_rtcp_.DefaultModuleRegistered()) { - // Not sending media and we try to disable keep alive - rtp_rtcp_.ResetSendDataCountersRTP(); - rtp_rtcp_.SetSendingStatus(false); - } - return -1; - } - - if (enable && !rtp_rtcp_.Sending()) { - // Enable sending to start sending Sender reports instead of receive - // reports. - if (rtp_rtcp_.SetSendingStatus(true) != 0) { - rtp_rtcp_.SetRTPKeepaliveStatus(false, 0, 0); - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not start sending", __FUNCTION__); - return -1; - } - } else if (!enable && !rtp_rtcp_.SendingMedia()) { - // Not sending media and we're disabling keep alive. - rtp_rtcp_.ResetSendDataCountersRTP(); - if (rtp_rtcp_.SetSendingStatus(false) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not stop sending", __FUNCTION__); - return -1; - } - } - return 0; -} - -WebRtc_Word32 ViEChannel::GetKeepAliveStatus( - bool& enabled, - int& unknown_payload_type, - WebRtc_UWord16& delta_transmit_time_ms) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); - if (rtp_rtcp_.RTPKeepaliveStatus(&enabled, &unknown_payload_type, - &delta_transmit_time_ms) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not get RTP keepalive status", __FUNCTION__); - return -1; - } - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: enabled = %d, unknown_payload_type = %d, " - "delta_transmit_time_ms = %ul", - __FUNCTION__, enabled, (WebRtc_Word32) unknown_payload_type, - delta_transmit_time_ms); - - return 0; -} - WebRtc_Word32 ViEChannel::StartRTPDump(const char file_nameUTF8[1024], RTPDirections direction) { WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", @@ -1421,11 +1349,7 @@ WebRtc_Word32 ViEChannel::StartSend() { #endif rtp_rtcp_.SetSendingMediaStatus(true); - if (rtp_rtcp_.Sending() && !rtp_rtcp_.RTPKeepalive()) { - if (rtp_rtcp_.RTPKeepalive()) { - // Sending Keep alive, don't trigger an error. - return 0; - } + if (rtp_rtcp_.Sending()) { // Already sending. WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), "%s: Already sending", __FUNCTION__); @@ -1457,10 +1381,6 @@ WebRtc_Word32 ViEChannel::StopSend() { RtpRtcp* rtp_rtcp = *it; rtp_rtcp->SetSendingMediaStatus(false); } - if (rtp_rtcp_.RTPKeepalive()) { - // Don't turn off sending since we'll send keep alive packets. - return 0; - } if (!rtp_rtcp_.Sending()) { WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_), "%s: Not sending", __FUNCTION__); diff --git a/src/video_engine/vie_channel.h b/src/video_engine/vie_channel.h index 349a04b1a2..626418f3ac 100644 --- a/src/video_engine/vie_channel.h +++ b/src/video_engine/vie_channel.h @@ -163,12 +163,7 @@ class ViEChannel WebRtc_UWord32& fec_bitrate_sent, WebRtc_UWord32& nackBitrateSent) const; int GetEstimatedReceiveBandwidth(WebRtc_UWord32* estimated_bandwidth) const; - WebRtc_Word32 SetKeepAliveStatus(const bool enable, - const int unknown_payload_type, - const WebRtc_UWord16 delta_transmit_timeMS); - WebRtc_Word32 GetKeepAliveStatus(bool& enable, - int& unknown_payload_type, - WebRtc_UWord16& delta_transmit_timeMS); + WebRtc_Word32 StartRTPDump(const char file_nameUTF8[1024], RTPDirections direction); WebRtc_Word32 StopRTPDump(RTPDirections direction); diff --git a/src/video_engine/vie_rtp_rtcp_impl.cc b/src/video_engine/vie_rtp_rtcp_impl.cc index 0aaf8e4c39..630b5d6464 100644 --- a/src/video_engine/vie_rtp_rtcp_impl.cc +++ b/src/video_engine/vie_rtp_rtcp_impl.cc @@ -767,65 +767,6 @@ int ViERTP_RTCPImpl::GetEstimatedReceiveBandwidth( static_cast(estimated_bandwidth)); } -int ViERTP_RTCPImpl::SetRTPKeepAliveStatus( - const int video_channel, - bool enable, - const int unknown_payload_type, - const unsigned int delta_transmit_time_seconds) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s(channel: %d, enable: %d, unknown_payload_type: %d, " - "deltaTransmitTimeMS: %ul)", - __FUNCTION__, video_channel, enable, - static_cast(unknown_payload_type), - delta_transmit_time_seconds); - ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); - ViEChannel* vie_channel = cs.Channel(video_channel); - if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Channel %d doesn't exist", __FUNCTION__, - video_channel); - shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); - return -1; - } - WebRtc_UWord16 delta_transmit_time_ms = 1000 * delta_transmit_time_seconds; - if (vie_channel->SetKeepAliveStatus(enable, unknown_payload_type, - delta_transmit_time_ms) != 0) { - shared_data_->SetLastError(kViERtpRtcpUnknownError); - return -1; - } - return 0; -} - -int ViERTP_RTCPImpl::GetRTPKeepAliveStatus( - const int video_channel, - bool& enabled, - int& unknown_payload_type, - unsigned int& delta_transmit_time_seconds) const { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s(channel: %d)", __FUNCTION__, video_channel); - ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); - ViEChannel* vie_channel = cs.Channel(video_channel); - if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); - shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); - return -1; - } - - WebRtc_UWord16 delta_time_ms = 0; - int ret_val = vie_channel->GetKeepAliveStatus(enabled, unknown_payload_type, - delta_time_ms); - delta_transmit_time_seconds = delta_time_ms / 1000; - if (ret_val != 0) { - shared_data_->SetLastError(kViERtpRtcpUnknownError); - } - return ret_val; -} - int ViERTP_RTCPImpl::StartRTPDump(const int video_channel, const char file_nameUTF8[1024], RTPDirections direction) { diff --git a/src/video_engine/vie_rtp_rtcp_impl.h b/src/video_engine/vie_rtp_rtcp_impl.h index 386c96f70f..bdb1a816d3 100644 --- a/src/video_engine/vie_rtp_rtcp_impl.h +++ b/src/video_engine/vie_rtp_rtcp_impl.h @@ -93,16 +93,6 @@ class ViERTP_RTCPImpl virtual int GetEstimatedReceiveBandwidth( const int video_channel, unsigned int* estimated_bandwidth) const; - virtual int SetRTPKeepAliveStatus( - const int video_channel, - bool enable, - const int unknown_payload_type, - const unsigned int delta_transmit_time_seconds); - virtual int GetRTPKeepAliveStatus( - const int video_channel, - bool& enabled, - int& unkown_payload_type, - unsigned int& delta_transmit_time_seconds) const; virtual int StartRTPDump(const int video_channel, const char file_nameUTF8[1024], RTPDirections direction); diff --git a/src/voice_engine/main/interface/voe_rtp_rtcp.h b/src/voice_engine/main/interface/voe_rtp_rtcp.h index 9f8609eba6..0af5bac9e1 100644 --- a/src/voice_engine/main/interface/voe_rtp_rtcp.h +++ b/src/voice_engine/main/interface/voe_rtp_rtcp.h @@ -16,7 +16,6 @@ // - Obtaining RTCP data from incoming RTCP sender reports. // - RTP and RTCP statistics (jitter, packet loss, RTT etc.). // - Forward Error Correction (FEC). -// - RTP Keepalive for maintaining the NAT mappings associated to RTP flows. // - Writing RTP and RTCP packets to binary files for off-line analysis of // the call quality. // - Inserting extra RTP packets into active audio stream. @@ -187,21 +186,9 @@ public: virtual int GetFECStatus( int channel, bool& enabled, int& redPayloadtype) = 0; - // Sets the RTP keepalive mechanism status. - // This functionality can maintain an existing Network Address Translator - // (NAT) mapping while regular RTP is no longer transmitted. - virtual int SetRTPKeepaliveStatus( - int channel, bool enable, int unknownPayloadType, - int deltaTransmitTimeSeconds = 15) = 0; - - // Gets the RTP keepalive mechanism status. - virtual int GetRTPKeepaliveStatus( - int channel, bool& enabled, int& unknownPayloadType, - int& deltaTransmitTimeSeconds) = 0; - // Enables capturing of RTP packets to a binary file on a specific // |channel| and for a given |direction|. The file can later be replayed - // using e.g. RTP Tools rtpplay since the binary file format is + // using e.g. RTP Tools rtpplay since the binary file format is // compatible with the rtpdump format. virtual int StartRTPDump( int channel, const char fileNameUTF8[1024], diff --git a/src/voice_engine/main/source/channel.cc b/src/voice_engine/main/source/channel.cc index cd9313714c..fb87b14ead 100644 --- a/src/voice_engine/main/source/channel.cc +++ b/src/voice_engine/main/source/channel.cc @@ -5642,60 +5642,6 @@ Channel::GetFECStatus(bool& enabled, int& redPayloadtype) return 0; } -int -Channel::SetRTPKeepaliveStatus(bool enable, - int unknownPayloadType, - int deltaTransmitTimeSeconds) -{ - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), - "Channel::SetRTPKeepaliveStatus()"); - if (_sending) - { - _engineStatisticsPtr->SetLastError( - VE_ALREADY_SENDING, kTraceError, - "SetRTPKeepaliveStatus() already sending"); - return -1; - } - if (_rtpRtcpModule.SetRTPKeepaliveStatus( - enable, - unknownPayloadType, - 1000 * deltaTransmitTimeSeconds) != 0) - { - _engineStatisticsPtr->SetLastError( - VE_RTP_RTCP_MODULE_ERROR, kTraceError, - "SetRTPKeepaliveStatus() failed to set RTP keepalive status"); - return -1; - } - return 0; -} - -int -Channel::GetRTPKeepaliveStatus(bool& enabled, - int& unknownPayloadType, - int& deltaTransmitTimeSeconds) -{ - bool onOff(false); - int payloadType(0); - WebRtc_UWord16 deltaTransmitTimeMS(0); - if (_rtpRtcpModule.RTPKeepaliveStatus(&onOff, &payloadType, - &deltaTransmitTimeMS) != 0) - { - _engineStatisticsPtr->SetLastError( - VE_RTP_RTCP_MODULE_ERROR, kTraceError, - "GetRTPKeepaliveStatus() failed to retrieve RTP keepalive status"); - return -1; - } - enabled = onOff; - unknownPayloadType = payloadType; - deltaTransmitTimeSeconds = static_cast (deltaTransmitTimeMS / 1000); - WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, - VoEId(_instanceId, _channelId), - "GetRTPKeepaliveStatus() => enabled=%d, " - "unknownPayloadType=%u, deltaTransmitTimeSeconds=%d", - enabled, unknownPayloadType, deltaTransmitTimeSeconds); - return 0; -} - int Channel::StartRTPDump(const char fileNameUTF8[1024], RTPDirections direction) diff --git a/src/voice_engine/main/source/channel.h b/src/voice_engine/main/source/channel.h index 7ceca4af6b..3551054956 100644 --- a/src/voice_engine/main/source/channel.h +++ b/src/voice_engine/main/source/channel.h @@ -343,10 +343,6 @@ public: int GetRTPStatistics(CallStatistics& stats); int SetFECStatus(bool enable, int redPayloadtype); int GetFECStatus(bool& enabled, int& redPayloadtype); - int SetRTPKeepaliveStatus(bool enable, int unknownPayloadType, - int deltaTransmitTimeSeconds); - int GetRTPKeepaliveStatus(bool& enabled, int& unknownPayloadType, - int& deltaTransmitTimeSeconds); int StartRTPDump(const char fileNameUTF8[1024], RTPDirections direction); int StopRTPDump(RTPDirections direction); bool RTPDumpIsActive(RTPDirections direction); diff --git a/src/voice_engine/main/source/voe_rtp_rtcp_impl.cc b/src/voice_engine/main/source/voe_rtp_rtcp_impl.cc index bc7a5c85da..ba6d365768 100644 --- a/src/voice_engine/main/source/voe_rtp_rtcp_impl.cc +++ b/src/voice_engine/main/source/voe_rtp_rtcp_impl.cc @@ -573,60 +573,6 @@ int VoERTP_RTCPImpl::GetFECStatus(int channel, #endif } -int VoERTP_RTCPImpl::SetRTPKeepaliveStatus(int channel, - bool enable, - int unknownPayloadType, - int deltaTransmitTimeSeconds) -{ - WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_instanceId,-1), - "SetRTPKeepaliveStatus(channel=%d, enable=%d," - " unknownPayloadType=%u, deltaTransmitTimeSeconds=%d)", - channel, enable, unknownPayloadType, deltaTransmitTimeSeconds); - if (!_engineStatistics.Initialized()) - { - _engineStatistics.SetLastError(VE_NOT_INITED, kTraceError); - return -1; - } - voe::ScopedChannel sc(_channelManager, channel); - voe::Channel* channelPtr = sc.ChannelPtr(); - if (channelPtr == NULL) - { - _engineStatistics.SetLastError( - VE_CHANNEL_NOT_VALID, kTraceError, - "SetRTPKeepaliveStatus() failed to locate channel"); - return -1; - } - return channelPtr->SetRTPKeepaliveStatus(enable, - unknownPayloadType, - deltaTransmitTimeSeconds); -} - -int VoERTP_RTCPImpl::GetRTPKeepaliveStatus(int channel, - bool& enabled, - int& unknownPayloadType, - int& deltaTransmitTimeSeconds) -{ - WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_instanceId,-1), - "GetRTPKeepaliveStatus(channel=%d)", channel); - if (!_engineStatistics.Initialized()) - { - _engineStatistics.SetLastError(VE_NOT_INITED, kTraceError); - return -1; - } - voe::ScopedChannel sc(_channelManager, channel); - voe::Channel* channelPtr = sc.ChannelPtr(); - if (channelPtr == NULL) - { - _engineStatistics.SetLastError( - VE_CHANNEL_NOT_VALID, kTraceError, - "GetRTPKeepaliveStatus() failed to locate channel"); - return -1; - } - return channelPtr->GetRTPKeepaliveStatus(enabled, - unknownPayloadType, - deltaTransmitTimeSeconds); -} - int VoERTP_RTCPImpl::StartRTPDump(int channel, const char fileNameUTF8[1024], RTPDirections direction) diff --git a/src/voice_engine/main/source/voe_rtp_rtcp_impl.h b/src/voice_engine/main/source/voe_rtp_rtcp_impl.h index d3a840d02a..1912c3a818 100644 --- a/src/voice_engine/main/source/voe_rtp_rtcp_impl.h +++ b/src/voice_engine/main/source/voe_rtp_rtcp_impl.h @@ -87,17 +87,6 @@ public: virtual int GetRTCPStatistics(int channel, CallStatistics& stats); - // RTP keepalive mechanism (maintains NAT mappings associated to RTP flows) - virtual int SetRTPKeepaliveStatus(int channel, - bool enable, - int unknownPayloadType, - int deltaTransmitTimeSeconds = 15); - - virtual int GetRTPKeepaliveStatus(int channel, - bool& enabled, - int& unknownPayloadType, - int& deltaTransmitTimeSeconds); - // FEC virtual int SetFECStatus(int channel, bool enable, diff --git a/src/voice_engine/main/test/auto_test/standard/rtp_rtcp_before_streaming_test.cc b/src/voice_engine/main/test/auto_test/standard/rtp_rtcp_before_streaming_test.cc index 99655169cc..93170f61cd 100644 --- a/src/voice_engine/main/test/auto_test/standard/rtp_rtcp_before_streaming_test.cc +++ b/src/voice_engine/main/test/auto_test/standard/rtp_rtcp_before_streaming_test.cc @@ -42,77 +42,6 @@ TEST_F(RtpRtcpBeforeStreamingTest, EXPECT_TRUE(on); } -TEST_F(RtpRtcpBeforeStreamingTest, RtpKeepAliveStatusIsOffByDefault) { - int payload_type; - int delta_seconds; - bool on; - - // Should be off by default. - EXPECT_EQ(0, voe_rtp_rtcp_->GetRTPKeepaliveStatus( - channel_, on, payload_type, delta_seconds)); - EXPECT_FALSE(on); - EXPECT_EQ(-1, payload_type); - EXPECT_EQ(0, delta_seconds); -} - -TEST_F(RtpRtcpBeforeStreamingTest, SetRtpKeepAliveDealsWithInvalidParameters) { - int payload_type; - int delta_seconds; - bool on; - - // Verify invalid input parameters. - EXPECT_NE(0, voe_rtp_rtcp_->GetRTPKeepaliveStatus( - -1, on, payload_type, delta_seconds)) << - "Should fail for invalid channel -1."; - EXPECT_NE(0, voe_rtp_rtcp_->SetRTPKeepaliveStatus( - -1, true, 0, 15)) << - "Should fail for invalid channel -1."; - EXPECT_NE(0, voe_rtp_rtcp_->SetRTPKeepaliveStatus( - channel_, true, -1, 15)) << - "Should fail for invalid payload -1."; - EXPECT_NE(0, voe_rtp_rtcp_->SetRTPKeepaliveStatus( - channel_, true, 0, 61)) << - "The delta time must be [1, 60] seconds."; - EXPECT_EQ(0, voe_rtp_rtcp_->GetRTPKeepaliveStatus( - channel_, on, payload_type, delta_seconds)); - EXPECT_NE(0, voe_rtp_rtcp_->SetRTPKeepaliveStatus( - channel_, true, 0)); - - // Should still be off, default 0 used by PCMU. - EXPECT_FALSE(on); -} - -TEST_F(RtpRtcpBeforeStreamingTest, - GetRtpKeepaliveStatusObeysSetRtpKeepaliveStatus) { - EXPECT_EQ(0, voe_rtp_rtcp_->SetRTCP_CNAME(channel_, "SomeName")); - - // Try valid settings. - EXPECT_EQ(0, voe_rtp_rtcp_->SetRTPKeepaliveStatus( - channel_, true, 1)); - - int payload_type; - int delta_seconds; - bool on; - - EXPECT_EQ(0, voe_rtp_rtcp_->GetRTPKeepaliveStatus( - 0, on, payload_type, delta_seconds)); - EXPECT_TRUE(on); - EXPECT_EQ(1, payload_type); - EXPECT_EQ(15, delta_seconds) << "15 seconds delta is default."; - - // Set the keep-alive payload to 60, which the codecs can't use. - EXPECT_EQ(0, voe_rtp_rtcp_->SetRTPKeepaliveStatus( - channel_, true, 60, 3)); - EXPECT_EQ(0, voe_rtp_rtcp_->GetRTPKeepaliveStatus( - channel_, on, payload_type, delta_seconds)); - EXPECT_TRUE(on); - EXPECT_EQ(60, payload_type); - EXPECT_EQ(3, delta_seconds); - - EXPECT_EQ(0, voe_rtp_rtcp_->SetRTPKeepaliveStatus( - channel_, false, 60)); -} - TEST_F(RtpRtcpBeforeStreamingTest, GetLocalSsrcObeysSetLocalSsrc) { EXPECT_EQ(0, voe_rtp_rtcp_->SetLocalSSRC(channel_, 1234)); unsigned int result = 0; diff --git a/src/voice_engine/main/test/auto_test/voe_extended_test.cc b/src/voice_engine/main/test/auto_test/voe_extended_test.cc index 11b41af874..6c5a63f5c3 100644 --- a/src/voice_engine/main/test/auto_test/voe_extended_test.cc +++ b/src/voice_engine/main/test/auto_test/voe_extended_test.cc @@ -7148,49 +7148,6 @@ int VoEExtendedTest::TestRTP_RTCP() { TEST_MUSTPASS(rtp_rtcp->DeRegisterRTPObserver(0)); ANL(); - TEST(GetRTPKeepaliveStatus); - int pt; - int dT; - TEST_MUSTPASS(!rtp_rtcp->GetRTPKeepaliveStatus(-1, enabled, pt, dT)); - MARK(); - TEST_MUSTPASS(rtp_rtcp->GetRTPKeepaliveStatus(0, enabled, pt, dT)); - MARK(); // should be off by default - TEST_MUSTPASS(enabled != false); - TEST_MUSTPASS(pt != 255); - TEST_MUSTPASS(dT != 0); - ANL(); - - TEST(SetRTPKeepaliveStatus); - // stop send before changing the settings - TEST_MUSTPASS(voe_base_->StopSend(0)); - // verify invalid input parameters - TEST_MUSTPASS(!rtp_rtcp->SetRTPKeepaliveStatus(-1, true, 0, 15)); - MARK(); - TEST_MUSTPASS(!rtp_rtcp->SetRTPKeepaliveStatus(0, true, -1, 15)); - MARK(); - TEST_MUSTPASS(!rtp_rtcp->SetRTPKeepaliveStatus(0, true, 0, 61)); - MARK(); - TEST_MUSTPASS(rtp_rtcp->GetRTPKeepaliveStatus(0, enabled, pt, dT)); - MARK(); // should still be off - TEST_MUSTPASS(enabled != false); - // try valid settings - TEST_MUSTPASS(rtp_rtcp->SetRTPKeepaliveStatus(0, true, 117)); - MARK(); - TEST_MUSTPASS(rtp_rtcp->GetRTPKeepaliveStatus(0, enabled, pt, dT)); - MARK(); // should be on now - TEST_MUSTPASS(enabled != true); - TEST_MUSTPASS(pt != 117); - TEST_MUSTPASS(dT != 15); - // change from PT 99 to 121, as 99 is occupied - TEST_MUSTPASS(rtp_rtcp->SetRTPKeepaliveStatus(0, true, 121, 3)); - MARK(); // on, PT=99, dT=3 - TEST_MUSTPASS(rtp_rtcp->GetRTPKeepaliveStatus(0, enabled, pt, dT)); - MARK(); - TEST_MUSTPASS(enabled != true); - TEST_MUSTPASS(pt != 121); - TEST_MUSTPASS(dT != 3); - ANL(); - // Make fresh restart (ensures that SSRC is randomized) TEST_MUSTPASS(file->StopPlayingFileAsMicrophone(0)); TEST_MUSTPASS(voe_base_->StopSend(0));