OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2008 Google Inc. | 3 * Copyright 2008 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "talk/media/base/constants.h" | 31 #include "talk/media/base/constants.h" |
32 #include "talk/media/base/fakemediaengine.h" | 32 #include "talk/media/base/fakemediaengine.h" |
33 #include "talk/media/base/fakenetworkinterface.h" | 33 #include "talk/media/base/fakenetworkinterface.h" |
34 #include "talk/media/base/fakertp.h" | 34 #include "talk/media/base/fakertp.h" |
35 #include "talk/media/webrtc/fakewebrtccall.h" | 35 #include "talk/media/webrtc/fakewebrtccall.h" |
36 #include "talk/media/webrtc/fakewebrtcvoiceengine.h" | 36 #include "talk/media/webrtc/fakewebrtcvoiceengine.h" |
37 #include "talk/media/webrtc/webrtcvoiceengine.h" | 37 #include "talk/media/webrtc/webrtcvoiceengine.h" |
38 #include "webrtc/p2p/base/faketransportcontroller.h" | 38 #include "webrtc/p2p/base/faketransportcontroller.h" |
39 #include "talk/session/media/channel.h" | 39 #include "talk/session/media/channel.h" |
40 | 40 |
| 41 // Tests for the WebRtcVoiceEngine/VoiceChannel code. |
| 42 |
41 using cricket::kRtpAudioLevelHeaderExtension; | 43 using cricket::kRtpAudioLevelHeaderExtension; |
42 using cricket::kRtpAbsoluteSenderTimeHeaderExtension; | 44 using cricket::kRtpAbsoluteSenderTimeHeaderExtension; |
43 | 45 |
44 namespace { | 46 static const cricket::AudioCodec kPcmuCodec(0, "PCMU", 8000, 64000, 1, 0); |
45 | 47 static const cricket::AudioCodec kIsacCodec(103, "ISAC", 16000, 32000, 1, 0); |
46 const cricket::AudioCodec kPcmuCodec(0, "PCMU", 8000, 64000, 1, 0); | 48 static const cricket::AudioCodec kOpusCodec(111, "opus", 48000, 64000, 2, 0); |
47 const cricket::AudioCodec kIsacCodec(103, "ISAC", 16000, 32000, 1, 0); | 49 static const cricket::AudioCodec kG722CodecVoE(9, "G722", 16000, 64000, 1, 0); |
48 const cricket::AudioCodec kOpusCodec(111, "opus", 48000, 64000, 2, 0); | 50 static const cricket::AudioCodec kG722CodecSdp(9, "G722", 8000, 64000, 1, 0); |
49 const cricket::AudioCodec kG722CodecVoE(9, "G722", 16000, 64000, 1, 0); | 51 static const cricket::AudioCodec kRedCodec(117, "red", 8000, 0, 1, 0); |
50 const cricket::AudioCodec kG722CodecSdp(9, "G722", 8000, 64000, 1, 0); | 52 static const cricket::AudioCodec kCn8000Codec(13, "CN", 8000, 0, 1, 0); |
51 const cricket::AudioCodec kRedCodec(117, "red", 8000, 0, 1, 0); | 53 static const cricket::AudioCodec kCn16000Codec(105, "CN", 16000, 0, 1, 0); |
52 const cricket::AudioCodec kCn8000Codec(13, "CN", 8000, 0, 1, 0); | 54 static const cricket::AudioCodec |
53 const cricket::AudioCodec kCn16000Codec(105, "CN", 16000, 0, 1, 0); | 55 kTelephoneEventCodec(106, "telephone-event", 8000, 0, 1, 0); |
54 const cricket::AudioCodec kTelephoneEventCodec(106, "telephone-event", 8000, 0, | 56 static const cricket::AudioCodec* const kAudioCodecs[] = { |
55 1, 0); | |
56 const cricket::AudioCodec* const kAudioCodecs[] = { | |
57 &kPcmuCodec, &kIsacCodec, &kOpusCodec, &kG722CodecVoE, &kRedCodec, | 57 &kPcmuCodec, &kIsacCodec, &kOpusCodec, &kG722CodecVoE, &kRedCodec, |
58 &kCn8000Codec, &kCn16000Codec, &kTelephoneEventCodec, | 58 &kCn8000Codec, &kCn16000Codec, &kTelephoneEventCodec, |
59 }; | 59 }; |
60 const uint32_t kSsrc1 = 0x99; | 60 static uint32_t kSsrc1 = 0x99; |
61 const uint32_t kSsrc2 = 0x98; | 61 static uint32_t kSsrc2 = 0x98; |
62 | 62 |
63 class FakeVoEWrapper : public cricket::VoEWrapper { | 63 class FakeVoEWrapper : public cricket::VoEWrapper { |
64 public: | 64 public: |
65 explicit FakeVoEWrapper(cricket::FakeWebRtcVoiceEngine* engine) | 65 explicit FakeVoEWrapper(cricket::FakeWebRtcVoiceEngine* engine) |
66 : cricket::VoEWrapper(engine, // processing | 66 : cricket::VoEWrapper(engine, // processing |
67 engine, // base | 67 engine, // base |
68 engine, // codec | 68 engine, // codec |
69 engine, // dtmf | 69 engine, // dtmf |
70 engine, // hw | 70 engine, // hw |
| 71 engine, // neteq |
71 engine, // network | 72 engine, // network |
72 engine, // rtp | 73 engine, // rtp |
| 74 engine, // sync |
73 engine) { // volume | 75 engine) { // volume |
74 } | 76 } |
75 }; | 77 }; |
76 | 78 |
77 class FakeVoETraceWrapper : public cricket::VoETraceWrapper { | 79 class FakeVoETraceWrapper : public cricket::VoETraceWrapper { |
78 public: | 80 public: |
79 int SetTraceFilter(const unsigned int filter) override { | 81 int SetTraceFilter(const unsigned int filter) override { |
80 filter_ = filter; | 82 filter_ = filter; |
81 return 0; | 83 return 0; |
82 } | 84 } |
83 int SetTraceFile(const char* fileNameUTF8) override { return 0; } | 85 int SetTraceFile(const char* fileNameUTF8) override { return 0; } |
84 int SetTraceCallback(webrtc::TraceCallback* callback) override { return 0; } | 86 int SetTraceCallback(webrtc::TraceCallback* callback) override { return 0; } |
85 unsigned int filter_; | 87 unsigned int filter_; |
86 }; | 88 }; |
87 } // namespace | |
88 | 89 |
89 class WebRtcVoiceEngineTestFake : public testing::Test { | 90 class WebRtcVoiceEngineTestFake : public testing::Test { |
90 public: | 91 public: |
91 WebRtcVoiceEngineTestFake() | 92 WebRtcVoiceEngineTestFake() |
92 : call_(webrtc::Call::Config()), | 93 : call_(webrtc::Call::Config()), |
93 voe_(kAudioCodecs, ARRAY_SIZE(kAudioCodecs)), | 94 voe_(kAudioCodecs, ARRAY_SIZE(kAudioCodecs)), |
94 trace_wrapper_(new FakeVoETraceWrapper()), | 95 trace_wrapper_(new FakeVoETraceWrapper()), |
95 engine_(new FakeVoEWrapper(&voe_), trace_wrapper_), | 96 engine_(new FakeVoEWrapper(&voe_), trace_wrapper_), |
96 channel_(nullptr) { | 97 channel_(nullptr) { |
97 send_parameters_.codecs.push_back(kPcmuCodec); | 98 send_parameters_.codecs.push_back(kPcmuCodec); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 EXPECT_NE(channel_num, new_channel_num); | 286 EXPECT_NE(channel_num, new_channel_num); |
286 EXPECT_EQ(id, voe_.GetReceiveRtpExtensionId(new_channel_num, ext)); | 287 EXPECT_EQ(id, voe_.GetReceiveRtpExtensionId(new_channel_num, ext)); |
287 | 288 |
288 // Ensure all extensions go back off with an empty list. | 289 // Ensure all extensions go back off with an empty list. |
289 parameters.extensions.clear(); | 290 parameters.extensions.clear(); |
290 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); | 291 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
291 EXPECT_EQ(-1, voe_.GetReceiveRtpExtensionId(channel_num, ext)); | 292 EXPECT_EQ(-1, voe_.GetReceiveRtpExtensionId(channel_num, ext)); |
292 EXPECT_EQ(-1, voe_.GetReceiveRtpExtensionId(new_channel_num, ext)); | 293 EXPECT_EQ(-1, voe_.GetReceiveRtpExtensionId(new_channel_num, ext)); |
293 } | 294 } |
294 | 295 |
295 const webrtc::AudioReceiveStream::Stats& GetAudioReceiveStreamStats() const { | |
296 static webrtc::AudioReceiveStream::Stats stats; | |
297 if (stats.remote_ssrc == 0) { | |
298 stats.remote_ssrc = 123; | |
299 stats.bytes_rcvd = 456; | |
300 stats.packets_rcvd = 768; | |
301 stats.packets_lost = 101; | |
302 stats.fraction_lost = 23.45f; | |
303 stats.codec_name = "codec_name"; | |
304 stats.ext_seqnum = 678; | |
305 stats.jitter_ms = 901; | |
306 stats.jitter_buffer_ms = 234; | |
307 stats.jitter_buffer_preferred_ms = 567; | |
308 stats.delay_estimate_ms = 890; | |
309 stats.audio_level = 1234; | |
310 stats.expand_rate = 5.67f; | |
311 stats.speech_expand_rate = 8.90f; | |
312 stats.secondary_decoded_rate = 1.23f; | |
313 stats.accelerate_rate = 4.56f; | |
314 stats.preemptive_expand_rate = 7.89f; | |
315 stats.decoding_calls_to_silence_generator = 012; | |
316 stats.decoding_calls_to_neteq = 345; | |
317 stats.decoding_normal = 67890; | |
318 stats.decoding_plc = 1234; | |
319 stats.decoding_cng = 5678; | |
320 stats.decoding_plc_cng = 9012; | |
321 stats.capture_start_ntp_time_ms = 3456; | |
322 } | |
323 return stats; | |
324 } | |
325 void SetAudioReceiveStreamStats() { | |
326 for (auto* s : call_.GetAudioReceiveStreams()) { | |
327 s->SetStats(GetAudioReceiveStreamStats()); | |
328 } | |
329 } | |
330 void VerifyVoiceReceiverInfo(const cricket::VoiceReceiverInfo& info) { | |
331 const auto& kStats = GetAudioReceiveStreamStats(); | |
332 EXPECT_EQ(info.local_stats.front().ssrc, kStats.remote_ssrc); | |
333 EXPECT_EQ(info.bytes_rcvd, kStats.bytes_rcvd); | |
334 EXPECT_EQ(info.packets_rcvd, kStats.packets_rcvd); | |
335 EXPECT_EQ(info.packets_lost, kStats.packets_lost); | |
336 EXPECT_EQ(info.fraction_lost, kStats.fraction_lost); | |
337 EXPECT_EQ(info.codec_name, kStats.codec_name); | |
338 EXPECT_EQ(info.ext_seqnum, kStats.ext_seqnum); | |
339 EXPECT_EQ(info.jitter_ms, kStats.jitter_ms); | |
340 EXPECT_EQ(info.jitter_buffer_ms, kStats.jitter_buffer_ms); | |
341 EXPECT_EQ(info.jitter_buffer_preferred_ms, | |
342 kStats.jitter_buffer_preferred_ms); | |
343 EXPECT_EQ(info.delay_estimate_ms, kStats.delay_estimate_ms); | |
344 EXPECT_EQ(info.audio_level, kStats.audio_level); | |
345 EXPECT_EQ(info.expand_rate, kStats.expand_rate); | |
346 EXPECT_EQ(info.speech_expand_rate, kStats.speech_expand_rate); | |
347 EXPECT_EQ(info.secondary_decoded_rate, kStats.secondary_decoded_rate); | |
348 EXPECT_EQ(info.accelerate_rate, kStats.accelerate_rate); | |
349 EXPECT_EQ(info.preemptive_expand_rate, kStats.preemptive_expand_rate); | |
350 EXPECT_EQ(info.decoding_calls_to_silence_generator, | |
351 kStats.decoding_calls_to_silence_generator); | |
352 EXPECT_EQ(info.decoding_calls_to_neteq, kStats.decoding_calls_to_neteq); | |
353 EXPECT_EQ(info.decoding_normal, kStats.decoding_normal); | |
354 EXPECT_EQ(info.decoding_plc, kStats.decoding_plc); | |
355 EXPECT_EQ(info.decoding_cng, kStats.decoding_cng); | |
356 EXPECT_EQ(info.decoding_plc_cng, kStats.decoding_plc_cng); | |
357 EXPECT_EQ(info.capture_start_ntp_time_ms, kStats.capture_start_ntp_time_ms); | |
358 } | |
359 | |
360 protected: | 296 protected: |
361 cricket::FakeCall call_; | 297 cricket::FakeCall call_; |
362 cricket::FakeWebRtcVoiceEngine voe_; | 298 cricket::FakeWebRtcVoiceEngine voe_; |
363 FakeVoETraceWrapper* trace_wrapper_; | 299 FakeVoETraceWrapper* trace_wrapper_; |
364 cricket::WebRtcVoiceEngine engine_; | 300 cricket::WebRtcVoiceEngine engine_; |
365 cricket::VoiceMediaChannel* channel_; | 301 cricket::VoiceMediaChannel* channel_; |
366 | 302 |
367 cricket::AudioSendParameters send_parameters_; | 303 cricket::AudioSendParameters send_parameters_; |
368 cricket::AudioRecvParameters recv_parameters_; | 304 cricket::AudioRecvParameters recv_parameters_; |
369 cricket::AudioOptions options_adjust_agc_; | 305 cricket::AudioOptions options_adjust_agc_; |
(...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 EXPECT_EQ(kPcmuCodec.name, info.senders[i].codec_name); | 2001 EXPECT_EQ(kPcmuCodec.name, info.senders[i].codec_name); |
2066 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].bytes_sent); | 2002 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].bytes_sent); |
2067 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].packets_sent); | 2003 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].packets_sent); |
2068 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].packets_lost); | 2004 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].packets_lost); |
2069 EXPECT_EQ(cricket::kFractionLostStatValue, info.senders[i].fraction_lost); | 2005 EXPECT_EQ(cricket::kFractionLostStatValue, info.senders[i].fraction_lost); |
2070 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].ext_seqnum); | 2006 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].ext_seqnum); |
2071 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].rtt_ms); | 2007 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].rtt_ms); |
2072 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].jitter_ms); | 2008 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].jitter_ms); |
2073 EXPECT_EQ(kPcmuCodec.name, info.senders[i].codec_name); | 2009 EXPECT_EQ(kPcmuCodec.name, info.senders[i].codec_name); |
2074 } | 2010 } |
| 2011 EXPECT_EQ(0u, info.receivers.size()); |
2075 | 2012 |
2076 // We have added one receive stream. We should see empty stats. | 2013 // Registered stream's remote SSRC is kSsrc2. Send a packet with SSRC=1. |
2077 EXPECT_EQ(info.receivers.size(), 1u); | 2014 // We should drop the packet and no stats should be available. |
2078 EXPECT_EQ(info.receivers[0].local_stats.front().ssrc, 0); | 2015 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); |
2079 | |
2080 // Remove the kSsrc2 stream. No receiver stats. | |
2081 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc2)); | |
2082 EXPECT_EQ(true, channel_->GetStats(&info)); | 2016 EXPECT_EQ(true, channel_->GetStats(&info)); |
2083 EXPECT_EQ(0u, info.receivers.size()); | 2017 EXPECT_EQ(0u, info.receivers.size()); |
2084 | 2018 |
2085 // Deliver a new packet - a default receive stream should be created and we | 2019 // Remove the kSsrc2 stream and deliver a new packet - a default receive |
2086 // should see stats again. | 2020 // stream should be created and we should see stats. |
| 2021 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc2)); |
2087 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); | 2022 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); |
2088 SetAudioReceiveStreamStats(); | |
2089 EXPECT_EQ(true, channel_->GetStats(&info)); | 2023 EXPECT_EQ(true, channel_->GetStats(&info)); |
2090 EXPECT_EQ(1u, info.receivers.size()); | 2024 EXPECT_EQ(1u, info.receivers.size()); |
2091 VerifyVoiceReceiverInfo(info.receivers[0]); | 2025 |
| 2026 EXPECT_EQ(cricket::kIntStatValue, info.receivers[0].bytes_rcvd); |
| 2027 EXPECT_EQ(cricket::kIntStatValue, info.receivers[0].packets_rcvd); |
| 2028 EXPECT_EQ(cricket::kIntStatValue, info.receivers[0].packets_lost); |
| 2029 EXPECT_EQ(cricket::kIntStatValue, info.receivers[0].ext_seqnum); |
| 2030 EXPECT_EQ(kPcmuCodec.name, info.receivers[0].codec_name); |
| 2031 EXPECT_EQ(static_cast<float>(cricket::kNetStats.currentExpandRate) / |
| 2032 (1 << 14), info.receivers[0].expand_rate); |
| 2033 EXPECT_EQ(static_cast<float>(cricket::kNetStats.currentSpeechExpandRate) / |
| 2034 (1 << 14), info.receivers[0].speech_expand_rate); |
| 2035 EXPECT_EQ(static_cast<float>(cricket::kNetStats.currentSecondaryDecodedRate) / |
| 2036 (1 << 14), info.receivers[0].secondary_decoded_rate); |
| 2037 EXPECT_EQ( |
| 2038 static_cast<float>(cricket::kNetStats.currentAccelerateRate) / (1 << 14), |
| 2039 info.receivers[0].accelerate_rate); |
| 2040 EXPECT_EQ( |
| 2041 static_cast<float>(cricket::kNetStats.currentPreemptiveRate) / (1 << 14), |
| 2042 info.receivers[0].preemptive_expand_rate); |
2092 } | 2043 } |
2093 | 2044 |
2094 // Test that we can add and remove receive streams, and do proper send/playout. | 2045 // Test that we can add and remove receive streams, and do proper send/playout. |
2095 // We can receive on multiple streams while sending one stream. | 2046 // We can receive on multiple streams while sending one stream. |
2096 TEST_F(WebRtcVoiceEngineTestFake, PlayoutWithMultipleStreams) { | 2047 TEST_F(WebRtcVoiceEngineTestFake, PlayoutWithMultipleStreams) { |
2097 EXPECT_TRUE(SetupEngineWithSendStream()); | 2048 EXPECT_TRUE(SetupEngineWithSendStream()); |
2098 int channel_num1 = voe_.GetLastChannel(); | 2049 int channel_num1 = voe_.GetLastChannel(); |
2099 | 2050 |
2100 // Start playout without a receive stream. | 2051 // Start playout without a receive stream. |
2101 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | 2052 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2342 EXPECT_EQ(cricket::kIntStatValue, info.senders[0].jitter_ms); | 2293 EXPECT_EQ(cricket::kIntStatValue, info.senders[0].jitter_ms); |
2343 EXPECT_EQ(kPcmuCodec.name, info.senders[0].codec_name); | 2294 EXPECT_EQ(kPcmuCodec.name, info.senders[0].codec_name); |
2344 // TODO(sriniv): Add testing for more fields. These are not populated | 2295 // TODO(sriniv): Add testing for more fields. These are not populated |
2345 // in FakeWebrtcVoiceEngine yet. | 2296 // in FakeWebrtcVoiceEngine yet. |
2346 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].audio_level); | 2297 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].audio_level); |
2347 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].echo_delay_median_ms); | 2298 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].echo_delay_median_ms); |
2348 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].echo_delay_std_ms); | 2299 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].echo_delay_std_ms); |
2349 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].echo_return_loss); | 2300 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].echo_return_loss); |
2350 // EXPECT_EQ(cricket::kIntStatValue, | 2301 // EXPECT_EQ(cricket::kIntStatValue, |
2351 // info.senders[0].echo_return_loss_enhancement); | 2302 // info.senders[0].echo_return_loss_enhancement); |
2352 // We have added one receive stream. We should see empty stats. | 2303 EXPECT_EQ(0u, info.receivers.size()); |
2353 EXPECT_EQ(info.receivers.size(), 1u); | |
2354 EXPECT_EQ(info.receivers[0].local_stats.front().ssrc, 0); | |
2355 | 2304 |
2356 // Remove the kSsrc2 stream. No receiver stats. | 2305 // Registered stream's remote SSRC is kSsrc2. Send a packet with SSRC=1. |
2357 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc2)); | 2306 // We should drop the packet and no stats should be available. |
| 2307 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); |
2358 EXPECT_EQ(true, channel_->GetStats(&info)); | 2308 EXPECT_EQ(true, channel_->GetStats(&info)); |
2359 EXPECT_EQ(0u, info.receivers.size()); | 2309 EXPECT_EQ(0u, info.receivers.size()); |
2360 | 2310 |
2361 // Deliver a new packet - a default receive stream should be created and we | 2311 // Remove the kSsrc2 stream and deliver a new packet - a default receive |
2362 // should see stats again. | 2312 // stream should be created and we should see stats. |
| 2313 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc2)); |
2363 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); | 2314 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); |
2364 SetAudioReceiveStreamStats(); | |
2365 EXPECT_EQ(true, channel_->GetStats(&info)); | 2315 EXPECT_EQ(true, channel_->GetStats(&info)); |
2366 EXPECT_EQ(1u, info.receivers.size()); | 2316 EXPECT_EQ(1u, info.receivers.size()); |
2367 VerifyVoiceReceiverInfo(info.receivers[0]); | 2317 |
| 2318 EXPECT_EQ(cricket::kIntStatValue, info.receivers[0].bytes_rcvd); |
| 2319 EXPECT_EQ(cricket::kIntStatValue, info.receivers[0].packets_rcvd); |
| 2320 EXPECT_EQ(cricket::kIntStatValue, info.receivers[0].packets_lost); |
| 2321 EXPECT_EQ(cricket::kIntStatValue, info.receivers[0].ext_seqnum); |
| 2322 EXPECT_EQ(kPcmuCodec.name, info.receivers[0].codec_name); |
| 2323 EXPECT_EQ(static_cast<float>(cricket::kNetStats.currentExpandRate) / |
| 2324 (1 << 14), info.receivers[0].expand_rate); |
| 2325 EXPECT_EQ(static_cast<float>(cricket::kNetStats.currentSpeechExpandRate) / |
| 2326 (1 << 14), info.receivers[0].speech_expand_rate); |
| 2327 EXPECT_EQ(static_cast<float>(cricket::kNetStats.currentSecondaryDecodedRate) / |
| 2328 (1 << 14), info.receivers[0].secondary_decoded_rate); |
| 2329 // TODO(sriniv): Add testing for more receiver fields. |
2368 } | 2330 } |
2369 | 2331 |
2370 // Test that we can set the outgoing SSRC properly with multiple streams. | 2332 // Test that we can set the outgoing SSRC properly with multiple streams. |
2371 // SSRC is set in SetupEngine by calling AddSendStream. | 2333 // SSRC is set in SetupEngine by calling AddSendStream. |
2372 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrcWithMultipleStreams) { | 2334 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrcWithMultipleStreams) { |
2373 EXPECT_TRUE(SetupEngineWithSendStream()); | 2335 EXPECT_TRUE(SetupEngineWithSendStream()); |
2374 int channel_num1 = voe_.GetLastChannel(); | 2336 int channel_num1 = voe_.GetLastChannel(); |
2375 unsigned int send_ssrc; | 2337 unsigned int send_ssrc; |
2376 EXPECT_EQ(0, voe_.GetLocalSSRC(channel_num1, send_ssrc)); | 2338 EXPECT_EQ(0, voe_.GetLocalSSRC(channel_num1, send_ssrc)); |
2377 EXPECT_EQ(kSsrc1, send_ssrc); | 2339 EXPECT_EQ(kSsrc1, send_ssrc); |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3296 cricket::WebRtcVoiceEngine engine; | 3258 cricket::WebRtcVoiceEngine engine; |
3297 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); | 3259 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); |
3298 rtc::scoped_ptr<webrtc::Call> call( | 3260 rtc::scoped_ptr<webrtc::Call> call( |
3299 webrtc::Call::Create(webrtc::Call::Config())); | 3261 webrtc::Call::Create(webrtc::Call::Config())); |
3300 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), | 3262 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), |
3301 call.get()); | 3263 call.get()); |
3302 cricket::AudioRecvParameters parameters; | 3264 cricket::AudioRecvParameters parameters; |
3303 parameters.codecs = engine.codecs(); | 3265 parameters.codecs = engine.codecs(); |
3304 EXPECT_TRUE(channel.SetRecvParameters(parameters)); | 3266 EXPECT_TRUE(channel.SetRecvParameters(parameters)); |
3305 } | 3267 } |
OLD | NEW |