NetEq: Simplify DecoderDatabase::DecoderInfo

By eliminating one of the two constructors, handling decoder ownership
with a unique_ptr instead of a raw pointer, and making all member
variables const (except one, which is made private instead).

BUG=webrtc:5801

Review URL: https://codereview.webrtc.org/1899733002

Cr-Commit-Position: refs/heads/master@{#12425}
This commit is contained in:
kwiberg
2016-04-19 05:03:45 -07:00
committed by Commit bot
parent f3669661bd
commit 0fa0a97cf3
6 changed files with 102 additions and 92 deletions

View File

@ -53,10 +53,9 @@ TEST(DecoderDatabase, GetDecoderInfo) {
info = db.GetDecoderInfo(kPayloadType);
ASSERT_TRUE(info != NULL);
EXPECT_EQ(NetEqDecoder::kDecoderPCMu, info->codec_type);
EXPECT_EQ(NULL, info->decoder);
EXPECT_EQ(nullptr, info->external_decoder);
EXPECT_EQ(8000, info->fs_hz);
EXPECT_EQ(kCodecName, info->name);
EXPECT_FALSE(info->external);
info = db.GetDecoderInfo(kPayloadType + 1); // Other payload type.
EXPECT_TRUE(info == NULL); // Should not be found.
}
@ -139,9 +138,8 @@ TEST(DecoderDatabase, ExternalDecoder) {
ASSERT_TRUE(info != NULL);
EXPECT_EQ(NetEqDecoder::kDecoderPCMu, info->codec_type);
EXPECT_EQ(kCodecName, info->name);
EXPECT_EQ(&decoder, info->decoder);
EXPECT_EQ(&decoder, info->external_decoder);
EXPECT_EQ(8000, info->fs_hz);
EXPECT_TRUE(info->external);
// Expect not to delete the decoder when removing it from the database, since
// it was declared externally.
EXPECT_CALL(decoder, Die()).Times(0);