Allow the FEC to protect up to maximum #packets (48) if the
media packet list is above this max. Review URL: http://webrtc-codereview.appspot.com/45005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@138 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
9d94116697
commit
67d7282900
@ -32,7 +32,7 @@ const WebRtc_UWord8 kUlpHeaderSizeLBitSet = (2 + kMaskSizeLBitSet);
|
||||
// ULP header size in bytes (L bit is cleared).
|
||||
const WebRtc_UWord8 kUlpHeaderSizeLBitClear = (2 + kMaskSizeLBitClear);
|
||||
|
||||
//Transport header size in bytes. Assume UDP/IPv4 as a reasonable minimum.
|
||||
// Transport header size in bytes. Assume UDP/IPv4 as a reasonable minimum.
|
||||
const WebRtc_UWord8 kTransportOverhead = 28;
|
||||
|
||||
//
|
||||
@ -118,13 +118,12 @@ ForwardErrorCorrection::GenerateFEC(const ListWrapper& mediaPacketList,
|
||||
(lBit == 1)? kUlpHeaderSizeLBitSet : kUlpHeaderSizeLBitClear;
|
||||
const WebRtc_UWord16 fecRtpOffset =
|
||||
kFecHeaderSize + ulpHeaderSize - kRtpHeaderSize;
|
||||
const WebRtc_UWord16 maxMediaPackets = numMaskBytes * 8;
|
||||
|
||||
if (numMediaPackets > maxMediaPackets)
|
||||
if (numMediaPackets > kMaxMediaPackets)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id,
|
||||
"%s can only protect %d media packets per frame; %d requested",
|
||||
__FUNCTION__, maxMediaPackets, numMediaPackets);
|
||||
__FUNCTION__, kMaxMediaPackets, numMediaPackets);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -174,7 +173,8 @@ ForwardErrorCorrection::GenerateFEC(const ListWrapper& mediaPacketList,
|
||||
}
|
||||
|
||||
// Result in Q0 with an unsigned round.
|
||||
WebRtc_UWord32 numFecPackets = (numMediaPackets * protectionFactor + (1 << 7)) >> 8;
|
||||
WebRtc_UWord32 numFecPackets = (numMediaPackets * protectionFactor +
|
||||
(1 << 7)) >> 8;
|
||||
if (numFecPackets == 0)
|
||||
{
|
||||
return 0;
|
||||
@ -283,8 +283,8 @@ ForwardErrorCorrection::GenerateFEC(const ListWrapper& mediaPacketList,
|
||||
{
|
||||
//Note: This shouldn't happen: means packet mask is wrong or poorly designed
|
||||
WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id,
|
||||
"Packet mask has row of zeros %d %d",
|
||||
numMediaPackets, numFecPackets);
|
||||
"Packet mask has row of zeros %d %d %d ",
|
||||
numMediaPackets, numImportantPackets, numFecPackets);
|
||||
delete packetMask;
|
||||
return -1;
|
||||
|
||||
|
@ -23,6 +23,10 @@ namespace webrtc {
|
||||
class ForwardErrorCorrection
|
||||
{
|
||||
public:
|
||||
|
||||
// Maximum number of media packets we can protect
|
||||
static const int kMaxMediaPackets = 48;
|
||||
|
||||
/**
|
||||
* The ListWrapper parameters of #GenerateFEC() should reference structs of this type.
|
||||
*/
|
||||
|
@ -163,7 +163,12 @@ RTPSenderVideo::SendVideoPacket(const FrameType frameType,
|
||||
|
||||
// Add packet to FEC list
|
||||
_rtpPacketListFec.PushBack(ptrGenericFEC);
|
||||
_mediaPacketListFec.PushBack(ptrGenericFEC->pkt);
|
||||
// FEC can only protect up to kMaxMediaPackets packets
|
||||
if (_mediaPacketListFec.GetSize() <
|
||||
ForwardErrorCorrection::kMaxMediaPackets)
|
||||
{
|
||||
_mediaPacketListFec.PushBack(ptrGenericFEC->pkt);
|
||||
}
|
||||
|
||||
// Last packet in frame
|
||||
if (markerBit)
|
||||
@ -182,6 +187,14 @@ RTPSenderVideo::SendVideoPacket(const FrameType frameType,
|
||||
// Replace payload and clear marker bit.
|
||||
lastMediaRtpHeader.data[1] = _payloadTypeRED;
|
||||
|
||||
// Number of first partition packets cannot exceed kMaxMediaPackets
|
||||
if (_numberFirstPartition >
|
||||
ForwardErrorCorrection::kMaxMediaPackets)
|
||||
{
|
||||
_numberFirstPartition =
|
||||
ForwardErrorCorrection::kMaxMediaPackets;
|
||||
}
|
||||
|
||||
retVal = _fec.GenerateFEC(_mediaPacketListFec, _fecProtectionFactor,
|
||||
_numberFirstPartition, fecPacketList);
|
||||
while(!_rtpPacketListFec.Empty())
|
||||
|
Loading…
Reference in New Issue
Block a user