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

Side by Side Diff: webrtc/audio/audio_send_stream_unittest.cc

Issue 1414743004: Implement AudioSendStream::GetStats(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: workaround for android build issue Created 5 years, 1 month 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 | « webrtc/audio/audio_send_stream.cc ('k') | webrtc/audio/conversion.h » ('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 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 #include "webrtc/audio/audio_send_stream.h" 13 #include "webrtc/audio/audio_send_stream.h"
14 #include "webrtc/audio/conversion.h"
15 #include "webrtc/test/fake_voice_engine.h"
14 16
15 namespace webrtc { 17 namespace webrtc {
18 namespace test {
16 19
17 TEST(AudioSendStreamTest, ConfigToString) { 20 TEST(AudioSendStreamTest, ConfigToString) {
18 const int kAbsSendTimeId = 3; 21 const int kAbsSendTimeId = 3;
19 AudioSendStream::Config config(nullptr); 22 AudioSendStream::Config config(nullptr);
20 config.rtp.ssrc = 1234; 23 config.rtp.ssrc = 1234;
21 config.rtp.extensions.push_back( 24 config.rtp.extensions.push_back(
22 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId)); 25 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId));
23 config.voe_channel_id = 1; 26 config.voe_channel_id = 1;
24 config.cng_payload_type = 42; 27 config.cng_payload_type = 42;
25 config.red_payload_type = 17; 28 config.red_payload_type = 17;
26 EXPECT_GT(config.ToString().size(), 0u); 29 EXPECT_EQ("{rtp: {ssrc: 1234, extensions: [{name: "
30 "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time, id: 3}]}, "
31 "voe_channel_id: 1, cng_payload_type: 42, red_payload_type: 17}",
32 config.ToString());
27 } 33 }
28 34
29 TEST(AudioSendStreamTest, ConstructDestruct) { 35 TEST(AudioSendStreamTest, ConstructDestruct) {
36 FakeVoiceEngine voice_engine;
30 AudioSendStream::Config config(nullptr); 37 AudioSendStream::Config config(nullptr);
31 config.voe_channel_id = 1; 38 config.voe_channel_id = 1;
32 internal::AudioSendStream send_stream(config); 39 internal::AudioSendStream send_stream(config, &voice_engine);
33 } 40 }
41
42 TEST(AudioSendStreamTest, GetStats) {
43 FakeVoiceEngine voice_engine;
44 AudioSendStream::Config config(nullptr);
45 config.rtp.ssrc = FakeVoiceEngine::kSendSsrc;
46 config.voe_channel_id = FakeVoiceEngine::kSendChannelId;
47 internal::AudioSendStream send_stream(config, &voice_engine);
48
49 AudioSendStream::Stats stats = send_stream.GetStats();
50 const CallStatistics& call_stats = FakeVoiceEngine::kSendCallStats;
51 const CodecInst& codec_inst = FakeVoiceEngine::kSendCodecInst;
52 const ReportBlock& report_block = FakeVoiceEngine::kSendReportBlock;
53 EXPECT_EQ(FakeVoiceEngine::kSendSsrc, stats.local_ssrc);
54 EXPECT_EQ(static_cast<int64_t>(call_stats.bytesSent), stats.bytes_sent);
55 EXPECT_EQ(call_stats.packetsSent, stats.packets_sent);
56 EXPECT_EQ(static_cast<int32_t>(report_block.cumulative_num_packets_lost),
57 stats.packets_lost);
58 EXPECT_EQ(Q8ToFloat(report_block.fraction_lost), stats.fraction_lost);
59 EXPECT_EQ(std::string(codec_inst.plname), stats.codec_name);
60 EXPECT_EQ(static_cast<int32_t>(report_block.extended_highest_sequence_number),
61 stats.ext_seqnum);
62 EXPECT_EQ(static_cast<int32_t>(report_block.interarrival_jitter /
63 (codec_inst.plfreq / 1000)), stats.jitter_ms);
64 EXPECT_EQ(call_stats.rttMs, stats.rtt_ms);
65 EXPECT_EQ(static_cast<int32_t>(FakeVoiceEngine::kSendSpeechInputLevel),
66 stats.audio_level);
67 EXPECT_EQ(-1, stats.aec_quality_min);
68 EXPECT_EQ(FakeVoiceEngine::kSendEchoDelayMedian, stats.echo_delay_median_ms);
69 EXPECT_EQ(FakeVoiceEngine::kSendEchoDelayStdDev, stats.echo_delay_std_ms);
70 EXPECT_EQ(FakeVoiceEngine::kSendEchoReturnLoss, stats.echo_return_loss);
71 EXPECT_EQ(FakeVoiceEngine::kSendEchoReturnLossEnhancement,
72 stats.echo_return_loss_enhancement);
73 EXPECT_FALSE(stats.typing_noise_detected);
74 }
75 } // namespace test
34 } // namespace webrtc 76 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/audio/audio_send_stream.cc ('k') | webrtc/audio/conversion.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698