Removed RTP Keepalive from RTP module.

Review URL: https://webrtc-codereview.appspot.com/455007

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1942 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mflodman@webrtc.org 2012-03-27 06:57:41 +00:00
parent 417901dc54
commit 534a435751
6 changed files with 0 additions and 324 deletions

View File

@ -366,39 +366,6 @@ public:
*/
virtual WebRtc_UWord16 MaxDataPayloadLength() const = 0;
/*
* set RTPKeepaliveStatus
*
* enable - on/off
* unknownPayloadType - payload type to use for RTP keepalive
* deltaTransmitTimeMS - delta time between RTP keepalive packets
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 SetRTPKeepaliveStatus(
const bool enable,
const int unknownPayloadType,
const WebRtc_UWord16 deltaTransmitTimeMS) = 0;
/*
* Get RTPKeepaliveStatus
*
* enable - on/off
* unknownPayloadType - payload type in use for RTP keepalive
* deltaTransmitTimeMS - delta time between RTP keepalive packets
*
* return -1 on failure else 0
*/
virtual WebRtc_Word32 RTPKeepaliveStatus(
bool* enable,
int* unknownPayloadType,
WebRtc_UWord16* deltaTransmitTimeMS) const = 0;
/*
* check if RTPKeepaliveStatus is enabled
*/
virtual bool RTPKeepalive() const = 0;
/*
* set codec name and payload type
*

View File

@ -94,16 +94,6 @@ class MockRtpRtcp : public RtpRtcp {
WebRtc_UWord16());
MOCK_CONST_METHOD0(MaxDataPayloadLength,
WebRtc_UWord16());
MOCK_METHOD3(SetRTPKeepaliveStatus,
WebRtc_Word32(const bool enable,
const int unknownPayloadType,
const WebRtc_UWord16 deltaTransmitTimeMS));
MOCK_CONST_METHOD3(RTPKeepaliveStatus,
WebRtc_Word32(bool* enable,
int* unknownPayloadType,
WebRtc_UWord16* deltaTransmitTimeMS));
MOCK_CONST_METHOD0(RTPKeepalive,
bool());
MOCK_METHOD1(RegisterSendPayload,
WebRtc_Word32(const CodecInst& voiceCodec));
MOCK_METHOD1(RegisterSendPayload,

View File

@ -425,13 +425,6 @@ WebRtc_Word32 ModuleRtpRtcpImpl::Process() {
_rtcpSender.SendRTCP(kRtcpReport);
}
if (_rtpSender.RTPKeepalive()) {
// check time to send RTP keep alive
if (_rtpSender.TimeToSendRTPKeepalive()) {
_rtpSender.SendRTPKeepalivePacket();
}
}
if (UpdateRTCPReceiveInformationTimers()) {
// a receiver has timed out
UpdateTMMBR();
@ -862,67 +855,6 @@ WebRtc_Word32 ModuleRtpRtcpImpl::InitSender() {
return retVal;
}
bool ModuleRtpRtcpImpl::RTPKeepalive() const {
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, _id, "RTPKeepalive()");
return _rtpSender.RTPKeepalive();
}
WebRtc_Word32 ModuleRtpRtcpImpl::RTPKeepaliveStatus(
bool* enable,
int* unknownPayloadType,
WebRtc_UWord16* deltaTransmitTimeMS) const {
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id, "RTPKeepaliveStatus()");
return _rtpSender.RTPKeepaliveStatus(enable,
unknownPayloadType,
deltaTransmitTimeMS);
}
WebRtc_Word32 ModuleRtpRtcpImpl::SetRTPKeepaliveStatus(
bool enable,
const int unknownPayloadType,
WebRtc_UWord16 deltaTransmitTimeMS) {
if (enable) {
WEBRTC_TRACE(
kTraceModuleCall,
kTraceRtpRtcp,
_id,
"SetRTPKeepaliveStatus(true, plType:%d deltaTransmitTimeMS:%u)",
unknownPayloadType,
deltaTransmitTimeMS);
// check the transmit keepalive delta time [1,60]
if (deltaTransmitTimeMS < 1000 || deltaTransmitTimeMS > 60000) {
WEBRTC_TRACE(kTraceError,
kTraceRtpRtcp,
_id,
"\tinvalid deltaTransmitTimeSeconds (%d)",
deltaTransmitTimeMS);
return -1;
}
// check the payload time [0,127]
if (unknownPayloadType < 0) {
WEBRTC_TRACE(kTraceError,
kTraceRtpRtcp,
_id,
"\tinvalid unknownPayloadType (%d)",
unknownPayloadType);
return -1;
}
// enable RTP keepalive mechanism
return _rtpSender.EnableRTPKeepalive(unknownPayloadType,
deltaTransmitTimeMS);
} else {
WEBRTC_TRACE(kTraceModuleCall,
kTraceRtpRtcp,
_id,
"SetRTPKeepaliveStatus(disable)");
return _rtpSender.DisableRTPKeepalive();
}
}
WebRtc_Word32 ModuleRtpRtcpImpl::RegisterSendPayload(
const CodecInst& voiceCodec) {
WEBRTC_TRACE(kTraceModuleCall,
@ -1098,14 +1030,6 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) {
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
"SetSendingStatus(sending)");
} else {
if (_rtpSender.RTPKeepalive()) {
WEBRTC_TRACE(
kTraceWarning,
kTraceRtpRtcp,
_id,
"Can't SetSendingStatus(stopped) when RTP Keepalive is active");
return -1;
}
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, _id,
"SetSendingStatus(stopped)");
}

View File

@ -148,18 +148,6 @@ public:
*/
virtual WebRtc_Word32 InitSender();
virtual WebRtc_Word32 SetRTPKeepaliveStatus(
const bool enable,
const int unknownPayloadType,
const WebRtc_UWord16 deltaTransmitTimeMS);
virtual WebRtc_Word32 RTPKeepaliveStatus(
bool* enable,
int* unknownPayloadType,
WebRtc_UWord16* deltaTransmitTimeMS) const;
virtual bool RTPKeepalive() const;
virtual WebRtc_Word32 RegisterSendPayload(const CodecInst& voiceCodec);
virtual WebRtc_Word32 RegisterSendPayload(const VideoCodec& videoCodec);

