Index: webrtc/media/engine/webrtcvoiceengine_unittest.cc |
diff --git a/webrtc/media/engine/webrtcvoiceengine_unittest.cc b/webrtc/media/engine/webrtcvoiceengine_unittest.cc |
index 6f0ff6334bd229989c7e7ba181abb3c2dc952b84..a6d0e30e424ab48c5d31e1bc17218d87dbcced3c 100644 |
--- a/webrtc/media/engine/webrtcvoiceengine_unittest.cc |
+++ b/webrtc/media/engine/webrtcvoiceengine_unittest.cc |
@@ -444,6 +444,7 @@ class WebRtcVoiceEngineTestFake : public testing::Test { |
stats.packets_lost = 9012; |
stats.fraction_lost = 34.56f; |
stats.codec_name = "codec_name_send"; |
+ stats.codec_payload_type = rtc::Optional<int>(42); |
stats.ext_seqnum = 789; |
stats.jitter_ms = 12; |
stats.rtt_ms = 345; |
@@ -471,6 +472,7 @@ class WebRtcVoiceEngineTestFake : public testing::Test { |
EXPECT_EQ(info.packets_lost, stats.packets_lost); |
EXPECT_EQ(info.fraction_lost, stats.fraction_lost); |
EXPECT_EQ(info.codec_name, stats.codec_name); |
+ EXPECT_EQ(info.codec_payload_type, stats.codec_payload_type); |
EXPECT_EQ(info.ext_seqnum, stats.ext_seqnum); |
EXPECT_EQ(info.jitter_ms, stats.jitter_ms); |
EXPECT_EQ(info.rtt_ms, stats.rtt_ms); |
@@ -494,6 +496,7 @@ class WebRtcVoiceEngineTestFake : public testing::Test { |
stats.packets_lost = 101; |
stats.fraction_lost = 23.45f; |
stats.codec_name = "codec_name_recv"; |
+ stats.codec_payload_type = rtc::Optional<int>(42); |
stats.ext_seqnum = 678; |
stats.jitter_ms = 901; |
stats.jitter_buffer_ms = 234; |
@@ -528,6 +531,7 @@ class WebRtcVoiceEngineTestFake : public testing::Test { |
EXPECT_EQ(info.packets_lost, stats.packets_lost); |
EXPECT_EQ(info.fraction_lost, stats.fraction_lost); |
EXPECT_EQ(info.codec_name, stats.codec_name); |
+ EXPECT_EQ(info.codec_payload_type, stats.codec_payload_type); |
EXPECT_EQ(info.ext_seqnum, stats.ext_seqnum); |
EXPECT_EQ(info.jitter_ms, stats.jitter_ms); |
EXPECT_EQ(info.jitter_buffer_ms, stats.jitter_buffer_ms); |
@@ -550,6 +554,20 @@ class WebRtcVoiceEngineTestFake : public testing::Test { |
EXPECT_EQ(info.decoding_muted_output, stats.decoding_muted_output); |
EXPECT_EQ(info.capture_start_ntp_time_ms, stats.capture_start_ntp_time_ms); |
} |
+ void VerifyVoiceSendRecvCodecs(const cricket::VoiceMediaInfo& info) const { |
+ EXPECT_EQ(send_parameters_.codecs.size(), info.send_codecs.size()); |
+ for (const cricket::AudioCodec& codec : send_parameters_.codecs) { |
+ ASSERT_EQ(info.send_codecs.count(codec.id), 1U); |
+ EXPECT_EQ(info.send_codecs.find(codec.id)->second, |
+ codec.ToCodecParameters()); |
+ } |
+ EXPECT_EQ(recv_parameters_.codecs.size(), info.receive_codecs.size()); |
+ for (const cricket::AudioCodec& codec : recv_parameters_.codecs) { |
+ ASSERT_EQ(info.receive_codecs.count(codec.id), 1U); |
+ EXPECT_EQ(info.receive_codecs.find(codec.id)->second, |
+ codec.ToCodecParameters()); |
+ } |
+ } |
protected: |
StrictMock<webrtc::test::MockAudioDeviceModule> adm_; |
@@ -2252,6 +2270,7 @@ TEST_F(WebRtcVoiceEngineTestFake, GetStatsWithMultipleSendStreams) { |
for (const auto& sender : info.senders) { |
VerifyVoiceSenderInfo(sender, false); |
} |
+ VerifyVoiceSendRecvCodecs(info); |
// We have added one receive stream. We should see empty stats. |
EXPECT_EQ(info.receivers.size(), 1u); |
@@ -2277,6 +2296,7 @@ TEST_F(WebRtcVoiceEngineTestFake, GetStatsWithMultipleSendStreams) { |
EXPECT_EQ(static_cast<size_t>(arraysize(kSsrcs4)), info.senders.size()); |
EXPECT_EQ(1u, info.receivers.size()); |
VerifyVoiceReceiverInfo(info.receivers[0]); |
+ VerifyVoiceSendRecvCodecs(info); |
} |
} |
@@ -2460,6 +2480,7 @@ TEST_F(WebRtcVoiceEngineTestFake, GetStats) { |
SetSend(true); |
EXPECT_EQ(true, channel_->GetStats(&info)); |
VerifyVoiceSenderInfo(info.senders[0], true); |
+ VerifyVoiceSendRecvCodecs(info); |
} |
// Remove the kSsrc2 stream. No receiver stats. |
@@ -2481,6 +2502,7 @@ TEST_F(WebRtcVoiceEngineTestFake, GetStats) { |
EXPECT_EQ(1u, info.senders.size()); |
EXPECT_EQ(1u, info.receivers.size()); |
VerifyVoiceReceiverInfo(info.receivers[0]); |
+ VerifyVoiceSendRecvCodecs(info); |
} |
} |