Use correct rtp header size for FEC packets.

This is needed as of r2489 which introduced the header extension.

This also is a fix for issue 701.
Review URL: https://webrtc-codereview.appspot.com/708005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2537 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
marpan@webrtc.org
2012-07-30 18:17:02 +00:00
parent d1f3b1a113
commit 8639fd9341
4 changed files with 16 additions and 11 deletions

View File

@@ -15,8 +15,6 @@
namespace webrtc { namespace webrtc {
// Minimum RTP header size in bytes.
enum { kRtpHeaderSize = 12 };
enum { kREDForFECHeaderLength = 1 }; enum { kREDForFECHeaderLength = 1 };
// This controls the maximum amount of excess overhead (actual - target) // This controls the maximum amount of excess overhead (actual - target)
// allowed in order to trigger GenerateFEC(), before |params_.max_fec_frames| // allowed in order to trigger GenerateFEC(), before |params_.max_fec_frames|
@@ -209,8 +207,10 @@ bool ProducerFec::FecAvailable() const {
return (fec_packets_.size() > 0); return (fec_packets_.size() > 0);
} }
RedPacket* ProducerFec::GetFecPacket(int red_pl_type, int fec_pl_type, RedPacket* ProducerFec::GetFecPacket(int red_pl_type,
uint16_t seq_num) { int fec_pl_type,
uint16_t seq_num,
int rtp_header_length) {
if (fec_packets_.empty()) if (fec_packets_.empty())
return NULL; return NULL;
// Build FEC packet. The FEC packets in |fec_packets_| doesn't // Build FEC packet. The FEC packets in |fec_packets_| doesn't
@@ -220,9 +220,9 @@ RedPacket* ProducerFec::GetFecPacket(int red_pl_type, int fec_pl_type,
ForwardErrorCorrection::Packet* last_media_packet = media_packets_fec_.back(); ForwardErrorCorrection::Packet* last_media_packet = media_packets_fec_.back();
RedPacket* return_packet = new RedPacket(packet_to_send->length + RedPacket* return_packet = new RedPacket(packet_to_send->length +
kREDForFECHeaderLength + kREDForFECHeaderLength +
kRtpHeaderSize); rtp_header_length);
return_packet->CreateHeader(last_media_packet->data, return_packet->CreateHeader(last_media_packet->data,
kRtpHeaderSize, rtp_header_length,
red_pl_type, red_pl_type,
fec_pl_type); fec_pl_type);
return_packet->SetSeqNum(seq_num); return_packet->SetSeqNum(seq_num);

View File

@@ -60,8 +60,10 @@ class ProducerFec {
bool FecAvailable() const; bool FecAvailable() const;
RedPacket* GetFecPacket(int red_pl_type, int fec_pl_type, RedPacket* GetFecPacket(int red_pl_type,
uint16_t seq_num); int fec_pl_type,
uint16_t seq_num,
int rtp_header_length);
private: private:
void DeletePackets(); void DeletePackets();

View File

@@ -79,7 +79,8 @@ TEST_F(ProducerFecTest, OneFrameFec) {
uint16_t seq_num = generator_->NextSeqNum(); uint16_t seq_num = generator_->NextSeqNum();
RedPacket* packet = producer_->GetFecPacket(kRedPayloadType, RedPacket* packet = producer_->GetFecPacket(kRedPayloadType,
kFecPayloadType, kFecPayloadType,
seq_num); seq_num,
kRtpHeaderSize);
EXPECT_FALSE(producer_->FecAvailable()); EXPECT_FALSE(producer_->FecAvailable());
ASSERT_TRUE(packet != NULL); ASSERT_TRUE(packet != NULL);
VerifyHeader(seq_num, last_timestamp, VerifyHeader(seq_num, last_timestamp,
@@ -121,7 +122,8 @@ TEST_F(ProducerFecTest, TwoFrameFec) {
uint16_t seq_num = generator_->NextSeqNum(); uint16_t seq_num = generator_->NextSeqNum();
RedPacket* packet = producer_->GetFecPacket(kRedPayloadType, RedPacket* packet = producer_->GetFecPacket(kRedPayloadType,
kFecPayloadType, kFecPayloadType,
seq_num); seq_num,
kRtpHeaderSize);
EXPECT_FALSE(producer_->FecAvailable()); EXPECT_FALSE(producer_->FecAvailable());
EXPECT_TRUE(packet != NULL); EXPECT_TRUE(packet != NULL);
VerifyHeader(seq_num, last_timestamp, VerifyHeader(seq_num, last_timestamp,

View File

@@ -150,7 +150,8 @@ RTPSenderVideo::SendVideoPacket(WebRtc_UWord8* data_buffer,
red_packet = producer_fec_.GetFecPacket( red_packet = producer_fec_.GetFecPacket(
_payloadTypeRED, _payloadTypeRED,
_payloadTypeFEC, _payloadTypeFEC,
_rtpSender.IncrementSequenceNumber()); _rtpSender.IncrementSequenceNumber(),
rtp_header_length);
StorageType storage = kDontRetransmit; StorageType storage = kDontRetransmit;
if (_retransmissionSettings & kRetransmitFECPackets) { if (_retransmissionSettings & kRetransmitFECPackets) {
storage = kAllowRetransmission; storage = kAllowRetransmission;