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

Side by Side Diff: webrtc/voice_engine/voe_codec_unittest.cc

Issue 2948763002: Allow an external audio processing module to be used in WebRTC (Closed)
Patch Set: tracking linux32_rel issue Created 3 years, 6 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 <memory> 11 #include <memory>
12 12
13 #include "webrtc/voice_engine/include/voe_codec.h" 13 #include "webrtc/voice_engine/include/voe_codec.h"
14 14
15 #include "webrtc/modules/audio_device/include/fake_audio_device.h" 15 #include "webrtc/modules/audio_device/include/fake_audio_device.h"
16 #include "webrtc/modules/audio_processing/include/audio_processing.h"
16 #include "webrtc/test/gtest.h" 17 #include "webrtc/test/gtest.h"
17 #include "webrtc/voice_engine/include/voe_base.h" 18 #include "webrtc/voice_engine/include/voe_base.h"
18 #include "webrtc/voice_engine/voice_engine_defines.h" 19 #include "webrtc/voice_engine/voice_engine_defines.h"
19 20
20 namespace webrtc { 21 namespace webrtc {
21 namespace voe { 22 namespace voe {
22 namespace { 23 namespace {
23 24
24 TEST(VoECodecInst, TestCompareCodecInstances) { 25 TEST(VoECodecInst, TestCompareCodecInstances) {
25 CodecInst codec1, codec2; 26 CodecInst codec1, codec2;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 73 }
73 74
74 // This is a regression test for 75 // This is a regression test for
75 // https://bugs.chromium.org/p/webrtc/issues/detail?id=6020 76 // https://bugs.chromium.org/p/webrtc/issues/detail?id=6020
76 // The Opus DTX setting was being forgotten after unrelated VoE calls. 77 // The Opus DTX setting was being forgotten after unrelated VoE calls.
77 TEST(VoECodecInst, RememberOpusDtxAfterSettingChange) { 78 TEST(VoECodecInst, RememberOpusDtxAfterSettingChange) {
78 VoiceEngine* voe(VoiceEngine::Create()); 79 VoiceEngine* voe(VoiceEngine::Create());
79 VoEBase* base(VoEBase::GetInterface(voe)); 80 VoEBase* base(VoEBase::GetInterface(voe));
80 VoECodec* voe_codec(VoECodec::GetInterface(voe)); 81 VoECodec* voe_codec(VoECodec::GetInterface(voe));
81 std::unique_ptr<FakeAudioDeviceModule> adm(new FakeAudioDeviceModule); 82 std::unique_ptr<FakeAudioDeviceModule> adm(new FakeAudioDeviceModule);
83 std::unique_ptr<AudioProcessing> apm(AudioProcessing::Create());
82 84
83 base->Init(adm.get()); 85 base->Init(adm.get(), apm.get());
84 86
85 CodecInst codec = {111, "opus", 48000, 960, 1, 32000}; 87 CodecInst codec = {111, "opus", 48000, 960, 1, 32000};
86 88
87 int channel = base->CreateChannel(); 89 int channel = base->CreateChannel();
88 90
89 bool DTX = false; 91 bool DTX = false;
90 92
91 EXPECT_EQ(0, voe_codec->SetSendCodec(channel, codec)); 93 EXPECT_EQ(0, voe_codec->SetSendCodec(channel, codec));
92 EXPECT_EQ(0, voe_codec->SetOpusDtx(channel, true)); 94 EXPECT_EQ(0, voe_codec->SetOpusDtx(channel, true));
93 EXPECT_EQ(0, voe_codec->SetFECStatus(channel, true)); 95 EXPECT_EQ(0, voe_codec->SetFECStatus(channel, true));
94 EXPECT_EQ(0, voe_codec->GetOpusDtxStatus(channel, &DTX)); 96 EXPECT_EQ(0, voe_codec->GetOpusDtxStatus(channel, &DTX));
95 EXPECT_TRUE(DTX); 97 EXPECT_TRUE(DTX);
96 98
97 base->DeleteChannel(channel); 99 base->DeleteChannel(channel);
98 base->Terminate(); 100 base->Terminate();
99 base->Release(); 101 base->Release();
100 voe_codec->Release(); 102 voe_codec->Release();
101 VoiceEngine::Delete(voe); 103 VoiceEngine::Delete(voe);
102 } 104 }
103 105
104 } // namespace 106 } // namespace
105 } // namespace voe 107 } // namespace voe
106 } // namespace webrtc 108 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698