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

Side by Side Diff: webrtc/audio/test/low_bandwidth_audio_test.cc

Issue 2804083003: Add POLQA to low bandwidth audio test (Closed)
Patch Set: Add POLQA to low bandwidth audio test Created 3 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 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 <algorithm> 11 #include <algorithm>
12 12
13 #include "gflags/gflags.h"
13 #include "webrtc/audio/test/low_bandwidth_audio_test.h" 14 #include "webrtc/audio/test/low_bandwidth_audio_test.h"
14 #include "webrtc/common_audio/wav_file.h" 15 #include "webrtc/common_audio/wav_file.h"
15 #include "webrtc/test/gtest.h" 16 #include "webrtc/test/gtest.h"
16 #include "webrtc/system_wrappers/include/sleep.h" 17 #include "webrtc/system_wrappers/include/sleep.h"
17 #include "webrtc/test/testsupport/fileutils.h" 18 #include "webrtc/test/testsupport/fileutils.h"
18 19
19 namespace { 20 namespace {
20 // Wait half a second between stopping sending and stopping receiving audio. 21 // Wait half a second between stopping sending and stopping receiving audio.
21 constexpr int kExtraRecordTimeMs = 500; 22 constexpr int kExtraRecordTimeMs = 500;
22 23
23 // Large bitrate by default. 24 // Large bitrate by default.
24 const webrtc::CodecInst kDefaultCodec{120, "OPUS", 48000, 960, 2, 64000}; 25 const webrtc::CodecInst kDefaultCodec{120, "OPUS", 48000, 960, 2, 64000};
25 26
26 // The best that can be done with PESQ. 27 DEFINE_int32(bitrate, 16000, "Bitrate of the produced audio file.");
kjellander_webrtc 2017/04/07 18:26:12 This should probably be called sampling_frequency
oprypin_webrtc 2017/04/10 12:20:40 Done.
27 constexpr int kAudioFileBitRate = 16000;
28 } 28 }
29 29
30 namespace webrtc { 30 namespace webrtc {
31 namespace test { 31 namespace test {
32 32
33 AudioQualityTest::AudioQualityTest() 33 AudioQualityTest::AudioQualityTest()
34 : EndToEndTest(CallTest::kDefaultTimeoutMs) {} 34 : EndToEndTest(CallTest::kDefaultTimeoutMs) {}
35 35
36 size_t AudioQualityTest::GetNumVideoStreams() const { 36 size_t AudioQualityTest::GetNumVideoStreams() const {
37 return 0; 37 return 0;
38 } 38 }
39 size_t AudioQualityTest::GetNumAudioStreams() const { 39 size_t AudioQualityTest::GetNumAudioStreams() const {
40 return 1; 40 return 1;
41 } 41 }
42 size_t AudioQualityTest::GetNumFlexfecStreams() const { 42 size_t AudioQualityTest::GetNumFlexfecStreams() const {
43 return 0; 43 return 0;
44 } 44 }
45 45
46 std::string AudioQualityTest::AudioInputFile() { 46 std::string AudioQualityTest::AudioInputFile() {
47 return test::ResourcePath("voice_engine/audio_tiny16", "wav"); 47 return test::ResourcePath("voice_engine/audio_tiny" +
48 std::to_string(FLAGS_bitrate / 1000), "wav");
48 } 49 }
49 50
50 std::string AudioQualityTest::AudioOutputFile() { 51 std::string AudioQualityTest::AudioOutputFile() {
51 const ::testing::TestInfo* const test_info = 52 const ::testing::TestInfo* const test_info =
52 ::testing::UnitTest::GetInstance()->current_test_info(); 53 ::testing::UnitTest::GetInstance()->current_test_info();
53 return webrtc::test::OutputPath() + 54 return webrtc::test::OutputPath() + "LowBandwidth_" +
54 "LowBandwidth_" + test_info->name() + ".wav"; 55 test_info->name() + "_" + std::to_string(FLAGS_bitrate / 1000) + ".wav";
55 } 56 }
56 57
57 std::unique_ptr<test::FakeAudioDevice::Capturer> 58 std::unique_ptr<test::FakeAudioDevice::Capturer>
58 AudioQualityTest::CreateCapturer() { 59 AudioQualityTest::CreateCapturer() {
59 return test::FakeAudioDevice::CreateWavFileReader(AudioInputFile()); 60 return test::FakeAudioDevice::CreateWavFileReader(AudioInputFile());
60 } 61 }
61 62
62 std::unique_ptr<test::FakeAudioDevice::Renderer> 63 std::unique_ptr<test::FakeAudioDevice::Renderer>
63 AudioQualityTest::CreateRenderer() { 64 AudioQualityTest::CreateRenderer() {
64 return test::FakeAudioDevice::CreateBoundedWavFileWriter( 65 return test::FakeAudioDevice::CreateBoundedWavFileWriter(
65 AudioOutputFile(), kAudioFileBitRate); 66 AudioOutputFile(), FLAGS_bitrate);
66 } 67 }
67 68
68 void AudioQualityTest::OnFakeAudioDevicesCreated( 69 void AudioQualityTest::OnFakeAudioDevicesCreated(
69 test::FakeAudioDevice* send_audio_device, 70 test::FakeAudioDevice* send_audio_device,
70 test::FakeAudioDevice* recv_audio_device) { 71 test::FakeAudioDevice* recv_audio_device) {
71 send_audio_device_ = send_audio_device; 72 send_audio_device_ = send_audio_device;
72 } 73 }
73 74
74 FakeNetworkPipe::Config AudioQualityTest::GetNetworkPipeConfig() { 75 FakeNetworkPipe::Config AudioQualityTest::GetNetworkPipeConfig() {
75 return FakeNetworkPipe::Config(); 76 return FakeNetworkPipe::Config();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 144 }
144 }; 145 };
145 146
146 TEST_F(LowBandwidthAudioTest, Mobile2GNetwork) { 147 TEST_F(LowBandwidthAudioTest, Mobile2GNetwork) {
147 Mobile2GNetworkTest test; 148 Mobile2GNetworkTest test;
148 RunBaseTest(&test); 149 RunBaseTest(&test);
149 } 150 }
150 151
151 } // namespace test 152 } // namespace test
152 } // namespace webrtc 153 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698