This is to get rid of a bug relating to the return of NULL in calling GetDecoder when there are DTMF packets.
BUG=3140 TEST=trybots R=henrik.lundin@webrtc.org Review URL: https://webrtc-codereview.appspot.com/10929006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5830 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -512,19 +512,6 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
|
||||
memcpy(&main_header, &packet_list.front()->header, sizeof(main_header));
|
||||
}
|
||||
|
||||
// Check for FEC in packets, and separate payloads into several packets.
|
||||
int ret = payload_splitter_->SplitFec(&packet_list, decoder_database_.get());
|
||||
if (ret != PayloadSplitter::kOK) {
|
||||
LOG_FERR1(LS_WARNING, SplitFec, packet_list.size());
|
||||
PacketBuffer::DeleteAllPackets(&packet_list);
|
||||
switch (ret) {
|
||||
case PayloadSplitter::kUnknownPayloadType:
|
||||
return kUnknownRtpPayloadType;
|
||||
default:
|
||||
return kOtherError;
|
||||
}
|
||||
}
|
||||
|
||||
// Check payload types.
|
||||
if (decoder_database_->CheckPayloadTypes(packet_list) ==
|
||||
DecoderDatabase::kDecoderNotFound) {
|
||||
@@ -571,6 +558,19 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
|
||||
}
|
||||
}
|
||||
|
||||
// Check for FEC in packets, and separate payloads into several packets.
|
||||
int ret = payload_splitter_->SplitFec(&packet_list, decoder_database_.get());
|
||||
if (ret != PayloadSplitter::kOK) {
|
||||
LOG_FERR1(LS_WARNING, SplitFec, packet_list.size());
|
||||
PacketBuffer::DeleteAllPackets(&packet_list);
|
||||
switch (ret) {
|
||||
case PayloadSplitter::kUnknownPayloadType:
|
||||
return kUnknownRtpPayloadType;
|
||||
default:
|
||||
return kOtherError;
|
||||
}
|
||||
}
|
||||
|
||||
// Split payloads into smaller chunks. This also verifies that all payloads
|
||||
// are of a known payload type. SplitAudio() method is protected against
|
||||
// sync-packets.
|
||||
|
||||
@@ -140,7 +140,10 @@ int PayloadSplitter::SplitFec(PacketList* packet_list,
|
||||
|
||||
// Not an FEC packet.
|
||||
AudioDecoder* decoder = decoder_database->GetDecoder(payload_type);
|
||||
if (!decoder->PacketHasFec(packet->payload, packet->payload_length)) {
|
||||
// decoder should not return NULL.
|
||||
assert(decoder != NULL);
|
||||
if (!decoder ||
|
||||
!decoder->PacketHasFec(packet->payload, packet->payload_length)) {
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
@@ -152,8 +155,7 @@ int PayloadSplitter::SplitFec(PacketList* packet_list,
|
||||
|
||||
new_packet->header = packet->header;
|
||||
int duration = decoder->
|
||||
PacketDurationRedundant(packet->payload,
|
||||
packet->payload_length) * 3 / 2;
|
||||
PacketDurationRedundant(packet->payload, packet->payload_length);
|
||||
new_packet->header.timestamp -= duration;
|
||||
new_packet->payload = new uint8_t[packet->payload_length];
|
||||
memcpy(new_packet->payload, packet->payload, packet->payload_length);
|
||||
|
||||
@@ -743,7 +743,7 @@ TEST(FecPayloadSplitter, MixedPayload) {
|
||||
// Check first packet.
|
||||
packet = packet_list.front();
|
||||
EXPECT_EQ(0, packet->header.payloadType);
|
||||
EXPECT_EQ(kBaseTimestamp - 20 * 48, packet->header.timestamp);
|
||||
EXPECT_EQ(kBaseTimestamp - 20 * 32, packet->header.timestamp);
|
||||
EXPECT_EQ(10, packet->payload_length);
|
||||
EXPECT_FALSE(packet->primary);
|
||||
delete [] packet->payload;
|
||||
|
||||
@@ -55,8 +55,7 @@ uint32_t TimestampScaler::ToInternal(uint32_t external_timestamp,
|
||||
// Use timestamp scaling with factor 2/3 (32 kHz sample rate, but RTP
|
||||
// timestamps run on 48 kHz).
|
||||
// TODO(tlegrand): Remove scaling for kDecoderCNGswb48kHz once ACM has
|
||||
// full 48 kHz support. Change also ought to be made in
|
||||
// PayloadSplitter::SplitFec().
|
||||
// full 48 kHz support.
|
||||
numerator_ = 2;
|
||||
denominator_ = 3;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user