Incorrect overhead calculation when using FEC + RTP extension headers.

When frames are fragmented inte multiple RTP packets in order to not
exceed a maximum packet size, the header overhead calculation must
take into account that FEC redundancy packets may use more than the
12 bytes of the basic RTP header. For example, a csrc list or extension
headers may be present.

BUG=2899
R=phoglund@webrtc.org, stefan@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5562 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
sprang@webrtc.org
2014-02-18 08:40:33 +00:00
parent b60346e951
commit 346094cb01
7 changed files with 161 additions and 37 deletions

View File

@ -16,9 +16,6 @@
namespace webrtc {
enum {
kRtpHeaderSize = 12
};
enum {
kFecPayloadType = 96
};

View File

@ -17,15 +17,13 @@
#include <algorithm>
#include <iterator>
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
#include "webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
// Minimum RTP header size in bytes.
const uint8_t kRtpHeaderSize = 12;
// FEC header size in bytes.
const uint8_t kFecHeaderSize = 10;

View File

@ -301,9 +301,9 @@ uint16_t RTPSender::MaxDataPayloadLength() const {
if (audio_configured_) {
return max_payload_length_ - RTPHeaderLength();
} else {
return max_payload_length_ - RTPHeaderLength() -
video_->FECPacketOverhead() - ((rtx_) ? 2 : 0);
// Include the FEC/ULP/RED overhead.
return max_payload_length_ - RTPHeaderLength() // RTP overhead.
- video_->FECPacketOverhead() // FEC/ULP/RED overhead.
- ((rtx_) ? 2 : 0); // RTX overhead.
}
}

View File

@ -14,6 +14,7 @@
#include <stdlib.h>
#include <string.h>
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
#include "webrtc/modules/rtp_rtcp/source/producer_fec.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8.h"
@ -253,8 +254,13 @@ RTPSenderVideo::FECPacketOverhead() const
{
if (_fecEnabled)
{
return ForwardErrorCorrection::PacketOverhead() +
REDForFECHeaderLength;
// Overhead is FEC headers plus RED for FEC header plus anything in RTP
// header beyond the 12 bytes base header (CSRC list, extensions...)
// This reason for the header extensions to be included here is that
// from an FEC viewpoint, they are part of the payload to be protected.
// (The base RTP header is already protected by the FEC header.)
return ForwardErrorCorrection::PacketOverhead() + REDForFECHeaderLength +
(_rtpSender.RTPHeaderLength() - kRtpHeaderSize);
}
return 0;
}