Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: talk/media/webrtc/webrtcvoiceengine_unittest.cc

Issue 1390753002: Implement AudioReceiveStream::GetStats(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: merge master Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « talk/media/webrtc/webrtcvoiceengine.cc ('k') | webrtc/audio/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
43 using cricket::kRtpAudioLevelHeaderExtension; 41 using cricket::kRtpAudioLevelHeaderExtension;
44 using cricket::kRtpAbsoluteSenderTimeHeaderExtension; 42 using cricket::kRtpAbsoluteSenderTimeHeaderExtension;
45 43
46 static const cricket::AudioCodec kPcmuCodec(0, "PCMU", 8000, 64000, 1, 0); 44 namespace {
47 static const cricket::AudioCodec kIsacCodec(103, "ISAC", 16000, 32000, 1, 0); 45
48 static const cricket::AudioCodec kOpusCodec(111, "opus", 48000, 64000, 2, 0); 46 const cricket::AudioCodec kPcmuCodec(0, "PCMU", 8000, 64000, 1, 0);
49 static const cricket::AudioCodec kG722CodecVoE(9, "G722", 16000, 64000, 1, 0); 47 const cricket::AudioCodec kIsacCodec(103, "ISAC", 16000, 32000, 1, 0);
50 static const cricket::AudioCodec kG722CodecSdp(9, "G722", 8000, 64000, 1, 0); 48 const cricket::AudioCodec kOpusCodec(111, "opus", 48000, 64000, 2, 0);
51 static const cricket::AudioCodec kRedCodec(117, "red", 8000, 0, 1, 0); 49 const cricket::AudioCodec kG722CodecVoE(9, "G722", 16000, 64000, 1, 0);
52 static const cricket::AudioCodec kCn8000Codec(13, "CN", 8000, 0, 1, 0); 50 const cricket::AudioCodec kG722CodecSdp(9, "G722", 8000, 64000, 1, 0);
53 static const cricket::AudioCodec kCn16000Codec(105, "CN", 16000, 0, 1, 0); 51 const cricket::AudioCodec kRedCodec(117, "red", 8000, 0, 1, 0);
54 static const cricket::AudioCodec 52 const cricket::AudioCodec kCn8000Codec(13, "CN", 8000, 0, 1, 0);
55 kTelephoneEventCodec(106, "telephone-event", 8000, 0, 1, 0); 53 const cricket::AudioCodec kCn16000Codec(105, "CN", 16000, 0, 1, 0);
56 static const cricket::AudioCodec* const kAudioCodecs[] = { 54 const cricket::AudioCodec kTelephoneEventCodec(106, "telephone-event", 8000, 0,
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 static uint32_t kSsrc1 = 0x99; 60 static uint32_t kSsrc1 = 0x99;
61 static uint32_t kSsrc2 = 0x98; 61 static uint32_t kSsrc2 = 0x98;
62 static const uint32_t kSsrcs4[] = {1, 2, 3, 4}; 62 static const uint32_t kSsrcs4[] = {1, 2, 3, 4};
63 63
64 class FakeVoEWrapper : public cricket::VoEWrapper { 64 class FakeVoEWrapper : public cricket::VoEWrapper {
65 public: 65 public:
66 explicit FakeVoEWrapper(cricket::FakeWebRtcVoiceEngine* engine) 66 explicit FakeVoEWrapper(cricket::FakeWebRtcVoiceEngine* engine)
67 : cricket::VoEWrapper(engine, // processing 67 : cricket::VoEWrapper(engine, // processing
68 engine, // base 68 engine, // base
69 engine, // codec 69 engine, // codec
70 engine, // dtmf 70 engine, // dtmf
71 engine, // hw 71 engine, // hw
72 engine, // neteq
73 engine, // network 72 engine, // network
74 engine, // rtp 73 engine, // rtp
75 engine, // sync
76 engine) { // volume 74 engine) { // volume
77 } 75 }
78 }; 76 };
79 77
80 class FakeVoETraceWrapper : public cricket::VoETraceWrapper { 78 class FakeVoETraceWrapper : public cricket::VoETraceWrapper {
81 public: 79 public:
82 int SetTraceFilter(const unsigned int filter) override { 80 int SetTraceFilter(const unsigned int filter) override {
83 filter_ = filter; 81 filter_ = filter;
84 return 0; 82 return 0;
85 } 83 }
86 int SetTraceFile(const char* fileNameUTF8) override { return 0; } 84 int SetTraceFile(const char* fileNameUTF8) override { return 0; }
87 int SetTraceCallback(webrtc::TraceCallback* callback) override { return 0; } 85 int SetTraceCallback(webrtc::TraceCallback* callback) override { return 0; }
88 unsigned int filter_; 86 unsigned int filter_;
89 }; 87 };
88 } // namespace
90 89
91 class WebRtcVoiceEngineTestFake : public testing::Test { 90 class WebRtcVoiceEngineTestFake : public testing::Test {
92 public: 91 public:
93 WebRtcVoiceEngineTestFake() 92 WebRtcVoiceEngineTestFake()
94 : call_(webrtc::Call::Config()), 93 : call_(webrtc::Call::Config()),
95 voe_(kAudioCodecs, ARRAY_SIZE(kAudioCodecs)), 94 voe_(kAudioCodecs, ARRAY_SIZE(kAudioCodecs)),
96 trace_wrapper_(new FakeVoETraceWrapper()), 95 trace_wrapper_(new FakeVoETraceWrapper()),
97 engine_(new FakeVoEWrapper(&voe_), trace_wrapper_), 96 engine_(new FakeVoEWrapper(&voe_), trace_wrapper_),
98 channel_(nullptr) { 97 channel_(nullptr) {
99 send_parameters_.codecs.push_back(kPcmuCodec); 98 send_parameters_.codecs.push_back(kPcmuCodec);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 EXPECT_NE(channel_num, new_channel_num); 283 EXPECT_NE(channel_num, new_channel_num);
285 EXPECT_EQ(id, voe_.GetReceiveRtpExtensionId(new_channel_num, ext)); 284 EXPECT_EQ(id, voe_.GetReceiveRtpExtensionId(new_channel_num, ext));
286 285
287 // Ensure all extensions go back off with an empty list. 286 // Ensure all extensions go back off with an empty list.
288 parameters.extensions.clear(); 287 parameters.extensions.clear();
289 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); 288 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
290 EXPECT_EQ(-1, voe_.GetReceiveRtpExtensionId(channel_num, ext)); 289 EXPECT_EQ(-1, voe_.GetReceiveRtpExtensionId(channel_num, ext));
291 EXPECT_EQ(-1, voe_.GetReceiveRtpExtensionId(new_channel_num, ext)); 290 EXPECT_EQ(-1, voe_.GetReceiveRtpExtensionId(new_channel_num, ext));
292 } 291 }
293 292
293 const webrtc::AudioReceiveStream::Stats& GetAudioReceiveStreamStats() const {
294 static webrtc::AudioReceiveStream::Stats stats;
295 if (stats.remote_ssrc == 0) {
296 stats.remote_ssrc = 123;
297 stats.bytes_rcvd = 456;
298 stats.packets_rcvd = 768;
299 stats.packets_lost = 101;
300 stats.fraction_lost = 23.45f;
301 stats.codec_name = "codec_name";
302 stats.ext_seqnum = 678;
303 stats.jitter_ms = 901;
304 stats.jitter_buffer_ms = 234;
305 stats.jitter_buffer_preferred_ms = 567;
306 stats.delay_estimate_ms = 890;
307 stats.audio_level = 1234;
308 stats.expand_rate = 5.67f;
309 stats.speech_expand_rate = 8.90f;
310 stats.secondary_decoded_rate = 1.23f;
311 stats.accelerate_rate = 4.56f;
312 stats.preemptive_expand_rate = 7.89f;
313 stats.decoding_calls_to_silence_generator = 012;
314 stats.decoding_calls_to_neteq = 345;
315 stats.decoding_normal = 67890;
316 stats.decoding_plc = 1234;
317 stats.decoding_cng = 5678;
318 stats.decoding_plc_cng = 9012;
319 stats.capture_start_ntp_time_ms = 3456;
320 }
321 return stats;
322 }
323 void SetAudioReceiveStreamStats() {
324 for (auto* s : call_.GetAudioReceiveStreams()) {
325 s->SetStats(GetAudioReceiveStreamStats());
326 }
327 }
328 void VerifyVoiceReceiverInfo(const cricket::VoiceReceiverInfo& info) {
329 const auto& kStats = GetAudioReceiveStreamStats();
330 EXPECT_EQ(info.local_stats.front().ssrc, kStats.remote_ssrc);
331 EXPECT_EQ(info.bytes_rcvd, kStats.bytes_rcvd);
332 EXPECT_EQ(info.packets_rcvd, kStats.packets_rcvd);
333 EXPECT_EQ(info.packets_lost, kStats.packets_lost);
334 EXPECT_EQ(info.fraction_lost, kStats.fraction_lost);
335 EXPECT_EQ(info.codec_name, kStats.codec_name);
336 EXPECT_EQ(info.ext_seqnum, kStats.ext_seqnum);
337 EXPECT_EQ(info.jitter_ms, kStats.jitter_ms);
338 EXPECT_EQ(info.jitter_buffer_ms, kStats.jitter_buffer_ms);
339 EXPECT_EQ(info.jitter_buffer_preferred_ms,
340 kStats.jitter_buffer_preferred_ms);
341 EXPECT_EQ(info.delay_estimate_ms, kStats.delay_estimate_ms);
342 EXPECT_EQ(info.audio_level, kStats.audio_level);
343 EXPECT_EQ(info.expand_rate, kStats.expand_rate);
344 EXPECT_EQ(info.speech_expand_rate, kStats.speech_expand_rate);
345 EXPECT_EQ(info.secondary_decoded_rate, kStats.secondary_decoded_rate);
346 EXPECT_EQ(info.accelerate_rate, kStats.accelerate_rate);
347 EXPECT_EQ(info.preemptive_expand_rate, kStats.preemptive_expand_rate);
348 EXPECT_EQ(info.decoding_calls_to_silence_generator,
349 kStats.decoding_calls_to_silence_generator);
350 EXPECT_EQ(info.decoding_calls_to_neteq, kStats.decoding_calls_to_neteq);
351 EXPECT_EQ(info.decoding_normal, kStats.decoding_normal);
352 EXPECT_EQ(info.decoding_plc, kStats.decoding_plc);
353 EXPECT_EQ(info.decoding_cng, kStats.decoding_cng);
354 EXPECT_EQ(info.decoding_plc_cng, kStats.decoding_plc_cng);
355 EXPECT_EQ(info.capture_start_ntp_time_ms, kStats.capture_start_ntp_time_ms);
356 }
357
294 protected: 358 protected:
295 cricket::FakeCall call_; 359 cricket::FakeCall call_;
296 cricket::FakeWebRtcVoiceEngine voe_; 360 cricket::FakeWebRtcVoiceEngine voe_;
297 FakeVoETraceWrapper* trace_wrapper_; 361 FakeVoETraceWrapper* trace_wrapper_;
298 cricket::WebRtcVoiceEngine engine_; 362 cricket::WebRtcVoiceEngine engine_;
299 cricket::VoiceMediaChannel* channel_; 363 cricket::VoiceMediaChannel* channel_;
300 364
301 cricket::AudioSendParameters send_parameters_; 365 cricket::AudioSendParameters send_parameters_;
302 cricket::AudioRecvParameters recv_parameters_; 366 cricket::AudioRecvParameters recv_parameters_;
303 cricket::AudioOptions options_adjust_agc_; 367 cricket::AudioOptions options_adjust_agc_;
(...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after
1983 EXPECT_EQ(kPcmuCodec.name, info.senders[i].codec_name); 2047 EXPECT_EQ(kPcmuCodec.name, info.senders[i].codec_name);
1984 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].bytes_sent); 2048 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].bytes_sent);
1985 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].packets_sent); 2049 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].packets_sent);
1986 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].packets_lost); 2050 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].packets_lost);
1987 EXPECT_EQ(cricket::kFractionLostStatValue, info.senders[i].fraction_lost); 2051 EXPECT_EQ(cricket::kFractionLostStatValue, info.senders[i].fraction_lost);
1988 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].ext_seqnum); 2052 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].ext_seqnum);
1989 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].rtt_ms); 2053 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].rtt_ms);
1990 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].jitter_ms); 2054 EXPECT_EQ(cricket::kIntStatValue, info.senders[i].jitter_ms);
1991 EXPECT_EQ(kPcmuCodec.name, info.senders[i].codec_name); 2055 EXPECT_EQ(kPcmuCodec.name, info.senders[i].codec_name);
1992 } 2056 }
1993 EXPECT_EQ(0u, info.receivers.size());
1994 2057
1995 // Registered stream's remote SSRC is kSsrc2. Send a packet with SSRC=1. 2058 // We have added one receive stream. We should see empty stats.
1996 // We should drop the packet and no stats should be available. 2059 EXPECT_EQ(info.receivers.size(), 1u);
1997 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); 2060 EXPECT_EQ(info.receivers[0].local_stats.front().ssrc, 0);
2061
2062 // Remove the kSsrc2 stream. No receiver stats.
2063 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc2));
1998 EXPECT_EQ(true, channel_->GetStats(&info)); 2064 EXPECT_EQ(true, channel_->GetStats(&info));
1999 EXPECT_EQ(0u, info.receivers.size()); 2065 EXPECT_EQ(0u, info.receivers.size());
2000 2066
2001 // Remove the kSsrc2 stream and deliver a new packet - a default receive 2067 // Deliver a new packet - a default receive stream should be created and we
2002 // stream should be created and we should see stats. 2068 // should see stats again.
2003 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc2));
2004 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); 2069 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame));
2070 SetAudioReceiveStreamStats();
2005 EXPECT_EQ(true, channel_->GetStats(&info)); 2071 EXPECT_EQ(true, channel_->GetStats(&info));
2006 EXPECT_EQ(1u, info.receivers.size()); 2072 EXPECT_EQ(1u, info.receivers.size());
2007 2073 VerifyVoiceReceiverInfo(info.receivers[0]);
2008 EXPECT_EQ(cricket::kIntStatValue, info.receivers[0].bytes_rcvd);
2009 EXPECT_EQ(cricket::kIntStatValue, info.receivers[0].packets_rcvd);
2010 EXPECT_EQ(cricket::kIntStatValue, info.receivers[0].packets_lost);
2011 EXPECT_EQ(cricket::kIntStatValue, info.receivers[0].ext_seqnum);
2012 EXPECT_EQ(kPcmuCodec.name, info.receivers[0].codec_name);
2013 EXPECT_EQ(static_cast<float>(cricket::kNetStats.currentExpandRate) /
2014 (1 << 14), info.receivers[0].expand_rate);
2015 EXPECT_EQ(static_cast<float>(cricket::kNetStats.currentSpeechExpandRate) /
2016 (1 << 14), info.receivers[0].speech_expand_rate);
2017 EXPECT_EQ(static_cast<float>(cricket::kNetStats.currentSecondaryDecodedRate) /
2018 (1 << 14), info.receivers[0].secondary_decoded_rate);
2019 EXPECT_EQ(
2020 static_cast<float>(cricket::kNetStats.currentAccelerateRate) / (1 << 14),
2021 info.receivers[0].accelerate_rate);
2022 EXPECT_EQ(
2023 static_cast<float>(cricket::kNetStats.currentPreemptiveRate) / (1 << 14),
2024 info.receivers[0].preemptive_expand_rate);
2025 } 2074 }
2026 2075
2027 // Test that we can add and remove receive streams, and do proper send/playout. 2076 // Test that we can add and remove receive streams, and do proper send/playout.
2028 // We can receive on multiple streams while sending one stream. 2077 // We can receive on multiple streams while sending one stream.
2029 TEST_F(WebRtcVoiceEngineTestFake, PlayoutWithMultipleStreams) { 2078 TEST_F(WebRtcVoiceEngineTestFake, PlayoutWithMultipleStreams) {
2030 EXPECT_TRUE(SetupEngineWithSendStream()); 2079 EXPECT_TRUE(SetupEngineWithSendStream());
2031 int channel_num1 = voe_.GetLastChannel(); 2080 int channel_num1 = voe_.GetLastChannel();
2032 2081
2033 // Start playout without a receive stream. 2082 // Start playout without a receive stream.
2034 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 2083 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 EXPECT_EQ(cricket::kIntStatValue, info.senders[0].jitter_ms); 2324 EXPECT_EQ(cricket::kIntStatValue, info.senders[0].jitter_ms);
2276 EXPECT_EQ(kPcmuCodec.name, info.senders[0].codec_name); 2325 EXPECT_EQ(kPcmuCodec.name, info.senders[0].codec_name);
2277 // TODO(sriniv): Add testing for more fields. These are not populated 2326 // TODO(sriniv): Add testing for more fields. These are not populated
2278 // in FakeWebrtcVoiceEngine yet. 2327 // in FakeWebrtcVoiceEngine yet.
2279 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].audio_level); 2328 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].audio_level);
2280 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].echo_delay_median_ms); 2329 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].echo_delay_median_ms);
2281 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].echo_delay_std_ms); 2330 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].echo_delay_std_ms);
2282 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].echo_return_loss); 2331 // EXPECT_EQ(cricket::kIntStatValue, info.senders[0].echo_return_loss);
2283 // EXPECT_EQ(cricket::kIntStatValue, 2332 // EXPECT_EQ(cricket::kIntStatValue,
2284 // info.senders[0].echo_return_loss_enhancement); 2333 // info.senders[0].echo_return_loss_enhancement);
2285 EXPECT_EQ(0u, info.receivers.size()); 2334 // We have added one receive stream. We should see empty stats.
2335 EXPECT_EQ(info.receivers.size(), 1u);
2336 EXPECT_EQ(info.receivers[0].local_stats.front().ssrc, 0);
2286 2337
2287 // Registered stream's remote SSRC is kSsrc2. Send a packet with SSRC=1. 2338 // Remove the kSsrc2 stream. No receiver stats.
2288 // We should drop the packet and no stats should be available. 2339 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc2));
2289 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame));
2290 EXPECT_EQ(true, channel_->GetStats(&info)); 2340 EXPECT_EQ(true, channel_->GetStats(&info));
2291 EXPECT_EQ(0u, info.receivers.size()); 2341 EXPECT_EQ(0u, info.receivers.size());
2292 2342
2293 // Remove the kSsrc2 stream and deliver a new packet - a default receive 2343 // Deliver a new packet - a default receive stream should be created and we
2294 // stream should be created and we should see stats. 2344 // should see stats again.
2295 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc2));
2296 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); 2345 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame));
2346 SetAudioReceiveStreamStats();
2297 EXPECT_EQ(true, channel_->GetStats(&info)); 2347 EXPECT_EQ(true, channel_->GetStats(&info));
2298 EXPECT_EQ(1u, info.receivers.size()); 2348 EXPECT_EQ(1u, info.receivers.size());
2299 2349 VerifyVoiceReceiverInfo(info.receivers[0]);
2300 EXPECT_EQ(cricket::kIntStatValue, info.receivers[0].bytes_rcvd);
2301 EXPECT_EQ(cricket::kIntStatValue, info.receivers[0].packets_rcvd);
2302 EXPECT_EQ(cricket::kIntStatValue, info.receivers[0].packets_lost);
2303 EXPECT_EQ(cricket::kIntStatValue, info.receivers[0].ext_seqnum);
2304 EXPECT_EQ(kPcmuCodec.name, info.receivers[0].codec_name);
2305 EXPECT_EQ(static_cast<float>(cricket::kNetStats.currentExpandRate) /
2306 (1 << 14), info.receivers[0].expand_rate);
2307 EXPECT_EQ(static_cast<float>(cricket::kNetStats.currentSpeechExpandRate) /
2308 (1 << 14), info.receivers[0].speech_expand_rate);
2309 EXPECT_EQ(static_cast<float>(cricket::kNetStats.currentSecondaryDecodedRate) /
2310 (1 << 14), info.receivers[0].secondary_decoded_rate);
2311 // TODO(sriniv): Add testing for more receiver fields.
2312 } 2350 }
2313 2351
2314 // Test that we can set the outgoing SSRC properly with multiple streams. 2352 // Test that we can set the outgoing SSRC properly with multiple streams.
2315 // SSRC is set in SetupEngine by calling AddSendStream. 2353 // SSRC is set in SetupEngine by calling AddSendStream.
2316 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrcWithMultipleStreams) { 2354 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrcWithMultipleStreams) {
2317 EXPECT_TRUE(SetupEngineWithSendStream()); 2355 EXPECT_TRUE(SetupEngineWithSendStream());
2318 int channel_num1 = voe_.GetLastChannel(); 2356 int channel_num1 = voe_.GetLastChannel();
2319 unsigned int send_ssrc; 2357 unsigned int send_ssrc;
2320 EXPECT_EQ(0, voe_.GetLocalSSRC(channel_num1, send_ssrc)); 2358 EXPECT_EQ(0, voe_.GetLocalSSRC(channel_num1, send_ssrc));
2321 EXPECT_EQ(kSsrc1, send_ssrc); 2359 EXPECT_EQ(kSsrc1, send_ssrc);
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
3246 cricket::WebRtcVoiceEngine engine; 3284 cricket::WebRtcVoiceEngine engine;
3247 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); 3285 EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
3248 rtc::scoped_ptr<webrtc::Call> call( 3286 rtc::scoped_ptr<webrtc::Call> call(
3249 webrtc::Call::Create(webrtc::Call::Config())); 3287 webrtc::Call::Create(webrtc::Call::Config()));
3250 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), 3288 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(),
3251 call.get()); 3289 call.get());
3252 cricket::AudioRecvParameters parameters; 3290 cricket::AudioRecvParameters parameters;
3253 parameters.codecs = engine.codecs(); 3291 parameters.codecs = engine.codecs();
3254 EXPECT_TRUE(channel.SetRecvParameters(parameters)); 3292 EXPECT_TRUE(channel.SetRecvParameters(parameters));
3255 } 3293 }
OLDNEW
« no previous file with comments | « talk/media/webrtc/webrtcvoiceengine.cc ('k') | webrtc/audio/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698