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:
minyue@webrtc.org
2014-04-02 15:03:01 +00:00
parent 1092ea0192
commit 7549ff4257
4 changed files with 20 additions and 19 deletions

View File

@@ -512,19 +512,6 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
memcpy(&main_header, &packet_list.front()->header, sizeof(main_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. // Check payload types.
if (decoder_database_->CheckPayloadTypes(packet_list) == if (decoder_database_->CheckPayloadTypes(packet_list) ==
DecoderDatabase::kDecoderNotFound) { 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 // Split payloads into smaller chunks. This also verifies that all payloads
// are of a known payload type. SplitAudio() method is protected against // are of a known payload type. SplitAudio() method is protected against
// sync-packets. // sync-packets.

View File

@@ -140,7 +140,10 @@ int PayloadSplitter::SplitFec(PacketList* packet_list,
// Not an FEC packet. // Not an FEC packet.
AudioDecoder* decoder = decoder_database->GetDecoder(payload_type); 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; ++it;
continue; continue;
} }
@@ -152,8 +155,7 @@ int PayloadSplitter::SplitFec(PacketList* packet_list,
new_packet->header = packet->header; new_packet->header = packet->header;
int duration = decoder-> int duration = decoder->
PacketDurationRedundant(packet->payload, PacketDurationRedundant(packet->payload, packet->payload_length);
packet->payload_length) * 3 / 2;
new_packet->header.timestamp -= duration; new_packet->header.timestamp -= duration;
new_packet->payload = new uint8_t[packet->payload_length]; new_packet->payload = new uint8_t[packet->payload_length];
memcpy(new_packet->payload, packet->payload, packet->payload_length); memcpy(new_packet->payload, packet->payload, packet->payload_length);

View File

@@ -743,7 +743,7 @@ TEST(FecPayloadSplitter, MixedPayload) {
// Check first packet. // Check first packet.
packet = packet_list.front(); packet = packet_list.front();
EXPECT_EQ(0, packet->header.payloadType); 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_EQ(10, packet->payload_length);
EXPECT_FALSE(packet->primary); EXPECT_FALSE(packet->primary);
delete [] packet->payload; delete [] packet->payload;

View File

@@ -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 // Use timestamp scaling with factor 2/3 (32 kHz sample rate, but RTP
// timestamps run on 48 kHz). // timestamps run on 48 kHz).
// TODO(tlegrand): Remove scaling for kDecoderCNGswb48kHz once ACM has // TODO(tlegrand): Remove scaling for kDecoderCNGswb48kHz once ACM has
// full 48 kHz support. Change also ought to be made in // full 48 kHz support.
// PayloadSplitter::SplitFec().
numerator_ = 2; numerator_ = 2;
denominator_ = 3; denominator_ = 3;
} }