blob: 64789b4d4361a84c32c2679e32a4b972a65a02c3 [file] [log] [blame]
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:211/*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11// Unit tests for Accelerate and PreemptiveExpand classes.
12
henrik.lundin@webrtc.orga90f6d62014-05-28 06:23:3413#include "webrtc/modules/audio_coding/neteq/accelerate.h"
14#include "webrtc/modules/audio_coding/neteq/preemptive_expand.h"
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:2115
16#include "gtest/gtest.h"
henrik.lundin@webrtc.orga90f6d62014-05-28 06:23:3417#include "webrtc/modules/audio_coding/neteq/background_noise.h"
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:2118
19namespace webrtc {
20
21TEST(TimeStretch, CreateAndDestroy) {
henrik.lundin@webrtc.orgd9faa462014-01-14 10:18:4522 const int kSampleRate = 8000;
23 const size_t kNumChannels = 1;
turaj@webrtc.org8d1cdaa2014-04-11 18:47:5524 const int kOverlapSamples = 5 * kSampleRate / 8000;
henrik.lundin@webrtc.orgd9faa462014-01-14 10:18:4525 BackgroundNoise bgn(kNumChannels);
26 Accelerate accelerate(kSampleRate, kNumChannels, bgn);
turaj@webrtc.org8d1cdaa2014-04-11 18:47:5527 PreemptiveExpand preemptive_expand(
28 kSampleRate, kNumChannels, bgn, kOverlapSamples);
henrik.lundin@webrtc.orgd9faa462014-01-14 10:18:4529}
30
31TEST(TimeStretch, CreateUsingFactory) {
32 const int kSampleRate = 8000;
33 const size_t kNumChannels = 1;
turaj@webrtc.org8d1cdaa2014-04-11 18:47:5534 const int kOverlapSamples = 5 * kSampleRate / 8000;
henrik.lundin@webrtc.orgd9faa462014-01-14 10:18:4535 BackgroundNoise bgn(kNumChannels);
36
37 AccelerateFactory accelerate_factory;
38 Accelerate* accelerate =
39 accelerate_factory.Create(kSampleRate, kNumChannels, bgn);
40 EXPECT_TRUE(accelerate != NULL);
41 delete accelerate;
42
43 PreemptiveExpandFactory preemptive_expand_factory;
turaj@webrtc.org8d1cdaa2014-04-11 18:47:5544 PreemptiveExpand* preemptive_expand = preemptive_expand_factory.Create(
45 kSampleRate, kNumChannels, bgn, kOverlapSamples);
henrik.lundin@webrtc.orgd9faa462014-01-14 10:18:4546 EXPECT_TRUE(preemptive_expand != NULL);
47 delete preemptive_expand;
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:2148}
49
50// TODO(hlundin): Write more tests.
51
52} // namespace webrtc