View File

@ -45,11 +45,6 @@ RTPSender::RTPSender(const WebRtc_Word32 id,
_rtpHeaderExtensionMap(),
_transmissionTimeOffset(0),
_keepAliveIsActive(false),
_keepAlivePayloadType(-1),
_keepAliveLastSent(0),
_keepAliveDeltaTimeSend(0),
// NACK
_nackByteCountTimes(),
_nackByteCount(),
@ -149,8 +144,6 @@ RTPSender::Init(const WebRtc_UWord32 remoteSSRC)
_payloadBytesSent = 0;
_packetOverHead = 28;
_keepAlivePayloadType = -1;
_rtpHeaderExtensionMap.Erase();
while (!_payloadTypeMap.empty()) {
@ -280,11 +273,6 @@ WebRtc_Word32 RTPSender::RegisterPayload(
assert(payloadName);
CriticalSectionScoped cs(_sendCritsect);
if (payloadNumber == _keepAlivePayloadType) {
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, _id, "invalid state",
__FUNCTION__);
return -1;
}
std::map<WebRtc_Word8, ModuleRTPUtility::Payload*>::iterator it =
_payloadTypeMap.find(payloadNumber);
@ -351,162 +339,6 @@ int RTPSender::SendPayloadFrequency() const
}
// See http://www.ietf.org/internet-drafts/draft-ietf-avt-app-rtp-keepalive-04.txt
// for details about this method. Only Section 4.6 is implemented so far.
bool
RTPSender::RTPKeepalive() const
{
return _keepAliveIsActive;
}
WebRtc_Word32
RTPSender::RTPKeepaliveStatus(bool* enable,
int* unknownPayloadType,
WebRtc_UWord16* deltaTransmitTimeMS) const
{
CriticalSectionScoped cs(_sendCritsect);
if(enable)
{
*enable = _keepAliveIsActive;
}
if(unknownPayloadType)
{
*unknownPayloadType = _keepAlivePayloadType;
}
if(deltaTransmitTimeMS)
{
*deltaTransmitTimeMS =_keepAliveDeltaTimeSend;
}
return 0;
}
WebRtc_Word32 RTPSender::EnableRTPKeepalive(
const int unknownPayloadType,
const WebRtc_UWord16 deltaTransmitTimeMS) {
CriticalSectionScoped cs(_sendCritsect);
std::map<WebRtc_Word8, ModuleRTPUtility::Payload*>::iterator it =
_payloadTypeMap.find(unknownPayloadType);
if (it != _payloadTypeMap.end()) {
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id, "%s invalid argument",
__FUNCTION__);
return -1;
}
_keepAliveIsActive = true;
_keepAlivePayloadType = unknownPayloadType;
_keepAliveLastSent = _clock.GetTimeInMS();
_keepAliveDeltaTimeSend = deltaTransmitTimeMS;
return 0;
}
WebRtc_Word32
RTPSender::DisableRTPKeepalive()
{
_keepAliveIsActive = false;
return 0;
}
bool
RTPSender::TimeToSendRTPKeepalive() const
{
CriticalSectionScoped cs(_sendCritsect);
bool timeToSend(false);
WebRtc_UWord32 dT = _clock.GetTimeInMS() - _keepAliveLastSent;
if (dT > _keepAliveDeltaTimeSend)
{
timeToSend = true;
}
return timeToSend;
}
// ----------------------------------------------------------------------------
// From the RFC draft:
//
// 4.6. RTP Packet with Unknown Payload Type
//
// The application sends an RTP packet of 0 length with a dynamic
// payload type that has not been negotiated by the peers (e.g. not
// negotiated within the SDP offer/answer, and thus not mapped to any
// media format).
//
// The sequence number is incremented by one for each packet, as it is
// sent within the same RTP session as the actual media. The timestamp
// contains the same value a media packet would have at this time. The
// marker bit is not significant for the keepalive packets and is thus
// set to zero.
//
// Normally the peer will ignore this packet, as RTP [RFC3550] states
// that "a receiver MUST ignore packets with payload types that it does
// not understand".
//
// Cons:
// o [RFC4566] and [RFC3264] mandate not to send media with inactive
// and recvonly attributes, however this is mitigated as no real
// media is sent with this mechanism.
//
// Recommendation:
// o This method should be used for RTP keepalive.
//
// 7. Timing and Transport Considerations
//
// An application supporting this specification must transmit keepalive
// packets every Tr seconds during the whole duration of the media
// session. Tr SHOULD be configurable, and otherwise MUST default to 15
// seconds.
//
// Keepalives packets within a particular RTP session MUST use the tuple
// (source IP address, source TCP/UDP ports, target IP address, target
// TCP/UDP Port) of the regular RTP packets.
//
// The agent SHOULD only send RTP keepalive when it does not send
// regular RTP packets.
//
// http://www.ietf.org/internet-drafts/draft-ietf-avt-app-rtp-keepalive-04.txt
// ----------------------------------------------------------------------------
WebRtc_Word32
RTPSender::SendRTPKeepalivePacket()
{
// RFC summary:
//
// - Send an RTP packet of 0 length;
// - dynamic payload type has not been negotiated (not mapped to any media);
// - sequence number is incremented by one for each packet;
// - timestamp contains the same value a media packet would have at this time;
// - marker bit is set to zero.
WebRtc_UWord8 dataBuffer[IP_PACKET_SIZE];
WebRtc_UWord16 rtpHeaderLength = 12;
{
CriticalSectionScoped cs(_sendCritsect);
WebRtc_UWord32 now = _clock.GetTimeInMS();
WebRtc_UWord32 dT = now -_keepAliveLastSent; // delta time in MS
WebRtc_UWord32 freqKHz = 90; // video
if(_audioConfigured)
{
freqKHz = _audio->AudioFrequency()/1000;
}
WebRtc_UWord32 dSamples = dT*freqKHz;
// set timestamp
_timeStamp += dSamples;
_keepAliveLastSent = now;
rtpHeaderLength = RTPHeaderLength();
// correct seq num, time stamp and payloadtype
BuildRTPheader(dataBuffer, _keepAlivePayloadType, false, 0, false);
}
return SendToNetwork(dataBuffer, 0, rtpHeaderLength, kAllowRetransmission);
}
WebRtc_Word32
RTPSender::SetMaxPayloadLength(const WebRtc_UWord16 maxPayloadLength, const WebRtc_UWord16 packetOverHead)
{
@ -673,8 +505,6 @@ RTPSender::SendOutgoingData(const FrameType frameType,
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id, "%s invalid argument failed to find payloadType:%d", __FUNCTION__, payloadType);
return -1;
}
// update keepalive so that we don't trigger keepalive messages while sending data
_keepAliveLastSent = _clock.GetTimeInMS();
if(_audioConfigured)
{

View File

@ -196,24 +196,6 @@ public:
bool ProcessNACKBitRate(const WebRtc_UWord32 now);
/*
* Keep alive
*/
WebRtc_Word32 EnableRTPKeepalive( const int unknownPayloadType,
const WebRtc_UWord16 deltaTransmitTimeMS);
WebRtc_Word32 RTPKeepaliveStatus(bool* enable,
int* unknownPayloadType,
WebRtc_UWord16* deltaTransmitTimeMS) const;
WebRtc_Word32 DisableRTPKeepalive();
bool RTPKeepalive() const;
bool TimeToSendRTPKeepalive() const;
WebRtc_Word32 SendRTPKeepalivePacket();
/*
* RTX
*/
@ -333,11 +315,6 @@ private:
RtpHeaderExtensionMap _rtpHeaderExtensionMap;
WebRtc_Word32 _transmissionTimeOffset;
bool _keepAliveIsActive;
WebRtc_Word8 _keepAlivePayloadType;
WebRtc_UWord32 _keepAliveLastSent;
WebRtc_UWord16 _keepAliveDeltaTimeSend;
// NACK
WebRtc_UWord32 _nackByteCountTimes[NACK_BYTECOUNT_SIZE];
WebRtc_Word32 _nackByteCount[NACK_BYTECOUNT_SIZE];