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

Side by Side Diff: webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.cc

Issue 1992763002: Moved injection of AudioDecoderFactory into voe::Channel. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@audio-decoder-factory-injections-1
Patch Set: Addressed nit. Created 4 years, 7 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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/tools/neteq_performance_test.h" 11 #include "webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.h"
12 12
13 #include "webrtc/base/checks.h" 13 #include "webrtc/base/checks.h"
14 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h"
14 #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h" 15 #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h"
15 #include "webrtc/modules/audio_coding/neteq/include/neteq.h" 16 #include "webrtc/modules/audio_coding/neteq/include/neteq.h"
16 #include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h" 17 #include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h"
17 #include "webrtc/modules/audio_coding/neteq/tools/rtp_generator.h" 18 #include "webrtc/modules/audio_coding/neteq/tools/rtp_generator.h"
18 #include "webrtc/modules/include/module_common_types.h" 19 #include "webrtc/modules/include/module_common_types.h"
19 #include "webrtc/system_wrappers/include/clock.h" 20 #include "webrtc/system_wrappers/include/clock.h"
20 #include "webrtc/test/testsupport/fileutils.h" 21 #include "webrtc/test/testsupport/fileutils.h"
21 #include "webrtc/typedefs.h" 22 #include "webrtc/typedefs.h"
22 23
23 using webrtc::NetEq; 24 using webrtc::NetEq;
(...skipping 11 matching lines...) Expand all
35 webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm"); 36 webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
36 const int kSampRateHz = 32000; 37 const int kSampRateHz = 32000;
37 const webrtc::NetEqDecoder kDecoderType = 38 const webrtc::NetEqDecoder kDecoderType =
38 webrtc::NetEqDecoder::kDecoderPCM16Bswb32kHz; 39 webrtc::NetEqDecoder::kDecoderPCM16Bswb32kHz;
39 const std::string kDecoderName = "pcm16-swb32"; 40 const std::string kDecoderName = "pcm16-swb32";
40 const int kPayloadType = 95; 41 const int kPayloadType = 95;
41 42
42 // Initialize NetEq instance. 43 // Initialize NetEq instance.
43 NetEq::Config config; 44 NetEq::Config config;
44 config.sample_rate_hz = kSampRateHz; 45 config.sample_rate_hz = kSampRateHz;
45 NetEq* neteq = NetEq::Create(config); 46 NetEq* neteq = NetEq::Create(config, CreateBuiltinAudioDecoderFactory());
46 // Register decoder in |neteq|. 47 // Register decoder in |neteq|.
47 if (neteq->RegisterPayloadType(kDecoderType, kDecoderName, kPayloadType) != 0) 48 if (neteq->RegisterPayloadType(kDecoderType, kDecoderName, kPayloadType) != 0)
48 return -1; 49 return -1;
49 50
50 // Set up AudioLoop object. 51 // Set up AudioLoop object.
51 AudioLoop audio_loop; 52 AudioLoop audio_loop;
52 const size_t kMaxLoopLengthSamples = kSampRateHz * 10; // 10 second loop. 53 const size_t kMaxLoopLengthSamples = kSampRateHz * 10; // 10 second loop.
53 const size_t kInputBlockSizeSamples = 60 * kSampRateHz / 1000; // 60 ms. 54 const size_t kInputBlockSizeSamples = 60 * kSampRateHz / 1000; // 60 ms.
54 if (!audio_loop.Init(kInputFileName, kMaxLoopLengthSamples, 55 if (!audio_loop.Init(kInputFileName, kMaxLoopLengthSamples,
55 kInputBlockSizeSamples)) 56 kInputBlockSizeSamples))
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 drift_flipped = true; 124 drift_flipped = true;
124 } 125 }
125 } 126 }
126 int64_t end_time_ms = clock->TimeInMilliseconds(); 127 int64_t end_time_ms = clock->TimeInMilliseconds();
127 delete neteq; 128 delete neteq;
128 return end_time_ms - start_time_ms; 129 return end_time_ms - start_time_ms;
129 } 130 }
130 131
131 } // namespace test 132 } // namespace test
132 } // namespace webrtc 133 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698