Better error treatment in NetEqImpl::InsertPacketInternal()

BUG=webrtc:1364
R=turaj@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4493 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
minyue@webrtc.org
2013-08-06 05:40:57 +00:00
parent 9721db799c
commit 7bb5436e5d
3 changed files with 18 additions and 3 deletions

View File

@ -98,7 +98,8 @@ class NetEq {
kDecodedTooMuch,
kFrameSplitError,
kRedundancySplitError,
kPacketBufferCorruption
kPacketBufferCorruption,
kOversizePacket
};
static const int kMaxNumPacketsInBuffer = 240; // TODO(hlundin): Remove.

View File

@ -508,11 +508,13 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
// Reset DSP timestamp etc. if packet buffer flushed.
new_codec_ = true;
LOG_F(LS_WARNING) << "Packet buffer flushed";
} else if (ret == PacketBuffer::kOversizePacket) {
LOG_F(LS_WARNING) << "Packet larger than packet buffer";
return kOversizePacket;
} else if (ret != PacketBuffer::kOK) {
LOG_FERR1(LS_WARNING, InsertPacketList, packet_list.size());
PacketBuffer::DeleteAllPackets(&packet_list);
assert(false);
// TODO(hlundin): Take care of error codes.
return kOtherError;
}
if (current_rtp_payload_type_ != 0xFF) {
const DecoderDatabase::DecoderInfo* dec_info =

View File

@ -658,6 +658,18 @@ TEST_F(NetEqDecodingTest, DISABLED_ON_ANDROID(UnknownPayloadType)) {
EXPECT_EQ(NetEq::kUnknownRtpPayloadType, neteq_->LastError());
}
TEST_F(NetEqDecodingTest, DISABLED_ON_ANDROID(OversizePacket)) {
// Payload size is greater than packet buffer size
const int kPayloadBytes = NetEq::kMaxBytesInBuffer + 1;
uint8_t payload[kPayloadBytes] = {0};
WebRtcRTPHeader rtp_info;
PopulateRtpInfo(0, 0, &rtp_info);
rtp_info.header.payloadType = 103; // iSAC, no packet splitting.
EXPECT_EQ(NetEq::kFail,
neteq_->InsertPacket(rtp_info, payload, kPayloadBytes, 0));
EXPECT_EQ(NetEq::kOversizePacket, neteq_->LastError());
}
TEST_F(NetEqDecodingTest, DISABLED_ON_ANDROID(DecoderError)) {
const int kPayloadBytes = 100;
uint8_t payload[kPayloadBytes] = {0};