diff --git a/webrtc/modules/audio_coding/neteq4/interface/neteq.h b/webrtc/modules/audio_coding/neteq4/interface/neteq.h index 89051275e..6243bce1e 100644 --- a/webrtc/modules/audio_coding/neteq4/interface/neteq.h +++ b/webrtc/modules/audio_coding/neteq4/interface/neteq.h @@ -98,7 +98,8 @@ class NetEq { kDecodedTooMuch, kFrameSplitError, kRedundancySplitError, - kPacketBufferCorruption + kPacketBufferCorruption, + kOversizePacket }; static const int kMaxNumPacketsInBuffer = 240; // TODO(hlundin): Remove. diff --git a/webrtc/modules/audio_coding/neteq4/neteq_impl.cc b/webrtc/modules/audio_coding/neteq4/neteq_impl.cc index 8a286a02e..1d2c4d741 100644 --- a/webrtc/modules/audio_coding/neteq4/neteq_impl.cc +++ b/webrtc/modules/audio_coding/neteq4/neteq_impl.cc @@ -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 = diff --git a/webrtc/modules/audio_coding/neteq4/neteq_unittest.cc b/webrtc/modules/audio_coding/neteq4/neteq_unittest.cc index 1b3af036e..5ab2d1f31 100644 --- a/webrtc/modules/audio_coding/neteq4/neteq_unittest.cc +++ b/webrtc/modules/audio_coding/neteq4/neteq_unittest.cc @@ -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};