Removed virtual from several methods in DecoderDatabase to minimize

the number of points that need to be mocked for testing.

For the now non-virtual methods, DecoderDatabase now does a lookup
through GetDecoderInfo and then delegates to the appropriate method in
the DecoderInfo object, if one is found.

A few other methods were also changed to look up through GetDecoderInfo.

Also moved the audio decoder factory into DecoderInfo, so that
DecoderInfo::GetDecoder can be used directly.

Review-Url: https://codereview.webrtc.org/2276913002
Cr-Commit-Position: refs/heads/master@{#13933}
This commit is contained in:
ossu
2016-08-26 05:41:23 -07:00
committed by Commit bot
parent c07c8bb626
commit 84bc98509b
5 changed files with 115 additions and 148 deletions

View File

@ -174,10 +174,6 @@ TEST(PacketBuffer, InsertPacketList) {
}
MockDecoderDatabase decoder_database;
EXPECT_CALL(decoder_database, IsComfortNoise(0))
.WillRepeatedly(Return(false));
EXPECT_CALL(decoder_database, IsDtmf(0))
.WillRepeatedly(Return(false));
uint8_t current_pt = 0xFF;
uint8_t current_cng_pt = 0xFF;
EXPECT_EQ(PacketBuffer::kOK, buffer.InsertPacketList(&list,
@ -216,10 +212,6 @@ TEST(PacketBuffer, InsertPacketListChangePayloadType) {
MockDecoderDatabase decoder_database;
EXPECT_CALL(decoder_database, IsComfortNoise(_))
.WillRepeatedly(Return(false));
EXPECT_CALL(decoder_database, IsDtmf(_))
.WillRepeatedly(Return(false));
uint8_t current_pt = 0xFF;
uint8_t current_cng_pt = 0xFF;
EXPECT_EQ(PacketBuffer::kFlushed, buffer.InsertPacketList(&list,
@ -349,10 +341,6 @@ TEST(PacketBuffer, Reordering) {
}
MockDecoderDatabase decoder_database;
EXPECT_CALL(decoder_database, IsComfortNoise(0))
.WillRepeatedly(Return(false));
EXPECT_CALL(decoder_database, IsDtmf(0))
.WillRepeatedly(Return(false));
uint8_t current_pt = 0xFF;
uint8_t current_cng_pt = 0xFF;
@ -424,10 +412,6 @@ TEST(PacketBuffer, Failures) {
list.push_back(packet);
list.push_back(gen.NextPacket(payload_len)); // Valid packet.
MockDecoderDatabase decoder_database;
EXPECT_CALL(decoder_database, IsComfortNoise(0))
.WillRepeatedly(Return(false));
EXPECT_CALL(decoder_database, IsDtmf(0))
.WillRepeatedly(Return(false));
uint8_t current_pt = 0xFF;
uint8_t current_cng_pt = 0xFF;
EXPECT_EQ(PacketBuffer::kInvalidPacket,