| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 NetEqDecodingTest::NetEqDecodingTest() | 267 NetEqDecodingTest::NetEqDecodingTest() |
| 267 : neteq_(NULL), | 268 : neteq_(NULL), |
| 268 config_(), | 269 config_(), |
| 269 sim_clock_(0), | 270 sim_clock_(0), |
| 270 output_sample_rate_(kInitSampleRateHz), | 271 output_sample_rate_(kInitSampleRateHz), |
| 271 algorithmic_delay_ms_(0) { | 272 algorithmic_delay_ms_(0) { |
| 272 config_.sample_rate_hz = kInitSampleRateHz; | 273 config_.sample_rate_hz = kInitSampleRateHz; |
| 273 } | 274 } |
| 274 | 275 |
| 275 void NetEqDecodingTest::SetUp() { | 276 void NetEqDecodingTest::SetUp() { |
| 276 neteq_ = NetEq::Create(config_); | 277 neteq_ = NetEq::Create(config_, CreateBuiltinAudioDecoderFactory()); |
| 277 NetEqNetworkStatistics stat; | 278 NetEqNetworkStatistics stat; |
| 278 ASSERT_EQ(0, neteq_->NetworkStatistics(&stat)); | 279 ASSERT_EQ(0, neteq_->NetworkStatistics(&stat)); |
| 279 algorithmic_delay_ms_ = stat.current_buffer_size_ms; | 280 algorithmic_delay_ms_ = stat.current_buffer_size_ms; |
| 280 ASSERT_TRUE(neteq_); | 281 ASSERT_TRUE(neteq_); |
| 281 LoadDecoders(); | 282 LoadDecoders(); |
| 282 } | 283 } |
| 283 | 284 |
| 284 void NetEqDecodingTest::TearDown() { | 285 void NetEqDecodingTest::TearDown() { |
| 285 delete neteq_; | 286 delete neteq_; |
| 286 } | 287 } |
| (...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1510 timestamp += kSamples; | 1511 timestamp += kSamples; |
| 1511 | 1512 |
| 1512 // Pull audio once. | 1513 // Pull audio once. |
| 1513 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_)); | 1514 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_)); |
| 1514 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); | 1515 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); |
| 1515 } | 1516 } |
| 1516 // Verify speech output. | 1517 // Verify speech output. |
| 1517 EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_); | 1518 EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_); |
| 1518 } | 1519 } |
| 1519 } // namespace webrtc | 1520 } // namespace webrtc |
| OLD | NEW |