OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 "webrtc/modules/audio_coding/neteq/include/neteq.h" | 11 #include "webrtc/modules/audio_coding/neteq/include/neteq.h" |
12 | 12 |
13 #include <math.h> | 13 #include <math.h> |
14 #include <stdlib.h> | 14 #include <stdlib.h> |
15 #include <string.h> // memset | 15 #include <string.h> // memset |
16 | 16 |
17 #include <algorithm> | 17 #include <algorithm> |
18 #include <memory> | 18 #include <memory> |
19 #include <set> | 19 #include <set> |
20 #include <string> | 20 #include <string> |
21 #include <vector> | 21 #include <vector> |
22 | 22 |
23 #include "gflags/gflags.h" | 23 #include "gflags/gflags.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 #include "webrtc/base/sha1digest.h" | 25 #include "webrtc/base/sha1digest.h" |
26 #include "webrtc/base/stringencode.h" | 26 #include "webrtc/base/stringencode.h" |
| 27 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" |
27 #include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h" | 28 #include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h" |
28 #include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h" | 29 #include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h" |
29 #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h" | 30 #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h" |
30 #include "webrtc/modules/include/module_common_types.h" | 31 #include "webrtc/modules/include/module_common_types.h" |
31 #include "webrtc/test/testsupport/fileutils.h" | 32 #include "webrtc/test/testsupport/fileutils.h" |
32 #include "webrtc/typedefs.h" | 33 #include "webrtc/typedefs.h" |
33 | 34 |
34 #ifdef WEBRTC_NETEQ_UNITTEST_BITEXACT | 35 #ifdef WEBRTC_NETEQ_UNITTEST_BITEXACT |
35 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD | 36 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD |
36 #include "external/webrtc/webrtc/modules/audio_coding/neteq/neteq_unittest.pb.h" | 37 #include "external/webrtc/webrtc/modules/audio_coding/neteq/neteq_unittest.pb.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 NetEqDecodingTest::NetEqDecodingTest() | 309 NetEqDecodingTest::NetEqDecodingTest() |
309 : neteq_(NULL), | 310 : neteq_(NULL), |
310 config_(), | 311 config_(), |
311 sim_clock_(0), | 312 sim_clock_(0), |
312 output_sample_rate_(kInitSampleRateHz), | 313 output_sample_rate_(kInitSampleRateHz), |
313 algorithmic_delay_ms_(0) { | 314 algorithmic_delay_ms_(0) { |
314 config_.sample_rate_hz = kInitSampleRateHz; | 315 config_.sample_rate_hz = kInitSampleRateHz; |
315 } | 316 } |
316 | 317 |
317 void NetEqDecodingTest::SetUp() { | 318 void NetEqDecodingTest::SetUp() { |
318 neteq_ = NetEq::Create(config_); | 319 neteq_ = NetEq::Create(config_, CreateBuiltinAudioDecoderFactory()); |
319 NetEqNetworkStatistics stat; | 320 NetEqNetworkStatistics stat; |
320 ASSERT_EQ(0, neteq_->NetworkStatistics(&stat)); | 321 ASSERT_EQ(0, neteq_->NetworkStatistics(&stat)); |
321 algorithmic_delay_ms_ = stat.current_buffer_size_ms; | 322 algorithmic_delay_ms_ = stat.current_buffer_size_ms; |
322 ASSERT_TRUE(neteq_); | 323 ASSERT_TRUE(neteq_); |
323 LoadDecoders(neteq_); | 324 LoadDecoders(neteq_); |
324 } | 325 } |
325 | 326 |
326 void NetEqDecodingTest::TearDown() { | 327 void NetEqDecodingTest::TearDown() { |
327 delete neteq_; | 328 delete neteq_; |
328 } | 329 } |
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 class NetEqDecodingTestTwoInstances : public NetEqDecodingTest { | 1660 class NetEqDecodingTestTwoInstances : public NetEqDecodingTest { |
1660 public: | 1661 public: |
1661 NetEqDecodingTestTwoInstances() : NetEqDecodingTest() {} | 1662 NetEqDecodingTestTwoInstances() : NetEqDecodingTest() {} |
1662 | 1663 |
1663 void SetUp() override { | 1664 void SetUp() override { |
1664 NetEqDecodingTest::SetUp(); | 1665 NetEqDecodingTest::SetUp(); |
1665 config2_ = config_; | 1666 config2_ = config_; |
1666 } | 1667 } |
1667 | 1668 |
1668 void CreateSecondInstance() { | 1669 void CreateSecondInstance() { |
1669 neteq2_.reset(NetEq::Create(config2_)); | 1670 neteq2_.reset(NetEq::Create(config2_, CreateBuiltinAudioDecoderFactory())); |
1670 ASSERT_TRUE(neteq2_); | 1671 ASSERT_TRUE(neteq2_); |
1671 LoadDecoders(neteq2_.get()); | 1672 LoadDecoders(neteq2_.get()); |
1672 } | 1673 } |
1673 | 1674 |
1674 protected: | 1675 protected: |
1675 std::unique_ptr<NetEq> neteq2_; | 1676 std::unique_ptr<NetEq> neteq2_; |
1676 NetEq::Config config2_; | 1677 NetEq::Config config2_; |
1677 }; | 1678 }; |
1678 | 1679 |
1679 namespace { | 1680 namespace { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1769 if (muted) { | 1770 if (muted) { |
1770 EXPECT_TRUE(AudioFramesEqualExceptData(out_frame1, out_frame2)); | 1771 EXPECT_TRUE(AudioFramesEqualExceptData(out_frame1, out_frame2)); |
1771 } else { | 1772 } else { |
1772 EXPECT_TRUE(AudioFramesEqual(out_frame1, out_frame2)); | 1773 EXPECT_TRUE(AudioFramesEqual(out_frame1, out_frame2)); |
1773 } | 1774 } |
1774 } | 1775 } |
1775 EXPECT_FALSE(muted); | 1776 EXPECT_FALSE(muted); |
1776 } | 1777 } |
1777 | 1778 |
1778 } // namespace webrtc | 1779 } // namespace webrtc |
OLD | NEW |